@signals-protocol/v1-sdk 1.5.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/share/assets.d.ts +3 -1
- package/dist/share/assets.js +21 -1
- package/dist/share/profile-image.js +6 -53
- package/dist/share/types.d.ts +5 -7
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,4 +10,4 @@ export * as MathUtils from "./utils/math";
|
|
|
10
10
|
export { toWAD, toMicroUSDC } from "./clmsr-sdk";
|
|
11
11
|
export { createCLMSRSDK, createSignalsSDK } from "./clmsr-sdk";
|
|
12
12
|
export * from "./share";
|
|
13
|
-
export declare const VERSION = "1.5.
|
|
13
|
+
export declare const VERSION = "1.5.1";
|
package/dist/index.js
CHANGED
package/dist/share/assets.d.ts
CHANGED
|
@@ -1,3 +1,5 @@
|
|
|
1
1
|
import type { SatoriNode } from "./types";
|
|
2
|
-
export declare
|
|
2
|
+
export declare function buildLogoSquaresSVG(theme: "light" | "dark"): string;
|
|
3
|
+
/** @deprecated Use buildLogoSquaresSVG("light") for theme-aware rendering. */
|
|
4
|
+
export declare const SIGNALS_LOGO_URI: string;
|
|
3
5
|
export declare function buildLogoStrokeSVG(size: number, theme: "light" | "dark"): SatoriNode;
|
package/dist/share/assets.js
CHANGED
|
@@ -1,10 +1,30 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.SIGNALS_LOGO_URI = void 0;
|
|
4
|
+
exports.buildLogoSquaresSVG = buildLogoSquaresSVG;
|
|
4
5
|
exports.buildLogoStrokeSVG = buildLogoStrokeSVG;
|
|
5
6
|
const h_1 = require("./h");
|
|
7
|
+
const LOGO_SQUARES = [
|
|
8
|
+
{ x: "8.50024", y: "0" },
|
|
9
|
+
{ x: "8.50024", y: "4.00006" },
|
|
10
|
+
{ x: "0.5", y: "12" },
|
|
11
|
+
{ x: "12.5", y: "8.00006" },
|
|
12
|
+
{ x: "12.5", y: "0" },
|
|
13
|
+
{ x: "4.50024", y: "0" },
|
|
14
|
+
{ x: "12.5", y: "4.00006" },
|
|
15
|
+
{ x: "4.50024", y: "8.00006" },
|
|
16
|
+
];
|
|
17
|
+
function buildLogoSquaresSVG(theme) {
|
|
18
|
+
const fill = theme === "dark" ? "#FFFFFF" : "#1444c2";
|
|
19
|
+
const rects = LOGO_SQUARES.map(({ x, y }) => `<rect x="${x}" y="${y}" width="4" height="4" fill="${fill}"/>`).join("");
|
|
20
|
+
const svg = `<svg width="17" height="16" viewBox="0 0 17 16" fill="none" xmlns="http://www.w3.org/2000/svg">${rects}</svg>`;
|
|
21
|
+
// Use btoa for cross-platform compatibility (browser + Node 16+).
|
|
22
|
+
// SVG is ASCII only so direct btoa is safe (no UTF-8 escape needed).
|
|
23
|
+
return `data:image/svg+xml;base64,${btoa(svg)}`;
|
|
24
|
+
}
|
|
6
25
|
// Signals logo SVG (pixel block pattern) as base64 data URI
|
|
7
|
-
|
|
26
|
+
/** @deprecated Use buildLogoSquaresSVG("light") for theme-aware rendering. */
|
|
27
|
+
exports.SIGNALS_LOGO_URI = buildLogoSquaresSVG("light");
|
|
8
28
|
function buildLogoStrokeSVG(size, theme) {
|
|
9
29
|
const stroke = theme === "dark" ? "white" : "#1444c2";
|
|
10
30
|
return (0, h_1.h)("svg", {
|
|
@@ -10,7 +10,7 @@ const OUTER_PADDING = 24;
|
|
|
10
10
|
const CARD_PADDING_X = 32;
|
|
11
11
|
const CARD_PADDING_Y = 28;
|
|
12
12
|
const CHART_WIDTH = CARD_WIDTH - OUTER_PADDING * 2 - CARD_PADDING_X * 2;
|
|
13
|
-
const CHART_HEIGHT =
|
|
13
|
+
const CHART_HEIGHT = 308;
|
|
14
14
|
const PLOT_LEFT = 56;
|
|
15
15
|
const PLOT_RIGHT = 18;
|
|
16
16
|
const PLOT_TOP = 14;
|
|
@@ -188,8 +188,6 @@ function buildMainText(input) {
|
|
|
188
188
|
const handle = resolveDisplayName(input.realHandle ?? null);
|
|
189
189
|
if (handle)
|
|
190
190
|
return handle;
|
|
191
|
-
if (input.hideWallet)
|
|
192
|
-
return "A Signals trader";
|
|
193
191
|
return resolveDisplayName(input.displayName) ?? shortenAddress(input.address);
|
|
194
192
|
}
|
|
195
193
|
function formatCallCopy(totalCalls) {
|
|
@@ -197,8 +195,6 @@ function formatCallCopy(totalCalls) {
|
|
|
197
195
|
}
|
|
198
196
|
function buildSubline(input) {
|
|
199
197
|
const callCopy = formatCallCopy(input.totalCalls);
|
|
200
|
-
if (input.hideWallet)
|
|
201
|
-
return `${callCopy} on Signals`;
|
|
202
198
|
if (resolveDisplayName(input.realHandle ?? null) !== null) {
|
|
203
199
|
return `${shortenAddress(input.address)} with ${callCopy}`;
|
|
204
200
|
}
|
|
@@ -433,44 +429,10 @@ function buildAddressAvatar(address, themeName, theme) {
|
|
|
433
429
|
},
|
|
434
430
|
})))));
|
|
435
431
|
}
|
|
436
|
-
function buildGenericAvatar(theme) {
|
|
437
|
-
return (0, h_1.h)("div", {
|
|
438
|
-
style: {
|
|
439
|
-
width: AVATAR_SIZE,
|
|
440
|
-
height: AVATAR_SIZE,
|
|
441
|
-
display: "flex",
|
|
442
|
-
alignItems: "center",
|
|
443
|
-
justifyContent: "center",
|
|
444
|
-
overflow: "hidden",
|
|
445
|
-
borderRadius: 22,
|
|
446
|
-
border: `1px solid ${theme.border}`,
|
|
447
|
-
background: theme.primary,
|
|
448
|
-
flexShrink: 0,
|
|
449
|
-
},
|
|
450
|
-
}, (0, h_1.h)("div", {
|
|
451
|
-
style: {
|
|
452
|
-
width: 58,
|
|
453
|
-
height: 58,
|
|
454
|
-
display: "flex",
|
|
455
|
-
alignItems: "center",
|
|
456
|
-
justifyContent: "center",
|
|
457
|
-
borderRadius: 999,
|
|
458
|
-
background: theme.card,
|
|
459
|
-
},
|
|
460
|
-
}, (0, h_1.h)("img", {
|
|
461
|
-
src: assets_1.SIGNALS_LOGO_URI,
|
|
462
|
-
width: 34,
|
|
463
|
-
height: 32,
|
|
464
|
-
style: { display: "flex" },
|
|
465
|
-
})));
|
|
466
|
-
}
|
|
467
432
|
function buildAvatar(input, theme) {
|
|
468
|
-
if (input.hideWallet) {
|
|
469
|
-
return buildGenericAvatar(theme);
|
|
470
|
-
}
|
|
471
433
|
return buildAddressAvatar(input.address, input.theme, theme);
|
|
472
434
|
}
|
|
473
|
-
function buildBrandWordmark(theme) {
|
|
435
|
+
function buildBrandWordmark(themeName, theme) {
|
|
474
436
|
return (0, h_1.h)("div", {
|
|
475
437
|
style: {
|
|
476
438
|
display: "flex",
|
|
@@ -479,7 +441,7 @@ function buildBrandWordmark(theme) {
|
|
|
479
441
|
flexShrink: 0,
|
|
480
442
|
},
|
|
481
443
|
}, (0, h_1.h)("img", {
|
|
482
|
-
src: assets_1.
|
|
444
|
+
src: (0, assets_1.buildLogoSquaresSVG)(themeName),
|
|
483
445
|
width: 34,
|
|
484
446
|
height: 32,
|
|
485
447
|
style: { display: "flex" },
|
|
@@ -496,7 +458,7 @@ function buildHeader(input, theme, mainText, subline) {
|
|
|
496
458
|
return (0, h_1.h)("div", {
|
|
497
459
|
style: {
|
|
498
460
|
display: "flex",
|
|
499
|
-
alignItems: "
|
|
461
|
+
alignItems: "flex-start",
|
|
500
462
|
justifyContent: "space-between",
|
|
501
463
|
gap: 24,
|
|
502
464
|
minHeight: AVATAR_SIZE,
|
|
@@ -546,7 +508,7 @@ function buildHeader(input, theme, mainText, subline) {
|
|
|
546
508
|
textOverflow: "ellipsis",
|
|
547
509
|
whiteSpace: "nowrap",
|
|
548
510
|
},
|
|
549
|
-
}, subline))), buildBrandWordmark(theme));
|
|
511
|
+
}, subline))), buildBrandWordmark(input.theme, theme));
|
|
550
512
|
}
|
|
551
513
|
function buildStatItem(label, value, valueColor, theme) {
|
|
552
514
|
return (0, h_1.h)("div", {
|
|
@@ -885,14 +847,5 @@ function buildProfileVNode(input) {
|
|
|
885
847
|
style: {
|
|
886
848
|
display: "flex",
|
|
887
849
|
},
|
|
888
|
-
}, buildChartArea(theme, input.btcHistory, input.positions)), buildStatRow(input, theme, pnlValue, roiValue, bestMultValue)
|
|
889
|
-
style: {
|
|
890
|
-
display: "flex",
|
|
891
|
-
justifyContent: "flex-end",
|
|
892
|
-
marginTop: 16,
|
|
893
|
-
fontSize: 13,
|
|
894
|
-
fontWeight: 500,
|
|
895
|
-
color: theme.inkMuted,
|
|
896
|
-
},
|
|
897
|
-
}, "signals.wtf · Pick your range"))));
|
|
850
|
+
}, buildChartArea(theme, input.btcHistory, input.positions)), buildStatRow(input, theme, pnlValue, roiValue, bestMultValue))));
|
|
898
851
|
}
|
package/dist/share/types.d.ts
CHANGED
|
@@ -31,19 +31,16 @@ export interface ProfileChartPosition {
|
|
|
31
31
|
}
|
|
32
32
|
export interface ProfileImageInput {
|
|
33
33
|
/**
|
|
34
|
-
* User-facing display fallback used when `realHandle` is empty
|
|
35
|
-
*
|
|
36
|
-
* legacy callers; it is never shown while `hideWallet` is true.
|
|
34
|
+
* User-facing display fallback used when `realHandle` is empty. This may
|
|
35
|
+
* include an address fallback supplied by legacy callers.
|
|
37
36
|
*/
|
|
38
37
|
displayName: string | null;
|
|
39
38
|
/**
|
|
40
|
-
* Real, human-friendly handle (e.g. Namoshi name)
|
|
41
|
-
* even when `hideWallet` is true.
|
|
39
|
+
* Real, human-friendly handle (e.g. Namoshi name).
|
|
42
40
|
*
|
|
43
41
|
* Pass null when no real handle exists. Do not pass a truncated address
|
|
44
42
|
* fallback here; that belongs in `displayName`. Optional for backward
|
|
45
|
-
* compatibility
|
|
46
|
-
* fallback semantics.
|
|
43
|
+
* compatibility.
|
|
47
44
|
*/
|
|
48
45
|
realHandle?: string | null;
|
|
49
46
|
address: string;
|
|
@@ -67,6 +64,7 @@ export interface ProfileImageInput {
|
|
|
67
64
|
}>;
|
|
68
65
|
positions: ProfileChartPosition[];
|
|
69
66
|
theme: "light" | "dark";
|
|
67
|
+
/** @deprecated Has no effect since 1.5.1. */
|
|
70
68
|
hideWallet: boolean;
|
|
71
69
|
hideAmounts: boolean;
|
|
72
70
|
}
|