@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 CHANGED
@@ -779,7 +779,16 @@ async function signAndSend(base64Tx, wallet, connection, cluster) {
779
779
  const signature = await connection.sendRawTransaction(raw, {
780
780
  skipPreflight: false
781
781
  });
782
- await connection.confirmTransaction({ signature, blockhash, lastValidBlockHeight }, "confirmed");
782
+ const { value } = await connection.confirmTransaction(
783
+ { signature, blockhash, lastValidBlockHeight },
784
+ "confirmed"
785
+ );
786
+ if (value.err !== null) {
787
+ throw new EscroError(
788
+ `Transaction ${signature} failed at execution: ${JSON.stringify(value.err)}`,
789
+ "TX_FAILED"
790
+ );
791
+ }
783
792
  return signature;
784
793
  }
785
794
  async function buildReleasePaymentTx(params) {
@@ -904,9 +913,11 @@ var Escro = class {
904
913
  * {@link Escro.releasePayment}, reporting whether the API recorded the release.
905
914
  * `ESCROW_NOT_SETTLED` (the API's RPC does not yet show the escrow closed), the codes
906
915
  * {@link Escro.confirm} retries and a network failure are retried for about 30 s. A
907
- * failure never throws: the release already landed, so the signature is returned with
908
- * `confirm.landed: false` and an `EscroConfirmError` (the API's code, or
909
- * `NETWORK_ERROR` when the last call never reached it).
916
+ * failed record never throws: the release already landed, so the signature is returned
917
+ * with `confirm.landed: false` and an `EscroConfirmError` (the API's code, or
918
+ * `NETWORK_ERROR` when the last call never reached it). A release that failed at
919
+ * execution on chain throws an {@link EscroError} with code `TX_FAILED`, and the API is
920
+ * never asked to record it.
910
921
  *
911
922
  * @returns `{ signature, confirm }`.
912
923
  */