UNPKG

@lifi/sdk

Version:

LI.FI Any-to-Any Cross-Chain-Swap SDK

23 lines 879 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getActionWithFallback = void 0; const utils_1 = require("viem/utils"); const publicClient_js_1 = require("./publicClient.js"); const getActionWithFallback = async (walletClient, actionFn, name, params) => { try { return await (0, utils_1.getAction)(walletClient, actionFn, name)(params); } catch (error) { if (!walletClient.account?.address) { throw error; } const chainId = walletClient.chain?.id; if (!chainId) { throw error; } const publicClient = await (0, publicClient_js_1.getPublicClient)(chainId); return await (0, utils_1.getAction)(publicClient, actionFn, name)(params); } }; exports.getActionWithFallback = getActionWithFallback; //# sourceMappingURL=getActionWithFallback.js.map