@coral-xyz/anchor
Version:
Anchor client
16 lines • 721 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.splitArgsAndCtx = splitArgsAndCtx;
function splitArgsAndCtx(idlIx, args) {
var _a, _b;
let options = {};
const inputLen = idlIx.args ? idlIx.args.length : 0;
if (args.length > inputLen) {
if (args.length !== inputLen + 1) {
throw new Error(`provided too many arguments ${args} to instruction ${idlIx === null || idlIx === void 0 ? void 0 : idlIx.name} expecting: ${(_b = (_a = idlIx.args) === null || _a === void 0 ? void 0 : _a.map((a) => a.name)) !== null && _b !== void 0 ? _b : []}`);
}
options = args.pop();
}
return [args, options];
}
//# sourceMappingURL=context.js.map