@biconomy/abstractjs
Version:
SDK for Biconomy integration with support for account abstraction, smart accounts, ERC-4337.
52 lines • 1.83 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.createOneClickDepositTemplate = void 0;
const createOneClickDepositTemplate = (params) => {
return async (depositParams) => {
const { sourceChain, destChain, ...restParams } = depositParams;
const typedRestParams = restParams;
const sourceInstructions = await params.sourceChainInstructions?.({
sourceChain,
destChain,
...typedRestParams
});
const bridgeInstructions = await params.bridgeInstructions?.({
sourceChain,
destChain,
...typedRestParams
});
const destInstructions = await params.destChainInstructions?.({
sourceChain,
destChain,
...typedRestParams
});
const allInstructions = [];
if (sourceInstructions) {
if (Array.isArray(sourceInstructions)) {
allInstructions.push(...sourceInstructions.flat());
}
else {
allInstructions.push(sourceInstructions);
}
}
if (bridgeInstructions) {
if (Array.isArray(bridgeInstructions)) {
allInstructions.push(...bridgeInstructions.flat());
}
else {
allInstructions.push(bridgeInstructions);
}
}
if (destInstructions) {
if (Array.isArray(destInstructions)) {
allInstructions.push(...destInstructions.flat());
}
else {
allInstructions.push(destInstructions);
}
}
return allInstructions;
};
};
exports.createOneClickDepositTemplate = createOneClickDepositTemplate;
//# sourceMappingURL=createOneClickDepositTemplate.js.map