@escro/sdk 0.4.0 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +15 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +11 -5
- package/dist/index.d.ts +11 -5
- package/dist/index.js +15 -4
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Keypair } from '@solana/web3.js';
|
|
2
2
|
|
|
3
|
+
type SolanaCluster = "devnet" | "mainnet";
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* All possible lifecycle states of an AgentEscrow account on-chain.
|
|
5
7
|
*
|
|
@@ -132,6 +134,10 @@ interface ProtocolStatsFigures {
|
|
|
132
134
|
}
|
|
133
135
|
/** Protocol-wide aggregate statistics: public, unauthenticated. */
|
|
134
136
|
interface ProtocolStats extends ProtocolStatsFigures {
|
|
137
|
+
/** The Solana cluster this API serves (its `CLUSTER`). */
|
|
138
|
+
cluster: SolanaCluster;
|
|
139
|
+
/** That cluster's one USDC mint (`getUsdcMint`): every figure here is in this token. */
|
|
140
|
+
usdcMint: string;
|
|
135
141
|
/**
|
|
136
142
|
* Escro-operated fleet figures (ARCHITECTURE section 9): the same fields over
|
|
137
143
|
* escrows whose buyer and assigned worker are both in the API's operator
|
|
@@ -378,8 +384,6 @@ interface ReviewPolicy {
|
|
|
378
384
|
evaluate(deliverable: ReviewDeliverable): ReviewResult | Promise<ReviewResult>;
|
|
379
385
|
}
|
|
380
386
|
|
|
381
|
-
type SolanaCluster = "devnet" | "mainnet";
|
|
382
|
-
|
|
383
387
|
/** Dispute tally with its outcome split (from the wallet's perspective). */
|
|
384
388
|
interface DisputeRecord {
|
|
385
389
|
/** Total disputes this wallet was party to (raised by either side). */
|
|
@@ -747,9 +751,11 @@ declare class Escro {
|
|
|
747
751
|
* {@link Escro.releasePayment}, reporting whether the API recorded the release.
|
|
748
752
|
* `ESCROW_NOT_SETTLED` (the API's RPC does not yet show the escrow closed), the codes
|
|
749
753
|
* {@link Escro.confirm} retries and a network failure are retried for about 30 s. A
|
|
750
|
-
*
|
|
751
|
-
* `confirm.landed: false` and an `EscroConfirmError` (the API's code, or
|
|
752
|
-
* `NETWORK_ERROR` when the last call never reached it).
|
|
754
|
+
* failed record never throws: the release already landed, so the signature is returned
|
|
755
|
+
* with `confirm.landed: false` and an `EscroConfirmError` (the API's code, or
|
|
756
|
+
* `NETWORK_ERROR` when the last call never reached it). A release that failed at
|
|
757
|
+
* execution on chain throws an {@link EscroError} with code `TX_FAILED`, and the API is
|
|
758
|
+
* never asked to record it.
|
|
753
759
|
*
|
|
754
760
|
* @returns `{ signature, confirm }`.
|
|
755
761
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { Keypair } from '@solana/web3.js';
|
|
2
2
|
|
|
3
|
+
type SolanaCluster = "devnet" | "mainnet";
|
|
4
|
+
|
|
3
5
|
/**
|
|
4
6
|
* All possible lifecycle states of an AgentEscrow account on-chain.
|
|
5
7
|
*
|
|
@@ -132,6 +134,10 @@ interface ProtocolStatsFigures {
|
|
|
132
134
|
}
|
|
133
135
|
/** Protocol-wide aggregate statistics: public, unauthenticated. */
|
|
134
136
|
interface ProtocolStats extends ProtocolStatsFigures {
|
|
137
|
+
/** The Solana cluster this API serves (its `CLUSTER`). */
|
|
138
|
+
cluster: SolanaCluster;
|
|
139
|
+
/** That cluster's one USDC mint (`getUsdcMint`): every figure here is in this token. */
|
|
140
|
+
usdcMint: string;
|
|
135
141
|
/**
|
|
136
142
|
* Escro-operated fleet figures (ARCHITECTURE section 9): the same fields over
|
|
137
143
|
* escrows whose buyer and assigned worker are both in the API's operator
|
|
@@ -378,8 +384,6 @@ interface ReviewPolicy {
|
|
|
378
384
|
evaluate(deliverable: ReviewDeliverable): ReviewResult | Promise<ReviewResult>;
|
|
379
385
|
}
|
|
380
386
|
|
|
381
|
-
type SolanaCluster = "devnet" | "mainnet";
|
|
382
|
-
|
|
383
387
|
/** Dispute tally with its outcome split (from the wallet's perspective). */
|
|
384
388
|
interface DisputeRecord {
|
|
385
389
|
/** Total disputes this wallet was party to (raised by either side). */
|
|
@@ -747,9 +751,11 @@ declare class Escro {
|
|
|
747
751
|
* {@link Escro.releasePayment}, reporting whether the API recorded the release.
|
|
748
752
|
* `ESCROW_NOT_SETTLED` (the API's RPC does not yet show the escrow closed), the codes
|
|
749
753
|
* {@link Escro.confirm} retries and a network failure are retried for about 30 s. A
|
|
750
|
-
*
|
|
751
|
-
* `confirm.landed: false` and an `EscroConfirmError` (the API's code, or
|
|
752
|
-
* `NETWORK_ERROR` when the last call never reached it).
|
|
754
|
+
* failed record never throws: the release already landed, so the signature is returned
|
|
755
|
+
* with `confirm.landed: false` and an `EscroConfirmError` (the API's code, or
|
|
756
|
+
* `NETWORK_ERROR` when the last call never reached it). A release that failed at
|
|
757
|
+
* execution on chain throws an {@link EscroError} with code `TX_FAILED`, and the API is
|
|
758
|
+
* never asked to record it.
|
|
753
759
|
*
|
|
754
760
|
* @returns `{ signature, confirm }`.
|
|
755
761
|
*/
|
package/dist/index.js
CHANGED
|
@@ -658,7 +658,16 @@ async function signAndSend(base64Tx, wallet, connection, cluster) {
|
|
|
658
658
|
const signature = await connection.sendRawTransaction(raw, {
|
|
659
659
|
skipPreflight: false
|
|
660
660
|
});
|
|
661
|
-
|
|
661
|
+
const { value } = await connection.confirmTransaction(
|
|
662
|
+
{ signature, blockhash, lastValidBlockHeight },
|
|
663
|
+
"confirmed"
|
|
664
|
+
);
|
|
665
|
+
if (value.err !== null) {
|
|
666
|
+
throw new EscroError(
|
|
667
|
+
`Transaction ${signature} failed at execution: ${JSON.stringify(value.err)}`,
|
|
668
|
+
"TX_FAILED"
|
|
669
|
+
);
|
|
670
|
+
}
|
|
662
671
|
return signature;
|
|
663
672
|
}
|
|
664
673
|
async function buildReleasePaymentTx(params) {
|
|
@@ -783,9 +792,11 @@ var Escro = class {
|
|
|
783
792
|
* {@link Escro.releasePayment}, reporting whether the API recorded the release.
|
|
784
793
|
* `ESCROW_NOT_SETTLED` (the API's RPC does not yet show the escrow closed), the codes
|
|
785
794
|
* {@link Escro.confirm} retries and a network failure are retried for about 30 s. A
|
|
786
|
-
*
|
|
787
|
-
* `confirm.landed: false` and an `EscroConfirmError` (the API's code, or
|
|
788
|
-
* `NETWORK_ERROR` when the last call never reached it).
|
|
795
|
+
* failed record never throws: the release already landed, so the signature is returned
|
|
796
|
+
* with `confirm.landed: false` and an `EscroConfirmError` (the API's code, or
|
|
797
|
+
* `NETWORK_ERROR` when the last call never reached it). A release that failed at
|
|
798
|
+
* execution on chain throws an {@link EscroError} with code `TX_FAILED`, and the API is
|
|
799
|
+
* never asked to record it.
|
|
789
800
|
*
|
|
790
801
|
* @returns `{ signature, confirm }`.
|
|
791
802
|
*/
|