@0xsplits/splits-sdk
Version:
SDK for the 0xSplits protocol
640 lines • 33.1 kB
JavaScript
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (this && this.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
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 __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g = Object.create((typeof Iterator === "function" ? Iterator : Object).prototype);
return g.next = verb(0), g["throw"] = verb(1), g["return"] = verb(2), typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (g && (g = 0, op[0] && (_ = 0)), _) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __read = (this && this.__read) || function (o, n) {
var m = typeof Symbol === "function" && o[Symbol.iterator];
if (!m) return o;
var i = m.call(o), r, ar = [], e;
try {
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
}
catch (error) { e = { error: error }; }
finally {
try {
if (r && !r.done && (m = i["return"])) m.call(i);
}
finally { if (e) throw e.error; }
}
return ar;
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.LiquidSplitClient = void 0;
var base_64_1 = require("base-64");
var viem_1 = require("viem");
var base_1 = require("./base");
var constants_1 = require("../constants");
var liquidSplitFactory_1 = require("../constants/abi/liquidSplitFactory");
var ls1155Clone_1 = require("../constants/abi/ls1155Clone");
var splitMain_1 = require("../constants/abi/splitMain");
var errors_1 = require("../errors");
var mixin_1 = require("./mixin");
var utils_1 = require("../utils");
var validation_1 = require("../utils/validation");
var LiquidSplitTransactions = /** @class */ (function (_super) {
__extends(LiquidSplitTransactions, _super);
function LiquidSplitTransactions(transactionClientArgs) {
return _super.call(this, __assign({ supportedChainIds: constants_1.LIQUID_SPLIT_CHAIN_IDS }, transactionClientArgs)) || this;
}
LiquidSplitTransactions.prototype._createLiquidSplitTransaction = function (_a) {
return __awaiter(this, arguments, void 0, function (_b) {
var ownerAddress, _c, accounts, percentAllocations, nftAmounts, distributorFee, functionChainId, result;
var _d;
var recipients = _b.recipients, distributorFeePercent = _b.distributorFeePercent, _e = _b.owner, owner = _e === void 0 ? undefined : _e, chainId = _b.chainId, _f = _b.transactionOverrides, transactionOverrides = _f === void 0 ? {} : _f;
return __generator(this, function (_g) {
switch (_g.label) {
case 0:
(0, validation_1.validateSplitRecipients)(recipients, constants_1.LIQUID_SPLITS_MAX_PRECISION_DECIMALS);
(0, validation_1.validateDistributorFeePercent)(distributorFeePercent);
if (this._shouldRequireWalletClient)
this._requireWalletClient();
ownerAddress = owner
? owner
: ((_d = this._walletClient) === null || _d === void 0 ? void 0 : _d.account)
? this._walletClient.account.address
: viem_1.zeroAddress;
(0, validation_1.validateAddress)(ownerAddress);
_c = __read((0, utils_1.getRecipientSortedAddressesAndAllocations)(recipients), 2), accounts = _c[0], percentAllocations = _c[1];
nftAmounts = (0, utils_1.getNftCountsFromPercents)(percentAllocations);
distributorFee = (0, utils_1.getBigIntFromPercent)(distributorFeePercent);
functionChainId = this._getFunctionChainId(chainId);
return [4 /*yield*/, this._executeContractFunction({
contractAddress: (0, constants_1.getLiquidSplitFactoryAddress)(functionChainId),
contractAbi: liquidSplitFactory_1.liquidSplitFactoryAbi,
functionName: 'createLiquidSplitClone',
functionArgs: [accounts, nftAmounts, distributorFee, ownerAddress],
transactionOverrides: transactionOverrides,
})];
case 1:
result = _g.sent();
return [2 /*return*/, result];
}
});
});
};
LiquidSplitTransactions.prototype._distributeTokenTransaction = function (_a) {
return __awaiter(this, arguments, void 0, function (_b) {
var distributorPayoutAddress, functionChainId, holders, accounts, result;
var _c;
var liquidSplitAddress = _b.liquidSplitAddress, token = _b.token, distributorAddress = _b.distributorAddress, chainId = _b.chainId, _d = _b.transactionOverrides, transactionOverrides = _d === void 0 ? {} : _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0:
(0, validation_1.validateAddress)(liquidSplitAddress);
(0, validation_1.validateAddress)(token);
if (this._shouldRequireWalletClient)
this._requireWalletClient();
distributorPayoutAddress = distributorAddress
? distributorAddress
: ((_c = this._walletClient) === null || _c === void 0 ? void 0 : _c.account)
? this._walletClient.account.address
: viem_1.zeroAddress;
(0, validation_1.validateAddress)(distributorPayoutAddress);
this._requireDataClient();
functionChainId = this._getFunctionChainId(chainId);
return [4 /*yield*/, this._dataClient.getLiquidSplitMetadata({
chainId: functionChainId,
liquidSplitAddress: liquidSplitAddress,
})];
case 1:
holders = (_e.sent()).holders;
accounts = holders
.map(function (h) { return h.recipient.address; })
.sort(function (a, b) {
if (a.toLowerCase() > b.toLowerCase())
return 1;
return -1;
});
return [4 /*yield*/, this._executeContractFunction({
contractAddress: (0, viem_1.getAddress)(liquidSplitAddress),
contractAbi: ls1155Clone_1.ls1155CloneAbi,
functionName: 'distributeFunds',
functionArgs: [token, accounts, distributorPayoutAddress],
transactionOverrides: transactionOverrides,
})];
case 2:
result = _e.sent();
return [2 /*return*/, result];
}
});
});
};
LiquidSplitTransactions.prototype._transferOwnershipTransaction = function (_a) {
return __awaiter(this, arguments, void 0, function (_b) {
var result;
var liquidSplitAddress = _b.liquidSplitAddress, newOwner = _b.newOwner, _c = _b.transactionOverrides, transactionOverrides = _c === void 0 ? {} : _c;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
(0, validation_1.validateAddress)(liquidSplitAddress);
(0, validation_1.validateAddress)(newOwner);
if (!this._shouldRequireWalletClient) return [3 /*break*/, 2];
this._requireWalletClient();
return [4 /*yield*/, this._requireOwner(liquidSplitAddress)];
case 1:
_d.sent();
_d.label = 2;
case 2: return [4 /*yield*/, this._executeContractFunction({
contractAddress: (0, viem_1.getAddress)(liquidSplitAddress),
contractAbi: ls1155Clone_1.ls1155CloneAbi,
functionName: 'transferOwnership',
functionArgs: [newOwner],
transactionOverrides: transactionOverrides,
})];
case 3:
result = _d.sent();
return [2 /*return*/, result];
}
});
});
};
LiquidSplitTransactions.prototype._requireOwner = function (liquidSplitAddress) {
return __awaiter(this, void 0, void 0, function () {
var liquidSplitContract, owner, walletAddress;
var _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0:
this._requireWalletClient();
liquidSplitContract = this._getLiquidSplitContract(liquidSplitAddress, this._walletClient.chain.id);
return [4 /*yield*/, liquidSplitContract.read.owner()];
case 1:
owner = _b.sent();
walletAddress = (_a = this._walletClient.account) === null || _a === void 0 ? void 0 : _a.address;
if (owner !== walletAddress)
throw new errors_1.InvalidAuthError("Action only available to the liquid split owner. Liquid split address: ".concat(liquidSplitAddress, ", owner: ").concat(owner, ", wallet address: ").concat(walletAddress));
return [2 /*return*/];
}
});
});
};
LiquidSplitTransactions.prototype._getLiquidSplitContract = function (liquidSplit, chainId) {
var publicClient = this._getPublicClient(chainId);
return (0, viem_1.getContract)({
address: (0, viem_1.getAddress)(liquidSplit),
abi: ls1155Clone_1.ls1155CloneAbi,
client: publicClient,
});
};
return LiquidSplitTransactions;
}(base_1.BaseTransactions));
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
var LiquidSplitClient = /** @class */ (function (_super) {
__extends(LiquidSplitClient, _super);
function LiquidSplitClient(clientArgs) {
var _this = _super.call(this, __assign({ transactionType: constants_1.TransactionType.Transaction }, clientArgs)) || this;
_this.eventTopics = {
createLiquidSplit: [
(0, viem_1.encodeEventTopics)({
abi: liquidSplitFactory_1.liquidSplitFactoryAbi,
eventName: 'CreateLS1155Clone',
})[0],
],
distributeToken: [
(0, viem_1.encodeEventTopics)({
abi: splitMain_1.splitMainPolygonAbi,
eventName: 'UpdateSplit',
})[0],
(0, viem_1.encodeEventTopics)({
abi: splitMain_1.splitMainPolygonAbi,
eventName: 'DistributeETH',
})[0],
(0, viem_1.encodeEventTopics)({
abi: splitMain_1.splitMainPolygonAbi,
eventName: 'DistributeERC20',
})[0],
],
transferOwnership: [
(0, viem_1.encodeEventTopics)({
abi: ls1155Clone_1.ls1155CloneAbi,
eventName: 'OwnershipTransferred',
})[0],
],
};
_this.callData = new LiquidSplitCallData(clientArgs);
_this.estimateGas = new LiquidSplitGasEstimates(clientArgs);
return _this;
}
// Write actions
LiquidSplitClient.prototype._submitCreateLiquidSplitTransaction = function (createLiquidSplitArgs) {
return __awaiter(this, void 0, void 0, function () {
var txHash;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._createLiquidSplitTransaction(createLiquidSplitArgs)];
case 1:
txHash = _a.sent();
if (!this._isContractTransaction(txHash))
throw new Error('Invalid response');
return [2 /*return*/, { txHash: txHash }];
}
});
});
};
LiquidSplitClient.prototype.createLiquidSplit = function (createLiquidSplitArgs) {
return __awaiter(this, void 0, void 0, function () {
var txHash, events, event, log;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._submitCreateLiquidSplitTransaction(createLiquidSplitArgs)];
case 1:
txHash = (_a.sent()).txHash;
return [4 /*yield*/, this.getTransactionEvents({
txHash: txHash,
eventTopics: this.eventTopics.createLiquidSplit,
})];
case 2:
events = _a.sent();
event = events.length > 0 ? events[0] : undefined;
if (event) {
log = (0, viem_1.decodeEventLog)({
abi: liquidSplitFactory_1.liquidSplitFactoryAbi,
data: event.data,
topics: event.topics,
});
return [2 /*return*/, {
liquidSplitAddress: log.args.ls,
event: event,
}];
}
throw new errors_1.TransactionFailedError();
}
});
});
};
LiquidSplitClient.prototype._submitDistributeTokenTransaction = function (distributeTokenArgs) {
return __awaiter(this, void 0, void 0, function () {
var txHash;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._distributeTokenTransaction(distributeTokenArgs)];
case 1:
txHash = _a.sent();
if (!this._isContractTransaction(txHash))
throw new Error('Invalid response');
return [2 /*return*/, { txHash: txHash }];
}
});
});
};
LiquidSplitClient.prototype.distributeToken = function (distributeTokenArgs) {
return __awaiter(this, void 0, void 0, function () {
var txHash, token, eventTopic, events, event;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._submitDistributeTokenTransaction(distributeTokenArgs)];
case 1:
txHash = (_a.sent()).txHash;
token = distributeTokenArgs.token;
eventTopic = token === viem_1.zeroAddress
? this.eventTopics.distributeToken[1]
: this.eventTopics.distributeToken[2];
return [4 /*yield*/, this.getTransactionEvents({
txHash: txHash,
eventTopics: [eventTopic],
})];
case 2:
events = _a.sent();
event = events.length > 0 ? events[0] : undefined;
if (event)
return [2 /*return*/, { event: event }];
throw new errors_1.TransactionFailedError();
}
});
});
};
LiquidSplitClient.prototype._submitTransferOwnershipTransaction = function (transferOwnershipArgs) {
return __awaiter(this, void 0, void 0, function () {
var txHash;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._transferOwnershipTransaction(transferOwnershipArgs)];
case 1:
txHash = _a.sent();
if (!this._isContractTransaction(txHash))
throw new Error('Invalid response');
return [2 /*return*/, { txHash: txHash }];
}
});
});
};
LiquidSplitClient.prototype.transferOwnership = function (transferOwnershipArgs) {
return __awaiter(this, void 0, void 0, function () {
var txHash, events, event;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._submitTransferOwnershipTransaction(transferOwnershipArgs)];
case 1:
txHash = (_a.sent()).txHash;
return [4 /*yield*/, this.getTransactionEvents({
txHash: txHash,
eventTopics: this.eventTopics.transferOwnership,
})];
case 2:
events = _a.sent();
event = events.length > 0 ? events[0] : undefined;
if (event)
return [2 /*return*/, { event: event }];
throw new errors_1.TransactionFailedError();
}
});
});
};
// Read actions
LiquidSplitClient.prototype.getDistributorFee = function (_a) {
return __awaiter(this, arguments, void 0, function (_b) {
var functionChainId, liquidSplitContract, distributorFee;
var liquidSplitAddress = _b.liquidSplitAddress, chainId = _b.chainId;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
(0, validation_1.validateAddress)(liquidSplitAddress);
functionChainId = this._getReadOnlyFunctionChainId(chainId);
liquidSplitContract = this._getLiquidSplitContract(liquidSplitAddress, functionChainId);
return [4 /*yield*/, liquidSplitContract.read.distributorFee()];
case 1:
distributorFee = _c.sent();
return [2 /*return*/, {
distributorFee: distributorFee,
}];
}
});
});
};
LiquidSplitClient.prototype.getPayoutSplit = function (_a) {
return __awaiter(this, arguments, void 0, function (_b) {
var functionChainId, liquidSplitContract, payoutSplitAddress;
var liquidSplitAddress = _b.liquidSplitAddress, chainId = _b.chainId;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
(0, validation_1.validateAddress)(liquidSplitAddress);
functionChainId = this._getReadOnlyFunctionChainId(chainId);
liquidSplitContract = this._getLiquidSplitContract(liquidSplitAddress, functionChainId);
return [4 /*yield*/, liquidSplitContract.read.payoutSplit()];
case 1:
payoutSplitAddress = _c.sent();
return [2 /*return*/, {
payoutSplitAddress: payoutSplitAddress,
}];
}
});
});
};
LiquidSplitClient.prototype.getOwner = function (_a) {
return __awaiter(this, arguments, void 0, function (_b) {
var functionChainId, liquidSplitContract, owner;
var liquidSplitAddress = _b.liquidSplitAddress, chainId = _b.chainId;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
(0, validation_1.validateAddress)(liquidSplitAddress);
functionChainId = this._getReadOnlyFunctionChainId(chainId);
liquidSplitContract = this._getLiquidSplitContract(liquidSplitAddress, functionChainId);
return [4 /*yield*/, liquidSplitContract.read.owner()];
case 1:
owner = _c.sent();
return [2 /*return*/, {
owner: owner,
}];
}
});
});
};
LiquidSplitClient.prototype.getUri = function (_a) {
return __awaiter(this, arguments, void 0, function (_b) {
var functionChainId, liquidSplitContract, uri;
var liquidSplitAddress = _b.liquidSplitAddress, chainId = _b.chainId;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
(0, validation_1.validateAddress)(liquidSplitAddress);
functionChainId = this._getReadOnlyFunctionChainId(chainId);
liquidSplitContract = this._getLiquidSplitContract(liquidSplitAddress, functionChainId);
return [4 /*yield*/, liquidSplitContract.read.uri([BigInt(0)])]; // Expects an argument, but it's not actually used
case 1:
uri = _c.sent() // Expects an argument, but it's not actually used
;
return [2 /*return*/, {
uri: uri,
}];
}
});
});
};
LiquidSplitClient.prototype.getScaledPercentBalanceOf = function (_a) {
return __awaiter(this, arguments, void 0, function (_b) {
var functionChainId, liquidSplitContract, scaledPercentBalance;
var liquidSplitAddress = _b.liquidSplitAddress, address = _b.address, chainId = _b.chainId;
return __generator(this, function (_c) {
switch (_c.label) {
case 0:
(0, validation_1.validateAddress)(liquidSplitAddress);
(0, validation_1.validateAddress)(address);
functionChainId = this._getReadOnlyFunctionChainId(chainId);
liquidSplitContract = this._getLiquidSplitContract(liquidSplitAddress, functionChainId);
return [4 /*yield*/, liquidSplitContract.read.scaledPercentBalanceOf([
(0, viem_1.getAddress)(address),
])];
case 1:
scaledPercentBalance = _c.sent();
return [2 /*return*/, {
scaledPercentBalance: scaledPercentBalance,
}];
}
});
});
};
LiquidSplitClient.prototype.getNftImage = function (_a) {
return __awaiter(this, arguments, void 0, function (_b) {
var uri, decodedUri, uriJson;
var _c;
var liquidSplitAddress = _b.liquidSplitAddress;
return __generator(this, function (_d) {
switch (_d.label) {
case 0:
(0, validation_1.validateAddress)(liquidSplitAddress);
return [4 /*yield*/, this.getUri({
liquidSplitAddress: liquidSplitAddress,
})];
case 1:
uri = (_d.sent()).uri;
decodedUri = (0, base_64_1.decode)(uri.slice(constants_1.LIQUID_SPLIT_URI_BASE_64_HEADER.length));
uriJson = JSON.parse(decodedUri);
return [2 /*return*/, {
image: (_c = uriJson.image) !== null && _c !== void 0 ? _c : '',
}];
}
});
});
};
return LiquidSplitClient;
}(LiquidSplitTransactions));
exports.LiquidSplitClient = LiquidSplitClient;
(0, mixin_1.applyMixins)(LiquidSplitClient, [base_1.BaseClientMixin]);
// eslint-disable-next-line @typescript-eslint/no-unsafe-declaration-merging
var LiquidSplitGasEstimates = /** @class */ (function (_super) {
__extends(LiquidSplitGasEstimates, _super);
function LiquidSplitGasEstimates(clientArgs) {
return _super.call(this, __assign({ transactionType: constants_1.TransactionType.GasEstimate }, clientArgs)) || this;
}
LiquidSplitGasEstimates.prototype.createLiquidSplit = function (createLiquidSplitArgs) {
return __awaiter(this, void 0, void 0, function () {
var gasEstimate;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._createLiquidSplitTransaction(createLiquidSplitArgs)];
case 1:
gasEstimate = _a.sent();
if (!this._isBigInt(gasEstimate))
throw new Error('Invalid response');
return [2 /*return*/, gasEstimate];
}
});
});
};
LiquidSplitGasEstimates.prototype.distributeToken = function (distributeTokenArgs) {
return __awaiter(this, void 0, void 0, function () {
var gasEstimate;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._distributeTokenTransaction(distributeTokenArgs)];
case 1:
gasEstimate = _a.sent();
if (!this._isBigInt(gasEstimate))
throw new Error('Invalid response');
return [2 /*return*/, gasEstimate];
}
});
});
};
LiquidSplitGasEstimates.prototype.transferOwnership = function (transferOwnershipArgs) {
return __awaiter(this, void 0, void 0, function () {
var gasEstimate;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._transferOwnershipTransaction(transferOwnershipArgs)];
case 1:
gasEstimate = _a.sent();
if (!this._isBigInt(gasEstimate))
throw new Error('Invalid response');
return [2 /*return*/, gasEstimate];
}
});
});
};
return LiquidSplitGasEstimates;
}(LiquidSplitTransactions));
(0, mixin_1.applyMixins)(LiquidSplitGasEstimates, [base_1.BaseGasEstimatesMixin]);
var LiquidSplitCallData = /** @class */ (function (_super) {
__extends(LiquidSplitCallData, _super);
function LiquidSplitCallData(clientArgs) {
return _super.call(this, __assign({ transactionType: constants_1.TransactionType.CallData }, clientArgs)) || this;
}
LiquidSplitCallData.prototype.createLiquidSplit = function (createLiquidSplitArgs) {
return __awaiter(this, void 0, void 0, function () {
var callData;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._createLiquidSplitTransaction(createLiquidSplitArgs)];
case 1:
callData = _a.sent();
if (!this._isCallData(callData))
throw new Error('Invalid response');
return [2 /*return*/, callData];
}
});
});
};
LiquidSplitCallData.prototype.distributeToken = function (distributeTokenArgs) {
return __awaiter(this, void 0, void 0, function () {
var callData;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._distributeTokenTransaction(distributeTokenArgs)];
case 1:
callData = _a.sent();
if (!this._isCallData(callData))
throw new Error('Invalid response');
return [2 /*return*/, callData];
}
});
});
};
LiquidSplitCallData.prototype.transferOwnership = function (transferOwnershipArgs) {
return __awaiter(this, void 0, void 0, function () {
var callData;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this._transferOwnershipTransaction(transferOwnershipArgs)];
case 1:
callData = _a.sent();
if (!this._isCallData(callData))
throw new Error('Invalid response');
return [2 /*return*/, callData];
}
});
});
};
return LiquidSplitCallData;
}(LiquidSplitTransactions));
//# sourceMappingURL=liquidSplit.js.map