@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
package/src/errors/index.ts
CHANGED
|
@@ -12,7 +12,8 @@ export class ACTPError extends Error {
|
|
|
12
12
|
) {
|
|
13
13
|
super(message);
|
|
14
14
|
this.name = 'ACTPError';
|
|
15
|
-
|
|
15
|
+
// Ensure `instanceof` works for subclasses (TS + Error inheritance quirk)
|
|
16
|
+
Object.setPrototypeOf(this, new.target.prototype);
|
|
16
17
|
}
|
|
17
18
|
}
|
|
18
19
|
|
|
@@ -127,4 +128,300 @@ export class InvalidAmountError extends ValidationError {
|
|
|
127
128
|
}
|
|
128
129
|
}
|
|
129
130
|
|
|
131
|
+
/**
|
|
132
|
+
* Storage Errors (AIP-7)
|
|
133
|
+
*/
|
|
134
|
+
export class StorageError extends ACTPError {
|
|
135
|
+
constructor(operation: string, message: string, details?: any) {
|
|
136
|
+
super(
|
|
137
|
+
`Storage operation failed (${operation}): ${message}`,
|
|
138
|
+
'STORAGE_ERROR',
|
|
139
|
+
undefined,
|
|
140
|
+
{ operation, ...details }
|
|
141
|
+
);
|
|
142
|
+
this.name = 'StorageError';
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
|
|
146
|
+
export class InvalidCIDError extends ValidationError {
|
|
147
|
+
constructor(cid: string, reason?: string) {
|
|
148
|
+
super('cid', `Invalid IPFS CID: ${cid}${reason ? ` (${reason})` : ''}`);
|
|
149
|
+
this.name = 'InvalidCIDError';
|
|
150
|
+
}
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
export class UploadTimeoutError extends StorageError {
|
|
154
|
+
constructor(timeoutMs: number) {
|
|
155
|
+
super('upload', `Upload timed out after ${timeoutMs}ms`, { timeoutMs });
|
|
156
|
+
this.name = 'UploadTimeoutError';
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export class DownloadTimeoutError extends StorageError {
|
|
161
|
+
constructor(cid: string, timeoutMs: number) {
|
|
162
|
+
super('download', `Download of ${cid} timed out after ${timeoutMs}ms`, { cid, timeoutMs });
|
|
163
|
+
this.name = 'DownloadTimeoutError';
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
export class FileSizeLimitExceededError extends StorageError {
|
|
168
|
+
constructor(size: number, maxSize: number) {
|
|
169
|
+
super(
|
|
170
|
+
'upload',
|
|
171
|
+
`File size ${size} bytes exceeds maximum ${maxSize} bytes`,
|
|
172
|
+
{ size, maxSize }
|
|
173
|
+
);
|
|
174
|
+
this.name = 'FileSizeLimitExceededError';
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
export class StorageAuthenticationError extends StorageError {
|
|
179
|
+
constructor(provider: string) {
|
|
180
|
+
super('authentication', `Authentication failed for ${provider}`, { provider });
|
|
181
|
+
this.name = 'StorageAuthenticationError';
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
export class StorageRateLimitError extends StorageError {
|
|
186
|
+
constructor(retryAfter?: number) {
|
|
187
|
+
super(
|
|
188
|
+
'rate-limit',
|
|
189
|
+
`Rate limit exceeded${retryAfter ? `, retry after ${retryAfter}s` : ''}`,
|
|
190
|
+
{ retryAfter }
|
|
191
|
+
);
|
|
192
|
+
this.name = 'StorageRateLimitError';
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
|
|
196
|
+
export class ContentNotFoundError extends StorageError {
|
|
197
|
+
constructor(cid: string) {
|
|
198
|
+
super('download', `Content not found for CID: ${cid}`, { cid });
|
|
199
|
+
this.name = 'ContentNotFoundError';
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
export class ArweaveUploadError extends StorageError {
|
|
204
|
+
constructor(message: string, details?: any) {
|
|
205
|
+
super('upload', `Arweave upload failed: ${message}`, details);
|
|
206
|
+
this.name = 'ArweaveUploadError';
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
export class ArweaveDownloadError extends StorageError {
|
|
211
|
+
constructor(txId: string, message: string) {
|
|
212
|
+
super('download', `Failed to download from Arweave (${txId}): ${message}`, { txId });
|
|
213
|
+
this.name = 'ArweaveDownloadError';
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
217
|
+
export class InsufficientBalanceError extends StorageError {
|
|
218
|
+
constructor(required: string, available: string, currency: string) {
|
|
219
|
+
super(
|
|
220
|
+
'funding',
|
|
221
|
+
`Insufficient Irys balance: need ${required} ${currency}, have ${available} ${currency}`,
|
|
222
|
+
{ required, available, currency }
|
|
223
|
+
);
|
|
224
|
+
this.name = 'InsufficientBalanceError';
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
export class ArweaveTimeoutError extends StorageError {
|
|
229
|
+
constructor(operation: string, timeoutMs: number) {
|
|
230
|
+
super('timeout', `Arweave ${operation} timed out after ${timeoutMs}ms`, { operation, timeoutMs });
|
|
231
|
+
this.name = 'ArweaveTimeoutError';
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
export class InvalidArweaveTxIdError extends ValidationError {
|
|
236
|
+
constructor(txId: string, reason?: string) {
|
|
237
|
+
super('txId', `Invalid Arweave transaction ID: ${txId}${reason ? ` (${reason})` : ''}`);
|
|
238
|
+
this.name = 'InvalidArweaveTxIdError';
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
export class SwapExecutionError extends StorageError {
|
|
243
|
+
constructor(message: string, details?: any) {
|
|
244
|
+
super('swap', `Swap execution failed: ${message}`, details);
|
|
245
|
+
this.name = 'SwapExecutionError';
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
/**
|
|
250
|
+
* Registry Query Cap Exceeded Error (L-4)
|
|
251
|
+
*
|
|
252
|
+
* Thrown when AgentRegistry.queryAgentsByService() cannot complete because
|
|
253
|
+
* the registry contains more than MAX_QUERY_AGENTS (1000) agents.
|
|
254
|
+
*
|
|
255
|
+
* ## Resolution
|
|
256
|
+
*
|
|
257
|
+
* When this error is thrown, you must migrate to an off-chain indexer:
|
|
258
|
+
*
|
|
259
|
+
* 1. **The Graph**: Deploy a subgraph indexing AgentRegistered events
|
|
260
|
+
* - https://thegraph.com/docs/en/developing/creating-a-subgraph/
|
|
261
|
+
*
|
|
262
|
+
* 2. **Goldsky**: Mirror-based indexing (faster deployment)
|
|
263
|
+
* - https://docs.goldsky.com/
|
|
264
|
+
*
|
|
265
|
+
* 3. **Alchemy Subgraphs**: Managed Graph service
|
|
266
|
+
* - https://docs.alchemy.com/docs/subgraphs-overview
|
|
267
|
+
*
|
|
268
|
+
* ## Events to Index
|
|
269
|
+
*
|
|
270
|
+
* - `AgentRegistered(address indexed agent, string did, string endpoint, uint256 timestamp)`
|
|
271
|
+
* - `ServiceTypeUpdated(address indexed agent, bytes32 serviceTypeHash, bool added, uint256 timestamp)`
|
|
272
|
+
* - `ActiveStatusUpdated(address indexed agent, bool isActive, uint256 timestamp)`
|
|
273
|
+
*
|
|
274
|
+
* @example
|
|
275
|
+
* ```typescript
|
|
276
|
+
* try {
|
|
277
|
+
* const agents = await registry.queryAgentsByService({ ... });
|
|
278
|
+
* } catch (error) {
|
|
279
|
+
* if (error instanceof QueryCapExceededError) {
|
|
280
|
+
* // Switch to off-chain indexer
|
|
281
|
+
* const agents = await myIndexer.queryAgents({ ... });
|
|
282
|
+
* }
|
|
283
|
+
* }
|
|
284
|
+
* ```
|
|
285
|
+
*/
|
|
286
|
+
export class QueryCapExceededError extends ACTPError {
|
|
287
|
+
constructor(registrySize: number, maxQueryAgents: number = 1000) {
|
|
288
|
+
super(
|
|
289
|
+
`Registry size (${registrySize}) exceeds query cap (${maxQueryAgents}). ` +
|
|
290
|
+
`On-chain queries are disabled to prevent DoS. Use an off-chain indexer instead.`,
|
|
291
|
+
'QUERY_CAP_EXCEEDED',
|
|
292
|
+
undefined,
|
|
293
|
+
{
|
|
294
|
+
registrySize,
|
|
295
|
+
maxQueryAgents,
|
|
296
|
+
solution: 'Migrate to off-chain indexer (The Graph, Goldsky, or Alchemy Subgraphs)'
|
|
297
|
+
}
|
|
298
|
+
);
|
|
299
|
+
this.name = 'QueryCapExceededError';
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
/**
|
|
304
|
+
* Agent/Job Errors (Basic & Standard API)
|
|
305
|
+
*/
|
|
306
|
+
|
|
307
|
+
/**
|
|
308
|
+
* No provider found for the requested service
|
|
309
|
+
*
|
|
310
|
+
* Thrown when request() cannot find any provider offering the service.
|
|
311
|
+
*/
|
|
312
|
+
export class NoProviderFoundError extends ACTPError {
|
|
313
|
+
constructor(service: string, details?: any) {
|
|
314
|
+
super(
|
|
315
|
+
`No provider found for service "${service}". ` +
|
|
316
|
+
`Ensure at least one agent is providing this service.`,
|
|
317
|
+
'NO_PROVIDER_FOUND',
|
|
318
|
+
undefined,
|
|
319
|
+
{ service, ...details }
|
|
320
|
+
);
|
|
321
|
+
this.name = 'NoProviderFoundError';
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
|
|
325
|
+
/**
|
|
326
|
+
* Request timeout error
|
|
327
|
+
*
|
|
328
|
+
* Thrown when provider doesn't respond within the timeout period.
|
|
329
|
+
*/
|
|
330
|
+
export class TimeoutError extends ACTPError {
|
|
331
|
+
constructor(timeoutMs: number, operation?: string) {
|
|
332
|
+
super(
|
|
333
|
+
`Operation timed out after ${timeoutMs}ms${operation ? ` (${operation})` : ''}`,
|
|
334
|
+
'TIMEOUT',
|
|
335
|
+
undefined,
|
|
336
|
+
{ timeoutMs, operation }
|
|
337
|
+
);
|
|
338
|
+
this.name = 'TimeoutError';
|
|
339
|
+
}
|
|
340
|
+
}
|
|
341
|
+
|
|
342
|
+
/**
|
|
343
|
+
* Provider rejected the job
|
|
344
|
+
*
|
|
345
|
+
* Thrown when provider explicitly rejects a job (e.g., budget too low).
|
|
346
|
+
*/
|
|
347
|
+
export class ProviderRejectedError extends ACTPError {
|
|
348
|
+
constructor(provider: string, reason?: string, details?: any) {
|
|
349
|
+
super(
|
|
350
|
+
`Provider ${provider} rejected the job${reason ? `: ${reason}` : ''}`,
|
|
351
|
+
'PROVIDER_REJECTED',
|
|
352
|
+
undefined,
|
|
353
|
+
{ provider, reason, ...details }
|
|
354
|
+
);
|
|
355
|
+
this.name = 'ProviderRejectedError';
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
|
|
359
|
+
/**
|
|
360
|
+
* Provider failed to deliver result
|
|
361
|
+
*
|
|
362
|
+
* Thrown when provider transitions to DELIVERED but doesn't provide valid result.
|
|
363
|
+
*/
|
|
364
|
+
export class DeliveryFailedError extends ACTPError {
|
|
365
|
+
constructor(txId: string, reason?: string) {
|
|
366
|
+
super(
|
|
367
|
+
`Delivery failed for transaction ${txId}${reason ? `: ${reason}` : ''}`,
|
|
368
|
+
'DELIVERY_FAILED',
|
|
369
|
+
undefined,
|
|
370
|
+
{ txId, reason }
|
|
371
|
+
);
|
|
372
|
+
this.name = 'DeliveryFailedError';
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/**
|
|
377
|
+
* Dispute raised on transaction
|
|
378
|
+
*
|
|
379
|
+
* Thrown when requester raises a dispute on a delivered result.
|
|
380
|
+
*/
|
|
381
|
+
export class DisputeRaisedError extends ACTPError {
|
|
382
|
+
constructor(txId: string, reason?: string) {
|
|
383
|
+
super(
|
|
384
|
+
`Dispute raised for transaction ${txId}${reason ? `: ${reason}` : ''}`,
|
|
385
|
+
'DISPUTE_RAISED',
|
|
386
|
+
undefined,
|
|
387
|
+
{ txId, reason }
|
|
388
|
+
);
|
|
389
|
+
this.name = 'DisputeRaisedError';
|
|
390
|
+
}
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Service configuration error
|
|
395
|
+
*
|
|
396
|
+
* Thrown when Agent.provide() is called with invalid service configuration.
|
|
397
|
+
*/
|
|
398
|
+
export class ServiceConfigError extends ACTPError {
|
|
399
|
+
constructor(field: string, message: string, details?: any) {
|
|
400
|
+
super(
|
|
401
|
+
`Service configuration error (${field}): ${message}`,
|
|
402
|
+
'SERVICE_CONFIG_ERROR',
|
|
403
|
+
undefined,
|
|
404
|
+
{ field, ...details }
|
|
405
|
+
);
|
|
406
|
+
this.name = 'ServiceConfigError';
|
|
407
|
+
}
|
|
408
|
+
}
|
|
409
|
+
|
|
410
|
+
/**
|
|
411
|
+
* Agent lifecycle error
|
|
412
|
+
*
|
|
413
|
+
* Thrown when invalid agent lifecycle operations are attempted
|
|
414
|
+
* (e.g., calling start() on already running agent).
|
|
415
|
+
*/
|
|
416
|
+
export class AgentLifecycleError extends ACTPError {
|
|
417
|
+
constructor(currentState: string, attemptedAction: string) {
|
|
418
|
+
super(
|
|
419
|
+
`Cannot ${attemptedAction} agent in ${currentState} state`,
|
|
420
|
+
'AGENT_LIFECYCLE_ERROR',
|
|
421
|
+
undefined,
|
|
422
|
+
{ currentState, attemptedAction }
|
|
423
|
+
);
|
|
424
|
+
this.name = 'AgentLifecycleError';
|
|
425
|
+
}
|
|
426
|
+
}
|
|
130
427
|
|
package/src/index.ts
CHANGED
|
@@ -1,95 +1,226 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* AGIRAILS SDK - Agent Commerce Transaction Protocol
|
|
3
|
+
*
|
|
4
|
+
* This is the main entry point for the AGIRAILS SDK.
|
|
5
|
+
* The recommended way to use this SDK is through the ACTPClient class.
|
|
6
|
+
*
|
|
3
7
|
* @packageDocumentation
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { ACTPClient } from '@agirails/sdk';
|
|
12
|
+
*
|
|
13
|
+
* // Create client in mock mode
|
|
14
|
+
* const client = await ACTPClient.create({
|
|
15
|
+
* mode: 'mock',
|
|
16
|
+
* requesterAddress: '0x1234...',
|
|
17
|
+
* });
|
|
18
|
+
*
|
|
19
|
+
* // Mint some tokens for testing
|
|
20
|
+
* await client.mintTokens(client.getAddress(), '10000000000');
|
|
21
|
+
*
|
|
22
|
+
* // Create a payment
|
|
23
|
+
* const result = await client.beginner.pay({
|
|
24
|
+
* to: '0xProvider...',
|
|
25
|
+
* amount: '100',
|
|
26
|
+
* });
|
|
27
|
+
*
|
|
28
|
+
* console.log('Transaction ID:', result.txId);
|
|
29
|
+
* ```
|
|
4
30
|
*/
|
|
5
31
|
|
|
6
|
-
//
|
|
7
|
-
|
|
32
|
+
// =============================================================================
|
|
33
|
+
// Primary API - ACTPClient
|
|
34
|
+
// =============================================================================
|
|
35
|
+
|
|
36
|
+
export {
|
|
37
|
+
ACTPClient,
|
|
38
|
+
ACTPClientConfig,
|
|
39
|
+
ACTPClientMode,
|
|
40
|
+
ACTPClientInfo,
|
|
41
|
+
} from './ACTPClient';
|
|
42
|
+
|
|
43
|
+
// =============================================================================
|
|
44
|
+
// Adapter Layer - Three-Level API
|
|
45
|
+
// =============================================================================
|
|
46
|
+
|
|
47
|
+
export {
|
|
48
|
+
BaseAdapter,
|
|
49
|
+
DEFAULT_DISPUTE_WINDOW_SECONDS,
|
|
50
|
+
DEFAULT_DEADLINE_SECONDS,
|
|
51
|
+
MIN_AMOUNT_WEI,
|
|
52
|
+
MAX_DEADLINE_HOURS,
|
|
53
|
+
MAX_DEADLINE_DAYS,
|
|
54
|
+
} from './adapters/BaseAdapter';
|
|
55
|
+
|
|
56
|
+
export {
|
|
57
|
+
BeginnerAdapter,
|
|
58
|
+
BeginnerPayParams,
|
|
59
|
+
BeginnerPayResult,
|
|
60
|
+
} from './adapters/BeginnerAdapter';
|
|
61
|
+
|
|
62
|
+
export {
|
|
63
|
+
IntermediateAdapter,
|
|
64
|
+
IntermediateTransactionParams,
|
|
65
|
+
} from './adapters/IntermediateAdapter';
|
|
66
|
+
|
|
67
|
+
// =============================================================================
|
|
68
|
+
// Runtime Layer - Protocol Implementation
|
|
69
|
+
// =============================================================================
|
|
70
|
+
|
|
71
|
+
// Runtime interfaces
|
|
72
|
+
export {
|
|
73
|
+
IACTPRuntime,
|
|
74
|
+
IMockRuntime,
|
|
75
|
+
CreateTransactionParams,
|
|
76
|
+
} from './runtime/IACTPRuntime';
|
|
77
|
+
|
|
78
|
+
// MockRuntime (for local development)
|
|
79
|
+
export {
|
|
80
|
+
MockRuntime,
|
|
81
|
+
InsufficientBalanceError,
|
|
82
|
+
EscrowNotFoundError,
|
|
83
|
+
DeadlinePassedError,
|
|
84
|
+
ContractPausedError,
|
|
85
|
+
DisputeWindowActiveError,
|
|
86
|
+
} from './runtime/MockRuntime';
|
|
87
|
+
|
|
88
|
+
// MockStateManager (for custom state management)
|
|
89
|
+
export {
|
|
90
|
+
MockStateManager,
|
|
91
|
+
MockStateCorruptedError,
|
|
92
|
+
MockStateVersionError,
|
|
93
|
+
MockStateLockError,
|
|
94
|
+
} from './runtime/MockStateManager';
|
|
95
|
+
|
|
96
|
+
// BlockchainRuntime (for testnet/mainnet)
|
|
97
|
+
export {
|
|
98
|
+
BlockchainRuntime,
|
|
99
|
+
BlockchainRuntimeConfig,
|
|
100
|
+
} from './runtime/BlockchainRuntime';
|
|
101
|
+
|
|
102
|
+
// =============================================================================
|
|
103
|
+
// Type Exports
|
|
104
|
+
// =============================================================================
|
|
105
|
+
|
|
106
|
+
export {
|
|
107
|
+
MockState,
|
|
108
|
+
MockTransaction,
|
|
109
|
+
MockEscrow,
|
|
110
|
+
MockAccount,
|
|
111
|
+
MockBlockchain,
|
|
112
|
+
MockEvent,
|
|
113
|
+
TransactionState,
|
|
114
|
+
TransactionStateValue,
|
|
115
|
+
MOCK_STATE_DEFAULTS,
|
|
116
|
+
} from './runtime/types/MockState';
|
|
117
|
+
|
|
118
|
+
// =============================================================================
|
|
119
|
+
// Protocol Layer (from sdk-js merge)
|
|
120
|
+
// =============================================================================
|
|
8
121
|
|
|
9
122
|
// Protocol modules
|
|
10
123
|
export { ACTPKernel } from './protocol/ACTPKernel';
|
|
11
124
|
export { EscrowVault } from './protocol/EscrowVault';
|
|
12
125
|
export { EventMonitor } from './protocol/EventMonitor';
|
|
13
|
-
export { ProofGenerator } from './protocol/ProofGenerator';
|
|
14
126
|
export { MessageSigner } from './protocol/MessageSigner';
|
|
127
|
+
export { ProofGenerator, URLValidationConfig } from './protocol/ProofGenerator';
|
|
15
128
|
export { EASHelper, EASConfig } from './protocol/EASHelper';
|
|
16
|
-
export {
|
|
129
|
+
export { AgentRegistry } from './protocol/AgentRegistry';
|
|
130
|
+
export { DIDManager } from './protocol/DIDManager';
|
|
131
|
+
export { DIDResolver } from './protocol/DIDResolver';
|
|
17
132
|
|
|
18
|
-
//
|
|
19
|
-
export {
|
|
133
|
+
// Builders
|
|
134
|
+
export { QuoteBuilder } from './builders/QuoteBuilder';
|
|
135
|
+
export { DeliveryProofBuilder } from './builders/DeliveryProofBuilder';
|
|
136
|
+
|
|
137
|
+
// Config
|
|
138
|
+
export { getNetwork } from './config/networks';
|
|
139
|
+
export type { NetworkConfig } from './config/networks';
|
|
140
|
+
|
|
141
|
+
// Protocol types
|
|
142
|
+
export type {
|
|
20
143
|
State,
|
|
21
|
-
StateMachine,
|
|
22
144
|
Transaction,
|
|
23
|
-
CreateTransactionParams,
|
|
145
|
+
CreateTransactionParams as ProtocolCreateParams,
|
|
24
146
|
DisputeResolution,
|
|
25
147
|
EconomicParams,
|
|
26
|
-
Escrow,
|
|
27
|
-
ACTPMessage,
|
|
28
|
-
QuoteRequest,
|
|
29
|
-
QuoteResponse,
|
|
30
|
-
DeliveryProof,
|
|
31
|
-
DeliveryProofMessage,
|
|
32
|
-
EASAttestationData
|
|
33
148
|
} from './types';
|
|
34
149
|
|
|
35
|
-
//
|
|
150
|
+
// Utils
|
|
151
|
+
export { NonceManager, InMemoryNonceManager } from './utils/NonceManager';
|
|
152
|
+
export { IReceivedNonceTracker, InMemoryReceivedNonceTracker } from './utils/ReceivedNonceTracker';
|
|
153
|
+
// Note: IPFSClient is not exported from main index to avoid ESM compatibility issues
|
|
154
|
+
// Import directly from '@agirails/sdk/utils/IPFSClient' if needed
|
|
155
|
+
export type { IPFSClient, IPFSClientConfig } from './utils/IPFSClient';
|
|
156
|
+
export { generateSecureNonce, isValidNonce, generateSecureNonces } from './utils/SecureNonce';
|
|
157
|
+
export { Semaphore, RateLimiter } from './utils/Semaphore';
|
|
36
158
|
export {
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
deliveryProofDataFromProof
|
|
43
|
-
} from './types/eip712';
|
|
159
|
+
IUsedAttestationTracker,
|
|
160
|
+
InMemoryUsedAttestationTracker,
|
|
161
|
+
FileBasedUsedAttestationTracker,
|
|
162
|
+
createUsedAttestationTracker,
|
|
163
|
+
} from './utils/UsedAttestationTracker';
|
|
44
164
|
|
|
45
|
-
//
|
|
165
|
+
// Helper utilities
|
|
46
166
|
export {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
167
|
+
USDC,
|
|
168
|
+
Deadline,
|
|
169
|
+
Address,
|
|
170
|
+
Bytes32,
|
|
171
|
+
State as StateHelpers,
|
|
172
|
+
DisputeWindow,
|
|
173
|
+
parseUSDC,
|
|
174
|
+
formatUSDC,
|
|
175
|
+
shortenAddress,
|
|
176
|
+
ServiceHash,
|
|
177
|
+
hashServiceMetadata,
|
|
178
|
+
} from './utils/Helpers';
|
|
179
|
+
export type { ServiceMetadata } from './utils/Helpers';
|
|
51
180
|
|
|
52
|
-
//
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
computeCanonicalHash,
|
|
56
|
-
computeResultHash
|
|
57
|
-
} from './utils/canonicalJson';
|
|
181
|
+
// =============================================================================
|
|
182
|
+
// Basic API - Simple provide/request interface
|
|
183
|
+
// =============================================================================
|
|
58
184
|
|
|
59
|
-
export {
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
} from './
|
|
185
|
+
export { provide, request, serviceDirectory } from './level0';
|
|
186
|
+
export type {
|
|
187
|
+
Provider,
|
|
188
|
+
ProviderStatus,
|
|
189
|
+
ProviderStats,
|
|
190
|
+
ProviderBalance,
|
|
191
|
+
} from './level0';
|
|
66
192
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
193
|
+
// =============================================================================
|
|
194
|
+
// Standard API - Agent-based interface
|
|
195
|
+
// =============================================================================
|
|
196
|
+
|
|
197
|
+
export { Agent, calculatePrice, DEFAULT_PRICING_STRATEGY } from './level1';
|
|
198
|
+
export type {
|
|
199
|
+
AgentConfig,
|
|
200
|
+
AgentStatus,
|
|
201
|
+
AgentStats,
|
|
202
|
+
AgentBalance,
|
|
203
|
+
ServiceConfig,
|
|
204
|
+
Job,
|
|
205
|
+
JobHandler,
|
|
206
|
+
JobContext,
|
|
207
|
+
ProvideOptions,
|
|
208
|
+
RequestOptions,
|
|
209
|
+
RequestResult,
|
|
210
|
+
RequestStatus,
|
|
211
|
+
WalletOption,
|
|
212
|
+
NetworkOption,
|
|
213
|
+
PricingStrategy,
|
|
214
|
+
ServiceCost,
|
|
215
|
+
BelowPriceBehavior,
|
|
216
|
+
BelowCostBehavior,
|
|
217
|
+
PriceCalculation,
|
|
218
|
+
} from './level1';
|
|
219
|
+
|
|
220
|
+
// =============================================================================
|
|
221
|
+
// Enhanced Error Exports
|
|
222
|
+
// =============================================================================
|
|
73
223
|
|
|
74
|
-
// V4 Security: Nonce Replay Protection
|
|
75
|
-
export {
|
|
76
|
-
IReceivedNonceTracker,
|
|
77
|
-
InMemoryReceivedNonceTracker,
|
|
78
|
-
SetBasedReceivedNonceTracker,
|
|
79
|
-
createReceivedNonceTracker,
|
|
80
|
-
NonceValidationResult
|
|
81
|
-
} from './utils/ReceivedNonceTracker';
|
|
82
|
-
|
|
83
|
-
// Validation utilities
|
|
84
|
-
export {
|
|
85
|
-
validateAddress,
|
|
86
|
-
validateAmount,
|
|
87
|
-
validateDeadline,
|
|
88
|
-
validateDisputeWindow,
|
|
89
|
-
validateTxId
|
|
90
|
-
} from './utils/validation';
|
|
91
|
-
|
|
92
|
-
// Errors
|
|
93
224
|
export {
|
|
94
225
|
ACTPError,
|
|
95
226
|
InsufficientFundsError,
|
|
@@ -101,8 +232,13 @@ export {
|
|
|
101
232
|
NetworkError,
|
|
102
233
|
ValidationError,
|
|
103
234
|
InvalidAddressError,
|
|
104
|
-
InvalidAmountError
|
|
235
|
+
InvalidAmountError,
|
|
236
|
+
// Basic/Standard API errors
|
|
237
|
+
NoProviderFoundError,
|
|
238
|
+
TimeoutError,
|
|
239
|
+
ProviderRejectedError,
|
|
240
|
+
DeliveryFailedError,
|
|
241
|
+
DisputeRaisedError,
|
|
242
|
+
ServiceConfigError,
|
|
243
|
+
AgentLifecycleError,
|
|
105
244
|
} from './errors';
|
|
106
|
-
|
|
107
|
-
// Configuration
|
|
108
|
-
export { NetworkConfig, NETWORKS, getNetwork, isValidNetwork } from './config/networks';
|