UNPKG

@mak201010/bluefin-v2-client

Version:

The Bluefin client Library allows traders to sign, create, retrieve and listen to orders on Bluefin Exchange.

79 lines 4.66 kB
"use strict"; var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); }; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.InteractorCalls = void 0; const interpolate_1 = __importDefault(require("interpolate")); const interactor_1 = require("@mak201010/library-sui/dist/src/blv/interactor"); const contractErrorHandling_service_1 = require("./contractErrorHandling.service"); class InteractorCalls { constructor(signer, deployment, provider) { // /** // * @param amount the amount to withdraw // * @param vaultName name of the vault to claim funds from // * @returns ResponseSchema // * @description // * Withdraws funds from the vault // * */ this.withdrawFromVaultContractCall = (amount, vaultName) => __awaiter(this, void 0, void 0, function* () { return (0, contractErrorHandling_service_1.TransformToResponseSchema)(() => __awaiter(this, void 0, void 0, function* () { const tx = yield this.InteractorCalls.requestWithdrawFromVault(vaultName, amount); return tx; }), (0, interpolate_1.default)(contractErrorHandling_service_1.SuccessMessages.withdrawMargin, { amount })); }); // /** // * @param amount the amount to deposit // * @param vaultName name of the vault to claim funds from // * @returns ResponseSchema // * @description // * Deposit funds to vault // * */ this.depositToVaultContractCall = (amount, vaultName) => __awaiter(this, void 0, void 0, function* () { return (0, contractErrorHandling_service_1.TransformToResponseSchema)(() => __awaiter(this, void 0, void 0, function* () { const tx = yield this.InteractorCalls.depositToVault(vaultName, amount); return tx; }), (0, interpolate_1.default)(contractErrorHandling_service_1.SuccessMessages.withdrawMargin, { amount })); }); // /** // * @param vaultName name of the vault to claim funds from // * @param signaturePayload payload with claim data // * @param signature signature for claim data // * @returns ResponseSchema // * @description // * Withdraws funds from the margin bank contract // * */ this.claimFundsFromVaultContractCall = (vaultName, signaturePayload, signature) => __awaiter(this, void 0, void 0, function* () { return (0, contractErrorHandling_service_1.TransformToResponseSchema)(() => __awaiter(this, void 0, void 0, function* () { const tx = yield this.InteractorCalls.claimFunds(vaultName, signaturePayload, signature); return tx; }), (0, interpolate_1.default)(contractErrorHandling_service_1.SuccessMessages.withdrawMargin, {})); }); // /** // * @param amount the amount to withdraw // * @param vaultName name of the vault to claim funds from // * @returns ResponseSchema // * @description // * Withdraws funds from the margin bank contract // * */ this.withdrawProfitFromVaultContractCall = (vaultName, amount) => __awaiter(this, void 0, void 0, function* () { return (0, contractErrorHandling_service_1.TransformToResponseSchema)(() => __awaiter(this, void 0, void 0, function* () { const tx = yield this.InteractorCalls.moveProfitWithdrawalFundsToHoldingAccount(vaultName, amount); return tx; }), (0, interpolate_1.default)(contractErrorHandling_service_1.SuccessMessages.withdrawMargin, { amount })); }); this.signer = signer; this.InteractorCalls = new interactor_1.Interactor(provider, deployment, this.signer); } } exports.InteractorCalls = InteractorCalls; //# sourceMappingURL=interactorService.js.map