@tiplink/api
Version:
Api for creating and sending TipLinks
21 lines (20 loc) • 711 B
JavaScript
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.attachTheme = void 0;
const bs58_1 = __importDefault(require("bs58"));
const createObscureThemeId = (themeId) => {
return bs58_1.default.encode(Buffer.from(`theme|${themeId}`));
};
const attachTheme = (tiplink, themeId) => {
if (!themeId) {
return tiplink;
}
const obscureThemeId = createObscureThemeId(themeId);
tiplink.url.searchParams.append("t", obscureThemeId);
tiplink.url.pathname = "/ti";
return tiplink;
};
exports.attachTheme = attachTheme;
;