@roochnetwork/rooch-sdk-kit
Version:
Rooch SDK Kit
45 lines (44 loc) • 1.2 kB
JavaScript
// src/http/httpTransport.ts
import {
RoochHTTPTransport
} from "@roochnetwork/rooch-sdk";
var HTTPTransport = class extends 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;
}
}
};
export {
HTTPTransport
};
//# sourceMappingURL=httpTransport.js.map