UNPKG

@roochnetwork/rooch-sdk-kit

Version:
64 lines (62 loc) 2.14 kB
"use strict"; var __defProp = Object.defineProperty; var __getOwnPropDesc = Object.getOwnPropertyDescriptor; var __getOwnPropNames = Object.getOwnPropertyNames; var __hasOwnProp = Object.prototype.hasOwnProperty; var __export = (target, all) => { for (var name in all) __defProp(target, name, { get: all[name], enumerable: true }); }; var __copyProps = (to, from, except, desc) => { if (from && typeof from === "object" || typeof from === "function") { for (let key of __getOwnPropNames(from)) if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); } return to; }; var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); // src/http/httpTransport.ts var httpTransport_exports = {}; __export(httpTransport_exports, { HTTPTransport: () => HTTPTransport }); module.exports = __toCommonJS(httpTransport_exports); var import_rooch_sdk = require("@roochnetwork/rooch-sdk"); var HTTPTransport = class extends import_rooch_sdk.RoochHTTPTransport { constructor(options, requestErrorCallback) { super(options); this.requestCallback = requestErrorCallback; } async request(input) { let result; try { if (input.method === "rooch_executeRawTransaction") { this.requestCallback("requesting"); } result = await super.request(input); if (input.method === "rooch_executeRawTransaction") { const tmp = result; if (tmp.execution_info.status.type !== "executed") { this.requestCallback("error", { code: tmp.execution_info.status.abort_code, message: tmp.execution_info.status.type, location: tmp.execution_info.status.location }); } else { this.requestCallback("success"); } } return result; } catch (e) { if ("code" in e) { this.requestCallback("error", { code: e.code, message: e.message }); } throw e; } } }; //# sourceMappingURL=httpTransport.js.map