@escro/sdk 0.2.0 → 0.3.0
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/dist/index.cjs +220 -69
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +64 -10
- package/dist/index.d.ts +64 -10
- package/dist/index.js +219 -69
- package/dist/index.js.map +1 -1
- package/package.json +17 -16
package/dist/index.d.cts
CHANGED
|
@@ -264,7 +264,15 @@ type EscrowErrorCode =
|
|
|
264
264
|
/** An unexpected server-side error occurred; report to escro.ai support. */
|
|
265
265
|
| "INTERNAL_ERROR"
|
|
266
266
|
/** Request body or query parameters failed schema validation. */
|
|
267
|
-
| "VALIDATION_ERROR"
|
|
267
|
+
| "VALIDATION_ERROR"
|
|
268
|
+
/** Confirm: no transaction for the signature at `confirmed` yet; retry once it lands. */
|
|
269
|
+
| "TX_NOT_FOUND"
|
|
270
|
+
/** Confirm: the transaction landed with an error. */
|
|
271
|
+
| "TX_FAILED"
|
|
272
|
+
/** Confirm: the transaction holds no single escrow instruction this route records for the escrow. */
|
|
273
|
+
| "TX_MISMATCH"
|
|
274
|
+
/** Confirm: the Solana RPC read failed; retry. */
|
|
275
|
+
| "RPC_UNAVAILABLE";
|
|
268
276
|
|
|
269
277
|
/**
|
|
270
278
|
* EscroBots v0 - the permissionless capability directory (ARCHITECTURE §8).
|
|
@@ -591,7 +599,7 @@ declare class Escro {
|
|
|
591
599
|
constructor(options: EscroOptions);
|
|
592
600
|
/**
|
|
593
601
|
* Create a new escrow: registers with the API, signs and submits the
|
|
594
|
-
* on-chain `create_escrow` transaction.
|
|
602
|
+
* on-chain `create_escrow` transaction, then confirms it with the API.
|
|
595
603
|
*
|
|
596
604
|
* @returns `{ escrowId, escrowPda, signature }` — use `escrowPda` for all subsequent calls.
|
|
597
605
|
*/
|
|
@@ -607,7 +615,7 @@ declare class Escro {
|
|
|
607
615
|
releasePayment(address: string): Promise<string>;
|
|
608
616
|
/**
|
|
609
617
|
* Raise a dispute for an escrow. Either the buyer or the assigned worker
|
|
610
|
-
* may call this. Signs and submits the `raise_dispute` on-chain tx.
|
|
618
|
+
* may call this. Signs and submits the `raise_dispute` on-chain tx, then confirms it with the API.
|
|
611
619
|
*
|
|
612
620
|
* @returns Solana transaction signature.
|
|
613
621
|
*/
|
|
@@ -615,7 +623,7 @@ declare class Escro {
|
|
|
615
623
|
/**
|
|
616
624
|
* Cancel a funded escrow before any worker has claimed it.
|
|
617
625
|
* Buyer must be the wallet in the constructor. Only valid when state is `FUNDED`.
|
|
618
|
-
* Signs and submits the `cancel_escrow` on-chain tx; full USDC refund to buyer.
|
|
626
|
+
* Signs and submits the `cancel_escrow` on-chain tx, then confirms it with the API; full USDC refund to buyer.
|
|
619
627
|
*
|
|
620
628
|
* @returns Solana transaction signature.
|
|
621
629
|
*/
|
|
@@ -634,14 +642,14 @@ declare class Escro {
|
|
|
634
642
|
pay(params: PayParams): Promise<PaymentResult>;
|
|
635
643
|
/**
|
|
636
644
|
* Claim an assigned task. Worker must be the wallet in the constructor.
|
|
637
|
-
* Signs and submits the `claim_task` on-chain tx.
|
|
645
|
+
* Signs and submits the `claim_task` on-chain tx, then confirms it with the API.
|
|
638
646
|
*
|
|
639
647
|
* @returns Solana transaction signature.
|
|
640
648
|
*/
|
|
641
649
|
claimTask(address: string): Promise<string>;
|
|
642
650
|
/**
|
|
643
651
|
* Submit a deliverable for the buyer to review. Worker must be the wallet.
|
|
644
|
-
* Signs and submits the `submit_deliverable` on-chain tx.
|
|
652
|
+
* Signs and submits the `submit_deliverable` on-chain tx, then confirms it with the API.
|
|
645
653
|
*
|
|
646
654
|
* @returns Solana transaction signature.
|
|
647
655
|
*/
|
|
@@ -701,6 +709,19 @@ declare class Escro {
|
|
|
701
709
|
* @returns protocol-wide {@link ProtocolStats}.
|
|
702
710
|
*/
|
|
703
711
|
getStats(): Promise<ProtocolStats>;
|
|
712
|
+
/**
|
|
713
|
+
* Ask the API to record the create, claim, submit, cancel or dispute that the
|
|
714
|
+
* landed `signature` carries; the API verifies it on chain first. Retries a
|
|
715
|
+
* not-yet-visible transaction, an RPC failure, a gateway error or a rate limit
|
|
716
|
+
* for about 30 s (waiting at least a sent Retry-After), never a rejection. Throws
|
|
717
|
+
* {@link EscroConfirmError}; calling again is safe (a replay of a recorded
|
|
718
|
+
* transition succeeds).
|
|
719
|
+
*/
|
|
720
|
+
confirm(address: string, signature: string, opts?: {
|
|
721
|
+
evidence?: string;
|
|
722
|
+
}): Promise<EscrowAccount>;
|
|
723
|
+
private send;
|
|
724
|
+
private sendAndConfirm;
|
|
704
725
|
/**
|
|
705
726
|
* Fetch an escrow by its PDA address.
|
|
706
727
|
* If `options.poll` is true, polls with exponential backoff until the escrow
|
|
@@ -740,6 +761,15 @@ declare class ApiClient {
|
|
|
740
761
|
* so it surfaces as {@link ReputationUnavailableError}, not EscrowNotFoundError.
|
|
741
762
|
*/
|
|
742
763
|
listReputations(): Promise<ServedWalletReputation[]>;
|
|
764
|
+
/**
|
|
765
|
+
* GET /rep/:wallet : one wallet's EscroRep RAW components (ARCHITECTURE §9).
|
|
766
|
+
* Unauthenticated public read (no auth headers). Unknown wallets return zeroed
|
|
767
|
+
* components, never 404; a 404 means the deployment mounted no reputation
|
|
768
|
+
* source and surfaces as {@link ReputationUnavailableError}. Shares the public
|
|
769
|
+
* per-wallet rate budget with every other caller, so fan-outs should use
|
|
770
|
+
* {@link listReputations} instead.
|
|
771
|
+
*/
|
|
772
|
+
getReputation(wallet: string): Promise<ServedWalletReputation>;
|
|
743
773
|
/**
|
|
744
774
|
* POST /v1/escrows — create escrow, returns unsigned tx + ids.
|
|
745
775
|
* Requires auth.
|
|
@@ -779,9 +809,17 @@ declare class ApiClient {
|
|
|
779
809
|
* POST /v1/escrows/:address/dispute — returns unsigned tx.
|
|
780
810
|
* Requires auth (buyer or worker).
|
|
781
811
|
*/
|
|
782
|
-
raiseDispute(address: string, params: RaiseDisputeParams): Promise<{
|
|
812
|
+
raiseDispute(address: string, params: Pick<RaiseDisputeParams, "reason">): Promise<{
|
|
783
813
|
unsignedTx: string;
|
|
784
814
|
}>;
|
|
815
|
+
/**
|
|
816
|
+
* POST /v1/escrows/:address/confirm: the API records the create, claim, submit,
|
|
817
|
+
* cancel or dispute the landed `signature` carries, after verifying it on chain.
|
|
818
|
+
* A non-2xx answer throws an {@link EscroError} with the server's code, or
|
|
819
|
+
* `HTTP_<status>` when the answer carries none; a network failure rejects with
|
|
820
|
+
* fetch's own error. {@link Escro.confirm} decides which to retry.
|
|
821
|
+
*/
|
|
822
|
+
confirm(address: string, signature: string, evidence?: string): Promise<EscrowAccount>;
|
|
785
823
|
/**
|
|
786
824
|
* GET /v1/stats — public protocol-wide stats.
|
|
787
825
|
* No auth required. Upstream typing in {@link Escro.getStats} narrows the
|
|
@@ -833,10 +871,14 @@ interface ServiceAdapter {
|
|
|
833
871
|
*/
|
|
834
872
|
declare function serviceResultToSubmitParams(result: ServiceResult): SubmitDeliverableParams;
|
|
835
873
|
|
|
836
|
-
/**
|
|
874
|
+
/**
|
|
875
|
+
* Base class for all errors thrown by the @escro/sdk. `retryAfterMs` is the
|
|
876
|
+
* server's Retry-After delay, when it sent one in seconds.
|
|
877
|
+
*/
|
|
837
878
|
declare class EscroError extends Error {
|
|
838
879
|
readonly code: string;
|
|
839
|
-
|
|
880
|
+
readonly retryAfterMs?: number | undefined;
|
|
881
|
+
constructor(message: string, code?: string, retryAfterMs?: number | undefined);
|
|
840
882
|
}
|
|
841
883
|
/** The requested escrow was not found (HTTP 404). */
|
|
842
884
|
declare class EscrowNotFoundError extends EscroError {
|
|
@@ -860,6 +902,18 @@ declare class EscrowStateError extends EscroError {
|
|
|
860
902
|
declare class EscrowTimeoutError extends EscroError {
|
|
861
903
|
constructor(address: string);
|
|
862
904
|
}
|
|
905
|
+
/**
|
|
906
|
+
* A transaction landed (or was sent) but the API did not record it. `code` is the
|
|
907
|
+
* server's code (e.g. TX_MISMATCH, TX_FAILED, or TX_NOT_FOUND after the retry
|
|
908
|
+
* window), `NETWORK_ERROR` when the last attempt never reached the API, or
|
|
909
|
+
* `HTTP_<status>` when the answer carried no code. Call {@link Escro.confirm} again
|
|
910
|
+
* with `address` and `signature` to retry.
|
|
911
|
+
*/
|
|
912
|
+
declare class EscroConfirmError extends EscroError {
|
|
913
|
+
readonly address: string;
|
|
914
|
+
readonly signature: string;
|
|
915
|
+
constructor(address: string, signature: string, code: string, message: string);
|
|
916
|
+
}
|
|
863
917
|
/** The caller is not authorized to perform this action (HTTP 401/403). */
|
|
864
918
|
declare class UnauthorizedError extends EscroError {
|
|
865
919
|
constructor(message?: string);
|
|
@@ -1697,4 +1751,4 @@ declare function solveZkmlDemo(): string;
|
|
|
1697
1751
|
*/
|
|
1698
1752
|
declare function createZkmlAdapter(config?: ZkmlAdapterConfig): ServiceAdapter;
|
|
1699
1753
|
|
|
1700
|
-
export { AKASH_ADAPTER_ID, AKASH_CAPABILITIES, AKASH_DEMO_ACCEPT_FLOOR, AKASH_DEMO_MARKER, type AcceptanceCriterion, AdapterContractError, type AdapterContractOptions, type AkashAdapterConfig, type Akt, ApiClient, type AutoReleaseDecision, type BotDescriptor, type BotRole, type CreateEscrowParams, type CreateEscrowResult, type DeliverableFormat, type DeliverableType, ENABLED_RAILS, Escro, EscroError, type EscroOptions, EscroRailNotEnabledError, type EscrowAccount, type EscrowErrorCode, EscrowNotFoundError, EscrowPaymentRouter, EscrowState, EscrowStateError, EscrowTimeoutError, GEN404_ADAPTER_ID, GEN404_CAPABILITIES, GEN404_DEMO_EVAL_FLOOR, GEN404_DEMO_MARKER, GENSYN_ADAPTER_ID, GENSYN_CAPABILITIES, GENSYN_DEMO_MARKER, GENSYN_REE_SCHEME, GRADIENTS_ADAPTER_ID, GRADIENTS_CAPABILITIES, GRADIENTS_DEMO_EVAL_FLOOR, GRADIENTS_DEMO_MARKER, type Gen404AdapterConfig, type GensynAdapterConfig, type GensynDeliverableBundle, type GradientsAdapterConfig, LIUM_ADAPTER_ID, LIUM_CAPABILITIES, LIUM_DEMO_ACCEPT_FLOOR, LIUM_DEMO_MARKER, type ListBotsParams, type ListOptions, type LiumAdapterConfig, type Network, type PaginatedResult, type PayParams, type PaymentResult, type PaymentRouter, type PinContent$3 as PinContent, type PollOptions, type ProtocolStats, RAILS, RAILS_DOCS_URL, REFERENCE_MICRO_USDC_PER_AKT, REFERENCE_MICRO_USDC_PER_RENDER, RENDER_ADAPTER_ID, RENDER_CAPABILITIES, RENDER_DEMO_ACCEPT_FLOOR, RENDER_DEMO_MARKER, RIDGES_ADAPTER_ID, RIDGES_CAPABILITIES, RIDGES_DEMO_COVERAGE_TARGET, RIDGES_DEMO_MARKER, type Rail, type RaiseDisputeParams, type ReeExecution, type ReeProof, type ReeVerification, type ReeVerifyContext, type Render, type RenderAdapterConfig, type ReproduceCompute, ReputationUnavailableError, type RidgesAdapterConfig, type RunAkashDeployment, type RunCodingAgent, type RunGpuJob, type RunRenderJob, type ServedWalletReputation, type ServiceAdapter, type ServiceResult, type SubmitDeliverableParams, type SubnetCall, type Tao, type TaskSpec, type TaskType, type TxShape, UnauthorizedError, type UnsignedBotDescriptor, type UsdcToAktSwap, type UsdcToRenderSwap, type UsdcToTaoSwap, type WorkerCandidate, ZKML_ADAPTER_ID, ZKML_CAPABILITIES, ZKML_DEMO_MARKER, ZKML_PROOF_SCHEME, ZKML_PROOF_URI_PREFIX, type ZkmlAdapterConfig, type ZkmlDeliverable, type ZkmlExpectation, type ZkmlInferenceOutput, type ZkmlProof, type ZkmlProofAutoReleaseOptions, type ZkmlReviewPolicy, type ZkmlReviewResult, type ZkmlVerification, akashDemoJobSpec, akt, assertServiceAdapterContract, buildReeProof, buildZkmlProof, computeAkashDemoArtifact, computeLiumDemoArtifact, computeRenderDemoArtifact, create404genAdapter, createAkashAdapter, createGensynAdapter, createGradientsAdapter, createLiumAdapter, createRenderAdapter, createRidgesAdapter, createZkmlAdapter, decodeZkmlProofUri, encodeZkmlProofUri, gen404DemoJobSpec, gensynAutoRelease, gensynDemoJobSpec, gradientsDemoJobSpec, liumDemoJobSpec, renderAmount, renderDemoJobSpec, reproduceGensynCompute, ridgesDemoJobSpec, score404genDemoDeliverable, scoreAkashDemoDeliverable, scoreGradientsDemoDeliverable, scoreLiumDemoDeliverable, scoreRenderDemoDeliverable, scoreRidgesDemoDeliverable, serviceResultToSubmitParams, solveAkashDemo, solveGen404Demo, solveGradientsDemo, solveLiumDemo, solveRenderDemo, solveRidgesDemo, solveZkmlDemo, tao, verifyReeProof, verifyZkmlProof, verifyZkmlProofUri, zkmlDemoJobSpec, zkmlProofAutoRelease };
|
|
1754
|
+
export { AKASH_ADAPTER_ID, AKASH_CAPABILITIES, AKASH_DEMO_ACCEPT_FLOOR, AKASH_DEMO_MARKER, type AcceptanceCriterion, AdapterContractError, type AdapterContractOptions, type AkashAdapterConfig, type Akt, ApiClient, type AutoReleaseDecision, type BotDescriptor, type BotRole, type CreateEscrowParams, type CreateEscrowResult, type DeliverableFormat, type DeliverableType, ENABLED_RAILS, Escro, EscroConfirmError, EscroError, type EscroOptions, EscroRailNotEnabledError, type EscrowAccount, type EscrowErrorCode, EscrowNotFoundError, EscrowPaymentRouter, EscrowState, EscrowStateError, EscrowTimeoutError, GEN404_ADAPTER_ID, GEN404_CAPABILITIES, GEN404_DEMO_EVAL_FLOOR, GEN404_DEMO_MARKER, GENSYN_ADAPTER_ID, GENSYN_CAPABILITIES, GENSYN_DEMO_MARKER, GENSYN_REE_SCHEME, GRADIENTS_ADAPTER_ID, GRADIENTS_CAPABILITIES, GRADIENTS_DEMO_EVAL_FLOOR, GRADIENTS_DEMO_MARKER, type Gen404AdapterConfig, type GensynAdapterConfig, type GensynDeliverableBundle, type GradientsAdapterConfig, LIUM_ADAPTER_ID, LIUM_CAPABILITIES, LIUM_DEMO_ACCEPT_FLOOR, LIUM_DEMO_MARKER, type ListBotsParams, type ListOptions, type LiumAdapterConfig, type Network, type PaginatedResult, type PayParams, type PaymentResult, type PaymentRouter, type PinContent$3 as PinContent, type PollOptions, type ProtocolStats, RAILS, RAILS_DOCS_URL, REFERENCE_MICRO_USDC_PER_AKT, REFERENCE_MICRO_USDC_PER_RENDER, RENDER_ADAPTER_ID, RENDER_CAPABILITIES, RENDER_DEMO_ACCEPT_FLOOR, RENDER_DEMO_MARKER, RIDGES_ADAPTER_ID, RIDGES_CAPABILITIES, RIDGES_DEMO_COVERAGE_TARGET, RIDGES_DEMO_MARKER, type Rail, type RaiseDisputeParams, type ReeExecution, type ReeProof, type ReeVerification, type ReeVerifyContext, type Render, type RenderAdapterConfig, type ReproduceCompute, ReputationUnavailableError, type RidgesAdapterConfig, type RunAkashDeployment, type RunCodingAgent, type RunGpuJob, type RunRenderJob, type ServedWalletReputation, type ServiceAdapter, type ServiceResult, type SubmitDeliverableParams, type SubnetCall, type Tao, type TaskSpec, type TaskType, type TxShape, UnauthorizedError, type UnsignedBotDescriptor, type UsdcToAktSwap, type UsdcToRenderSwap, type UsdcToTaoSwap, type WorkerCandidate, ZKML_ADAPTER_ID, ZKML_CAPABILITIES, ZKML_DEMO_MARKER, ZKML_PROOF_SCHEME, ZKML_PROOF_URI_PREFIX, type ZkmlAdapterConfig, type ZkmlDeliverable, type ZkmlExpectation, type ZkmlInferenceOutput, type ZkmlProof, type ZkmlProofAutoReleaseOptions, type ZkmlReviewPolicy, type ZkmlReviewResult, type ZkmlVerification, akashDemoJobSpec, akt, assertServiceAdapterContract, buildReeProof, buildZkmlProof, computeAkashDemoArtifact, computeLiumDemoArtifact, computeRenderDemoArtifact, create404genAdapter, createAkashAdapter, createGensynAdapter, createGradientsAdapter, createLiumAdapter, createRenderAdapter, createRidgesAdapter, createZkmlAdapter, decodeZkmlProofUri, encodeZkmlProofUri, gen404DemoJobSpec, gensynAutoRelease, gensynDemoJobSpec, gradientsDemoJobSpec, liumDemoJobSpec, renderAmount, renderDemoJobSpec, reproduceGensynCompute, ridgesDemoJobSpec, score404genDemoDeliverable, scoreAkashDemoDeliverable, scoreGradientsDemoDeliverable, scoreLiumDemoDeliverable, scoreRenderDemoDeliverable, scoreRidgesDemoDeliverable, serviceResultToSubmitParams, solveAkashDemo, solveGen404Demo, solveGradientsDemo, solveLiumDemo, solveRenderDemo, solveRidgesDemo, solveZkmlDemo, tao, verifyReeProof, verifyZkmlProof, verifyZkmlProofUri, zkmlDemoJobSpec, zkmlProofAutoRelease };
|
package/dist/index.d.ts
CHANGED
|
@@ -264,7 +264,15 @@ type EscrowErrorCode =
|
|
|
264
264
|
/** An unexpected server-side error occurred; report to escro.ai support. */
|
|
265
265
|
| "INTERNAL_ERROR"
|
|
266
266
|
/** Request body or query parameters failed schema validation. */
|
|
267
|
-
| "VALIDATION_ERROR"
|
|
267
|
+
| "VALIDATION_ERROR"
|
|
268
|
+
/** Confirm: no transaction for the signature at `confirmed` yet; retry once it lands. */
|
|
269
|
+
| "TX_NOT_FOUND"
|
|
270
|
+
/** Confirm: the transaction landed with an error. */
|
|
271
|
+
| "TX_FAILED"
|
|
272
|
+
/** Confirm: the transaction holds no single escrow instruction this route records for the escrow. */
|
|
273
|
+
| "TX_MISMATCH"
|
|
274
|
+
/** Confirm: the Solana RPC read failed; retry. */
|
|
275
|
+
| "RPC_UNAVAILABLE";
|
|
268
276
|
|
|
269
277
|
/**
|
|
270
278
|
* EscroBots v0 - the permissionless capability directory (ARCHITECTURE §8).
|
|
@@ -591,7 +599,7 @@ declare class Escro {
|
|
|
591
599
|
constructor(options: EscroOptions);
|
|
592
600
|
/**
|
|
593
601
|
* Create a new escrow: registers with the API, signs and submits the
|
|
594
|
-
* on-chain `create_escrow` transaction.
|
|
602
|
+
* on-chain `create_escrow` transaction, then confirms it with the API.
|
|
595
603
|
*
|
|
596
604
|
* @returns `{ escrowId, escrowPda, signature }` — use `escrowPda` for all subsequent calls.
|
|
597
605
|
*/
|
|
@@ -607,7 +615,7 @@ declare class Escro {
|
|
|
607
615
|
releasePayment(address: string): Promise<string>;
|
|
608
616
|
/**
|
|
609
617
|
* Raise a dispute for an escrow. Either the buyer or the assigned worker
|
|
610
|
-
* may call this. Signs and submits the `raise_dispute` on-chain tx.
|
|
618
|
+
* may call this. Signs and submits the `raise_dispute` on-chain tx, then confirms it with the API.
|
|
611
619
|
*
|
|
612
620
|
* @returns Solana transaction signature.
|
|
613
621
|
*/
|
|
@@ -615,7 +623,7 @@ declare class Escro {
|
|
|
615
623
|
/**
|
|
616
624
|
* Cancel a funded escrow before any worker has claimed it.
|
|
617
625
|
* Buyer must be the wallet in the constructor. Only valid when state is `FUNDED`.
|
|
618
|
-
* Signs and submits the `cancel_escrow` on-chain tx; full USDC refund to buyer.
|
|
626
|
+
* Signs and submits the `cancel_escrow` on-chain tx, then confirms it with the API; full USDC refund to buyer.
|
|
619
627
|
*
|
|
620
628
|
* @returns Solana transaction signature.
|
|
621
629
|
*/
|
|
@@ -634,14 +642,14 @@ declare class Escro {
|
|
|
634
642
|
pay(params: PayParams): Promise<PaymentResult>;
|
|
635
643
|
/**
|
|
636
644
|
* Claim an assigned task. Worker must be the wallet in the constructor.
|
|
637
|
-
* Signs and submits the `claim_task` on-chain tx.
|
|
645
|
+
* Signs and submits the `claim_task` on-chain tx, then confirms it with the API.
|
|
638
646
|
*
|
|
639
647
|
* @returns Solana transaction signature.
|
|
640
648
|
*/
|
|
641
649
|
claimTask(address: string): Promise<string>;
|
|
642
650
|
/**
|
|
643
651
|
* Submit a deliverable for the buyer to review. Worker must be the wallet.
|
|
644
|
-
* Signs and submits the `submit_deliverable` on-chain tx.
|
|
652
|
+
* Signs and submits the `submit_deliverable` on-chain tx, then confirms it with the API.
|
|
645
653
|
*
|
|
646
654
|
* @returns Solana transaction signature.
|
|
647
655
|
*/
|
|
@@ -701,6 +709,19 @@ declare class Escro {
|
|
|
701
709
|
* @returns protocol-wide {@link ProtocolStats}.
|
|
702
710
|
*/
|
|
703
711
|
getStats(): Promise<ProtocolStats>;
|
|
712
|
+
/**
|
|
713
|
+
* Ask the API to record the create, claim, submit, cancel or dispute that the
|
|
714
|
+
* landed `signature` carries; the API verifies it on chain first. Retries a
|
|
715
|
+
* not-yet-visible transaction, an RPC failure, a gateway error or a rate limit
|
|
716
|
+
* for about 30 s (waiting at least a sent Retry-After), never a rejection. Throws
|
|
717
|
+
* {@link EscroConfirmError}; calling again is safe (a replay of a recorded
|
|
718
|
+
* transition succeeds).
|
|
719
|
+
*/
|
|
720
|
+
confirm(address: string, signature: string, opts?: {
|
|
721
|
+
evidence?: string;
|
|
722
|
+
}): Promise<EscrowAccount>;
|
|
723
|
+
private send;
|
|
724
|
+
private sendAndConfirm;
|
|
704
725
|
/**
|
|
705
726
|
* Fetch an escrow by its PDA address.
|
|
706
727
|
* If `options.poll` is true, polls with exponential backoff until the escrow
|
|
@@ -740,6 +761,15 @@ declare class ApiClient {
|
|
|
740
761
|
* so it surfaces as {@link ReputationUnavailableError}, not EscrowNotFoundError.
|
|
741
762
|
*/
|
|
742
763
|
listReputations(): Promise<ServedWalletReputation[]>;
|
|
764
|
+
/**
|
|
765
|
+
* GET /rep/:wallet : one wallet's EscroRep RAW components (ARCHITECTURE §9).
|
|
766
|
+
* Unauthenticated public read (no auth headers). Unknown wallets return zeroed
|
|
767
|
+
* components, never 404; a 404 means the deployment mounted no reputation
|
|
768
|
+
* source and surfaces as {@link ReputationUnavailableError}. Shares the public
|
|
769
|
+
* per-wallet rate budget with every other caller, so fan-outs should use
|
|
770
|
+
* {@link listReputations} instead.
|
|
771
|
+
*/
|
|
772
|
+
getReputation(wallet: string): Promise<ServedWalletReputation>;
|
|
743
773
|
/**
|
|
744
774
|
* POST /v1/escrows — create escrow, returns unsigned tx + ids.
|
|
745
775
|
* Requires auth.
|
|
@@ -779,9 +809,17 @@ declare class ApiClient {
|
|
|
779
809
|
* POST /v1/escrows/:address/dispute — returns unsigned tx.
|
|
780
810
|
* Requires auth (buyer or worker).
|
|
781
811
|
*/
|
|
782
|
-
raiseDispute(address: string, params: RaiseDisputeParams): Promise<{
|
|
812
|
+
raiseDispute(address: string, params: Pick<RaiseDisputeParams, "reason">): Promise<{
|
|
783
813
|
unsignedTx: string;
|
|
784
814
|
}>;
|
|
815
|
+
/**
|
|
816
|
+
* POST /v1/escrows/:address/confirm: the API records the create, claim, submit,
|
|
817
|
+
* cancel or dispute the landed `signature` carries, after verifying it on chain.
|
|
818
|
+
* A non-2xx answer throws an {@link EscroError} with the server's code, or
|
|
819
|
+
* `HTTP_<status>` when the answer carries none; a network failure rejects with
|
|
820
|
+
* fetch's own error. {@link Escro.confirm} decides which to retry.
|
|
821
|
+
*/
|
|
822
|
+
confirm(address: string, signature: string, evidence?: string): Promise<EscrowAccount>;
|
|
785
823
|
/**
|
|
786
824
|
* GET /v1/stats — public protocol-wide stats.
|
|
787
825
|
* No auth required. Upstream typing in {@link Escro.getStats} narrows the
|
|
@@ -833,10 +871,14 @@ interface ServiceAdapter {
|
|
|
833
871
|
*/
|
|
834
872
|
declare function serviceResultToSubmitParams(result: ServiceResult): SubmitDeliverableParams;
|
|
835
873
|
|
|
836
|
-
/**
|
|
874
|
+
/**
|
|
875
|
+
* Base class for all errors thrown by the @escro/sdk. `retryAfterMs` is the
|
|
876
|
+
* server's Retry-After delay, when it sent one in seconds.
|
|
877
|
+
*/
|
|
837
878
|
declare class EscroError extends Error {
|
|
838
879
|
readonly code: string;
|
|
839
|
-
|
|
880
|
+
readonly retryAfterMs?: number | undefined;
|
|
881
|
+
constructor(message: string, code?: string, retryAfterMs?: number | undefined);
|
|
840
882
|
}
|
|
841
883
|
/** The requested escrow was not found (HTTP 404). */
|
|
842
884
|
declare class EscrowNotFoundError extends EscroError {
|
|
@@ -860,6 +902,18 @@ declare class EscrowStateError extends EscroError {
|
|
|
860
902
|
declare class EscrowTimeoutError extends EscroError {
|
|
861
903
|
constructor(address: string);
|
|
862
904
|
}
|
|
905
|
+
/**
|
|
906
|
+
* A transaction landed (or was sent) but the API did not record it. `code` is the
|
|
907
|
+
* server's code (e.g. TX_MISMATCH, TX_FAILED, or TX_NOT_FOUND after the retry
|
|
908
|
+
* window), `NETWORK_ERROR` when the last attempt never reached the API, or
|
|
909
|
+
* `HTTP_<status>` when the answer carried no code. Call {@link Escro.confirm} again
|
|
910
|
+
* with `address` and `signature` to retry.
|
|
911
|
+
*/
|
|
912
|
+
declare class EscroConfirmError extends EscroError {
|
|
913
|
+
readonly address: string;
|
|
914
|
+
readonly signature: string;
|
|
915
|
+
constructor(address: string, signature: string, code: string, message: string);
|
|
916
|
+
}
|
|
863
917
|
/** The caller is not authorized to perform this action (HTTP 401/403). */
|
|
864
918
|
declare class UnauthorizedError extends EscroError {
|
|
865
919
|
constructor(message?: string);
|
|
@@ -1697,4 +1751,4 @@ declare function solveZkmlDemo(): string;
|
|
|
1697
1751
|
*/
|
|
1698
1752
|
declare function createZkmlAdapter(config?: ZkmlAdapterConfig): ServiceAdapter;
|
|
1699
1753
|
|
|
1700
|
-
export { AKASH_ADAPTER_ID, AKASH_CAPABILITIES, AKASH_DEMO_ACCEPT_FLOOR, AKASH_DEMO_MARKER, type AcceptanceCriterion, AdapterContractError, type AdapterContractOptions, type AkashAdapterConfig, type Akt, ApiClient, type AutoReleaseDecision, type BotDescriptor, type BotRole, type CreateEscrowParams, type CreateEscrowResult, type DeliverableFormat, type DeliverableType, ENABLED_RAILS, Escro, EscroError, type EscroOptions, EscroRailNotEnabledError, type EscrowAccount, type EscrowErrorCode, EscrowNotFoundError, EscrowPaymentRouter, EscrowState, EscrowStateError, EscrowTimeoutError, GEN404_ADAPTER_ID, GEN404_CAPABILITIES, GEN404_DEMO_EVAL_FLOOR, GEN404_DEMO_MARKER, GENSYN_ADAPTER_ID, GENSYN_CAPABILITIES, GENSYN_DEMO_MARKER, GENSYN_REE_SCHEME, GRADIENTS_ADAPTER_ID, GRADIENTS_CAPABILITIES, GRADIENTS_DEMO_EVAL_FLOOR, GRADIENTS_DEMO_MARKER, type Gen404AdapterConfig, type GensynAdapterConfig, type GensynDeliverableBundle, type GradientsAdapterConfig, LIUM_ADAPTER_ID, LIUM_CAPABILITIES, LIUM_DEMO_ACCEPT_FLOOR, LIUM_DEMO_MARKER, type ListBotsParams, type ListOptions, type LiumAdapterConfig, type Network, type PaginatedResult, type PayParams, type PaymentResult, type PaymentRouter, type PinContent$3 as PinContent, type PollOptions, type ProtocolStats, RAILS, RAILS_DOCS_URL, REFERENCE_MICRO_USDC_PER_AKT, REFERENCE_MICRO_USDC_PER_RENDER, RENDER_ADAPTER_ID, RENDER_CAPABILITIES, RENDER_DEMO_ACCEPT_FLOOR, RENDER_DEMO_MARKER, RIDGES_ADAPTER_ID, RIDGES_CAPABILITIES, RIDGES_DEMO_COVERAGE_TARGET, RIDGES_DEMO_MARKER, type Rail, type RaiseDisputeParams, type ReeExecution, type ReeProof, type ReeVerification, type ReeVerifyContext, type Render, type RenderAdapterConfig, type ReproduceCompute, ReputationUnavailableError, type RidgesAdapterConfig, type RunAkashDeployment, type RunCodingAgent, type RunGpuJob, type RunRenderJob, type ServedWalletReputation, type ServiceAdapter, type ServiceResult, type SubmitDeliverableParams, type SubnetCall, type Tao, type TaskSpec, type TaskType, type TxShape, UnauthorizedError, type UnsignedBotDescriptor, type UsdcToAktSwap, type UsdcToRenderSwap, type UsdcToTaoSwap, type WorkerCandidate, ZKML_ADAPTER_ID, ZKML_CAPABILITIES, ZKML_DEMO_MARKER, ZKML_PROOF_SCHEME, ZKML_PROOF_URI_PREFIX, type ZkmlAdapterConfig, type ZkmlDeliverable, type ZkmlExpectation, type ZkmlInferenceOutput, type ZkmlProof, type ZkmlProofAutoReleaseOptions, type ZkmlReviewPolicy, type ZkmlReviewResult, type ZkmlVerification, akashDemoJobSpec, akt, assertServiceAdapterContract, buildReeProof, buildZkmlProof, computeAkashDemoArtifact, computeLiumDemoArtifact, computeRenderDemoArtifact, create404genAdapter, createAkashAdapter, createGensynAdapter, createGradientsAdapter, createLiumAdapter, createRenderAdapter, createRidgesAdapter, createZkmlAdapter, decodeZkmlProofUri, encodeZkmlProofUri, gen404DemoJobSpec, gensynAutoRelease, gensynDemoJobSpec, gradientsDemoJobSpec, liumDemoJobSpec, renderAmount, renderDemoJobSpec, reproduceGensynCompute, ridgesDemoJobSpec, score404genDemoDeliverable, scoreAkashDemoDeliverable, scoreGradientsDemoDeliverable, scoreLiumDemoDeliverable, scoreRenderDemoDeliverable, scoreRidgesDemoDeliverable, serviceResultToSubmitParams, solveAkashDemo, solveGen404Demo, solveGradientsDemo, solveLiumDemo, solveRenderDemo, solveRidgesDemo, solveZkmlDemo, tao, verifyReeProof, verifyZkmlProof, verifyZkmlProofUri, zkmlDemoJobSpec, zkmlProofAutoRelease };
|
|
1754
|
+
export { AKASH_ADAPTER_ID, AKASH_CAPABILITIES, AKASH_DEMO_ACCEPT_FLOOR, AKASH_DEMO_MARKER, type AcceptanceCriterion, AdapterContractError, type AdapterContractOptions, type AkashAdapterConfig, type Akt, ApiClient, type AutoReleaseDecision, type BotDescriptor, type BotRole, type CreateEscrowParams, type CreateEscrowResult, type DeliverableFormat, type DeliverableType, ENABLED_RAILS, Escro, EscroConfirmError, EscroError, type EscroOptions, EscroRailNotEnabledError, type EscrowAccount, type EscrowErrorCode, EscrowNotFoundError, EscrowPaymentRouter, EscrowState, EscrowStateError, EscrowTimeoutError, GEN404_ADAPTER_ID, GEN404_CAPABILITIES, GEN404_DEMO_EVAL_FLOOR, GEN404_DEMO_MARKER, GENSYN_ADAPTER_ID, GENSYN_CAPABILITIES, GENSYN_DEMO_MARKER, GENSYN_REE_SCHEME, GRADIENTS_ADAPTER_ID, GRADIENTS_CAPABILITIES, GRADIENTS_DEMO_EVAL_FLOOR, GRADIENTS_DEMO_MARKER, type Gen404AdapterConfig, type GensynAdapterConfig, type GensynDeliverableBundle, type GradientsAdapterConfig, LIUM_ADAPTER_ID, LIUM_CAPABILITIES, LIUM_DEMO_ACCEPT_FLOOR, LIUM_DEMO_MARKER, type ListBotsParams, type ListOptions, type LiumAdapterConfig, type Network, type PaginatedResult, type PayParams, type PaymentResult, type PaymentRouter, type PinContent$3 as PinContent, type PollOptions, type ProtocolStats, RAILS, RAILS_DOCS_URL, REFERENCE_MICRO_USDC_PER_AKT, REFERENCE_MICRO_USDC_PER_RENDER, RENDER_ADAPTER_ID, RENDER_CAPABILITIES, RENDER_DEMO_ACCEPT_FLOOR, RENDER_DEMO_MARKER, RIDGES_ADAPTER_ID, RIDGES_CAPABILITIES, RIDGES_DEMO_COVERAGE_TARGET, RIDGES_DEMO_MARKER, type Rail, type RaiseDisputeParams, type ReeExecution, type ReeProof, type ReeVerification, type ReeVerifyContext, type Render, type RenderAdapterConfig, type ReproduceCompute, ReputationUnavailableError, type RidgesAdapterConfig, type RunAkashDeployment, type RunCodingAgent, type RunGpuJob, type RunRenderJob, type ServedWalletReputation, type ServiceAdapter, type ServiceResult, type SubmitDeliverableParams, type SubnetCall, type Tao, type TaskSpec, type TaskType, type TxShape, UnauthorizedError, type UnsignedBotDescriptor, type UsdcToAktSwap, type UsdcToRenderSwap, type UsdcToTaoSwap, type WorkerCandidate, ZKML_ADAPTER_ID, ZKML_CAPABILITIES, ZKML_DEMO_MARKER, ZKML_PROOF_SCHEME, ZKML_PROOF_URI_PREFIX, type ZkmlAdapterConfig, type ZkmlDeliverable, type ZkmlExpectation, type ZkmlInferenceOutput, type ZkmlProof, type ZkmlProofAutoReleaseOptions, type ZkmlReviewPolicy, type ZkmlReviewResult, type ZkmlVerification, akashDemoJobSpec, akt, assertServiceAdapterContract, buildReeProof, buildZkmlProof, computeAkashDemoArtifact, computeLiumDemoArtifact, computeRenderDemoArtifact, create404genAdapter, createAkashAdapter, createGensynAdapter, createGradientsAdapter, createLiumAdapter, createRenderAdapter, createRidgesAdapter, createZkmlAdapter, decodeZkmlProofUri, encodeZkmlProofUri, gen404DemoJobSpec, gensynAutoRelease, gensynDemoJobSpec, gradientsDemoJobSpec, liumDemoJobSpec, renderAmount, renderDemoJobSpec, reproduceGensynCompute, ridgesDemoJobSpec, score404genDemoDeliverable, scoreAkashDemoDeliverable, scoreGradientsDemoDeliverable, scoreLiumDemoDeliverable, scoreRenderDemoDeliverable, scoreRidgesDemoDeliverable, serviceResultToSubmitParams, solveAkashDemo, solveGen404Demo, solveGradientsDemo, solveLiumDemo, solveRenderDemo, solveRidgesDemo, solveZkmlDemo, tao, verifyReeProof, verifyZkmlProof, verifyZkmlProofUri, zkmlDemoJobSpec, zkmlProofAutoRelease };
|