zano-mcp 0.1.0
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/README.md +195 -0
- package/dist/clients/daemon.d.ts +6 -0
- package/dist/clients/daemon.d.ts.map +1 -0
- package/dist/clients/daemon.js +30 -0
- package/dist/clients/daemon.js.map +1 -0
- package/dist/clients/trade.d.ts +8 -0
- package/dist/clients/trade.d.ts.map +1 -0
- package/dist/clients/trade.js +33 -0
- package/dist/clients/trade.js.map +1 -0
- package/dist/clients/wallet.d.ts +8 -0
- package/dist/clients/wallet.d.ts.map +1 -0
- package/dist/clients/wallet.js +45 -0
- package/dist/clients/wallet.js.map +1 -0
- package/dist/config.d.ts +30 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +42 -0
- package/dist/config.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +15 -0
- package/dist/index.js.map +1 -0
- package/dist/logger.d.ts +9 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +28 -0
- package/dist/logger.js.map +1 -0
- package/dist/prompts/index.d.ts +4 -0
- package/dist/prompts/index.d.ts.map +1 -0
- package/dist/prompts/index.js +54 -0
- package/dist/prompts/index.js.map +1 -0
- package/dist/resources/index.d.ts +4 -0
- package/dist/resources/index.d.ts.map +1 -0
- package/dist/resources/index.js +60 -0
- package/dist/resources/index.js.map +1 -0
- package/dist/server.d.ts +4 -0
- package/dist/server.d.ts.map +1 -0
- package/dist/server.js +22 -0
- package/dist/server.js.map +1 -0
- package/dist/tools/assets/definitions.d.ts +127 -0
- package/dist/tools/assets/definitions.d.ts.map +1 -0
- package/dist/tools/assets/definitions.js +43 -0
- package/dist/tools/assets/definitions.js.map +1 -0
- package/dist/tools/assets/handlers.d.ts +21 -0
- package/dist/tools/assets/handlers.d.ts.map +1 -0
- package/dist/tools/assets/handlers.js +115 -0
- package/dist/tools/assets/handlers.js.map +1 -0
- package/dist/tools/daemon/definitions.d.ts +139 -0
- package/dist/tools/daemon/definitions.d.ts.map +1 -0
- package/dist/tools/daemon/definitions.js +55 -0
- package/dist/tools/daemon/definitions.js.map +1 -0
- package/dist/tools/daemon/handlers.d.ts +30 -0
- package/dist/tools/daemon/handlers.d.ts.map +1 -0
- package/dist/tools/daemon/handlers.js +274 -0
- package/dist/tools/daemon/handlers.js.map +1 -0
- package/dist/tools/register.d.ts +4 -0
- package/dist/tools/register.d.ts.map +1 -0
- package/dist/tools/register.js +93 -0
- package/dist/tools/register.js.map +1 -0
- package/dist/tools/swap/definitions.d.ts +103 -0
- package/dist/tools/swap/definitions.d.ts.map +1 -0
- package/dist/tools/swap/definitions.js +28 -0
- package/dist/tools/swap/definitions.js.map +1 -0
- package/dist/tools/swap/handlers.d.ts +17 -0
- package/dist/tools/swap/handlers.d.ts.map +1 -0
- package/dist/tools/swap/handlers.js +98 -0
- package/dist/tools/swap/handlers.js.map +1 -0
- package/dist/tools/trade/definitions.d.ts +137 -0
- package/dist/tools/trade/definitions.d.ts.map +1 -0
- package/dist/tools/trade/definitions.js +48 -0
- package/dist/tools/trade/definitions.js.map +1 -0
- package/dist/tools/trade/handlers.d.ts +23 -0
- package/dist/tools/trade/handlers.d.ts.map +1 -0
- package/dist/tools/trade/handlers.js +196 -0
- package/dist/tools/trade/handlers.js.map +1 -0
- package/dist/tools/wallet/definitions.d.ts +158 -0
- package/dist/tools/wallet/definitions.d.ts.map +1 -0
- package/dist/tools/wallet/definitions.js +73 -0
- package/dist/tools/wallet/definitions.js.map +1 -0
- package/dist/tools/wallet/handlers.d.ts +28 -0
- package/dist/tools/wallet/handlers.d.ts.map +1 -0
- package/dist/tools/wallet/handlers.js +214 -0
- package/dist/tools/wallet/handlers.js.map +1 -0
- package/dist/utils/constants.d.ts +25 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +19 -0
- package/dist/utils/constants.js.map +1 -0
- package/dist/utils/formatting.d.ts +14 -0
- package/dist/utils/formatting.d.ts.map +1 -0
- package/dist/utils/formatting.js +68 -0
- package/dist/utils/formatting.js.map +1 -0
- package/package.json +43 -0
- package/src/clients/daemon.ts +41 -0
- package/src/clients/trade.ts +51 -0
- package/src/clients/wallet.ts +59 -0
- package/src/config.ts +56 -0
- package/src/index.ts +20 -0
- package/src/logger.ts +33 -0
- package/src/prompts/index.ts +80 -0
- package/src/resources/index.ts +73 -0
- package/src/server.ts +26 -0
- package/src/tools/assets/definitions.ts +58 -0
- package/src/tools/assets/handlers.ts +140 -0
- package/src/tools/daemon/definitions.ts +86 -0
- package/src/tools/daemon/handlers.ts +349 -0
- package/src/tools/register.ts +194 -0
- package/src/tools/swap/definitions.ts +36 -0
- package/src/tools/swap/handlers.ts +139 -0
- package/src/tools/trade/definitions.ts +67 -0
- package/src/tools/trade/handlers.ts +264 -0
- package/src/tools/wallet/definitions.ts +92 -0
- package/src/tools/wallet/handlers.ts +268 -0
- package/src/utils/constants.ts +24 -0
- package/src/utils/formatting.ts +78 -0
- package/tsconfig.json +19 -0
|
@@ -0,0 +1,158 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export declare const GetBalanceShape: {};
|
|
3
|
+
export declare const GetAddressShape: {};
|
|
4
|
+
export declare const GetWalletStatusShape: {};
|
|
5
|
+
export declare const TransferShape: {
|
|
6
|
+
address: z.ZodString;
|
|
7
|
+
amount: z.ZodString;
|
|
8
|
+
asset_id: z.ZodOptional<z.ZodString>;
|
|
9
|
+
payment_id: z.ZodOptional<z.ZodString>;
|
|
10
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
11
|
+
fee: z.ZodOptional<z.ZodString>;
|
|
12
|
+
mixin: z.ZodOptional<z.ZodNumber>;
|
|
13
|
+
};
|
|
14
|
+
export declare const GetRecentTransactionsShape: {
|
|
15
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
16
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
17
|
+
};
|
|
18
|
+
export declare const SearchTransactionsShape: {
|
|
19
|
+
tx_id: z.ZodOptional<z.ZodString>;
|
|
20
|
+
in: z.ZodOptional<z.ZodBoolean>;
|
|
21
|
+
out: z.ZodOptional<z.ZodBoolean>;
|
|
22
|
+
pool: z.ZodOptional<z.ZodBoolean>;
|
|
23
|
+
filter_by_height: z.ZodOptional<z.ZodBoolean>;
|
|
24
|
+
min_height: z.ZodOptional<z.ZodNumber>;
|
|
25
|
+
max_height: z.ZodOptional<z.ZodNumber>;
|
|
26
|
+
};
|
|
27
|
+
export declare const SignMessageShape: {
|
|
28
|
+
message: z.ZodString;
|
|
29
|
+
};
|
|
30
|
+
export declare const SaveWalletShape: {};
|
|
31
|
+
export declare const MakeIntegratedAddressShape: {
|
|
32
|
+
payment_id: z.ZodOptional<z.ZodString>;
|
|
33
|
+
};
|
|
34
|
+
export declare const SplitIntegratedAddressShape: {
|
|
35
|
+
integrated_address: z.ZodString;
|
|
36
|
+
};
|
|
37
|
+
export declare const GetMiningHistoryShape: {
|
|
38
|
+
v: z.ZodDefault<z.ZodNumber>;
|
|
39
|
+
};
|
|
40
|
+
export declare const SweepBelowShape: {
|
|
41
|
+
address: z.ZodString;
|
|
42
|
+
amount: z.ZodString;
|
|
43
|
+
mixin: z.ZodOptional<z.ZodNumber>;
|
|
44
|
+
fee: z.ZodOptional<z.ZodString>;
|
|
45
|
+
};
|
|
46
|
+
export declare const TransferSchema: z.ZodObject<{
|
|
47
|
+
address: z.ZodString;
|
|
48
|
+
amount: z.ZodString;
|
|
49
|
+
asset_id: z.ZodOptional<z.ZodString>;
|
|
50
|
+
payment_id: z.ZodOptional<z.ZodString>;
|
|
51
|
+
comment: z.ZodOptional<z.ZodString>;
|
|
52
|
+
fee: z.ZodOptional<z.ZodString>;
|
|
53
|
+
mixin: z.ZodOptional<z.ZodNumber>;
|
|
54
|
+
}, "strip", z.ZodTypeAny, {
|
|
55
|
+
address: string;
|
|
56
|
+
amount: string;
|
|
57
|
+
asset_id?: string | undefined;
|
|
58
|
+
fee?: string | undefined;
|
|
59
|
+
comment?: string | undefined;
|
|
60
|
+
payment_id?: string | undefined;
|
|
61
|
+
mixin?: number | undefined;
|
|
62
|
+
}, {
|
|
63
|
+
address: string;
|
|
64
|
+
amount: string;
|
|
65
|
+
asset_id?: string | undefined;
|
|
66
|
+
fee?: string | undefined;
|
|
67
|
+
comment?: string | undefined;
|
|
68
|
+
payment_id?: string | undefined;
|
|
69
|
+
mixin?: number | undefined;
|
|
70
|
+
}>;
|
|
71
|
+
export declare const GetRecentTransactionsSchema: z.ZodObject<{
|
|
72
|
+
offset: z.ZodDefault<z.ZodNumber>;
|
|
73
|
+
count: z.ZodDefault<z.ZodNumber>;
|
|
74
|
+
}, "strip", z.ZodTypeAny, {
|
|
75
|
+
offset: number;
|
|
76
|
+
count: number;
|
|
77
|
+
}, {
|
|
78
|
+
offset?: number | undefined;
|
|
79
|
+
count?: number | undefined;
|
|
80
|
+
}>;
|
|
81
|
+
export declare const SearchTransactionsSchema: z.ZodObject<{
|
|
82
|
+
tx_id: z.ZodOptional<z.ZodString>;
|
|
83
|
+
in: z.ZodOptional<z.ZodBoolean>;
|
|
84
|
+
out: z.ZodOptional<z.ZodBoolean>;
|
|
85
|
+
pool: z.ZodOptional<z.ZodBoolean>;
|
|
86
|
+
filter_by_height: z.ZodOptional<z.ZodBoolean>;
|
|
87
|
+
min_height: z.ZodOptional<z.ZodNumber>;
|
|
88
|
+
max_height: z.ZodOptional<z.ZodNumber>;
|
|
89
|
+
}, "strip", z.ZodTypeAny, {
|
|
90
|
+
tx_id?: string | undefined;
|
|
91
|
+
in?: boolean | undefined;
|
|
92
|
+
out?: boolean | undefined;
|
|
93
|
+
pool?: boolean | undefined;
|
|
94
|
+
filter_by_height?: boolean | undefined;
|
|
95
|
+
min_height?: number | undefined;
|
|
96
|
+
max_height?: number | undefined;
|
|
97
|
+
}, {
|
|
98
|
+
tx_id?: string | undefined;
|
|
99
|
+
in?: boolean | undefined;
|
|
100
|
+
out?: boolean | undefined;
|
|
101
|
+
pool?: boolean | undefined;
|
|
102
|
+
filter_by_height?: boolean | undefined;
|
|
103
|
+
min_height?: number | undefined;
|
|
104
|
+
max_height?: number | undefined;
|
|
105
|
+
}>;
|
|
106
|
+
export declare const SignMessageSchema: z.ZodObject<{
|
|
107
|
+
message: z.ZodString;
|
|
108
|
+
}, "strip", z.ZodTypeAny, {
|
|
109
|
+
message: string;
|
|
110
|
+
}, {
|
|
111
|
+
message: string;
|
|
112
|
+
}>;
|
|
113
|
+
export declare const MakeIntegratedAddressSchema: z.ZodObject<{
|
|
114
|
+
payment_id: z.ZodOptional<z.ZodString>;
|
|
115
|
+
}, "strip", z.ZodTypeAny, {
|
|
116
|
+
payment_id?: string | undefined;
|
|
117
|
+
}, {
|
|
118
|
+
payment_id?: string | undefined;
|
|
119
|
+
}>;
|
|
120
|
+
export declare const SplitIntegratedAddressSchema: z.ZodObject<{
|
|
121
|
+
integrated_address: z.ZodString;
|
|
122
|
+
}, "strip", z.ZodTypeAny, {
|
|
123
|
+
integrated_address: string;
|
|
124
|
+
}, {
|
|
125
|
+
integrated_address: string;
|
|
126
|
+
}>;
|
|
127
|
+
export declare const GetMiningHistorySchema: z.ZodObject<{
|
|
128
|
+
v: z.ZodDefault<z.ZodNumber>;
|
|
129
|
+
}, "strip", z.ZodTypeAny, {
|
|
130
|
+
v: number;
|
|
131
|
+
}, {
|
|
132
|
+
v?: number | undefined;
|
|
133
|
+
}>;
|
|
134
|
+
export declare const SweepBelowSchema: z.ZodObject<{
|
|
135
|
+
address: z.ZodString;
|
|
136
|
+
amount: z.ZodString;
|
|
137
|
+
mixin: z.ZodOptional<z.ZodNumber>;
|
|
138
|
+
fee: z.ZodOptional<z.ZodString>;
|
|
139
|
+
}, "strip", z.ZodTypeAny, {
|
|
140
|
+
address: string;
|
|
141
|
+
amount: string;
|
|
142
|
+
fee?: string | undefined;
|
|
143
|
+
mixin?: number | undefined;
|
|
144
|
+
}, {
|
|
145
|
+
address: string;
|
|
146
|
+
amount: string;
|
|
147
|
+
fee?: string | undefined;
|
|
148
|
+
mixin?: number | undefined;
|
|
149
|
+
}>;
|
|
150
|
+
export type TransferInput = z.infer<typeof TransferSchema>;
|
|
151
|
+
export type GetRecentTransactionsInput = z.infer<typeof GetRecentTransactionsSchema>;
|
|
152
|
+
export type SearchTransactionsInput = z.infer<typeof SearchTransactionsSchema>;
|
|
153
|
+
export type SignMessageInput = z.infer<typeof SignMessageSchema>;
|
|
154
|
+
export type MakeIntegratedAddressInput = z.infer<typeof MakeIntegratedAddressSchema>;
|
|
155
|
+
export type SplitIntegratedAddressInput = z.infer<typeof SplitIntegratedAddressSchema>;
|
|
156
|
+
export type GetMiningHistoryInput = z.infer<typeof GetMiningHistorySchema>;
|
|
157
|
+
export type SweepBelowInput = z.infer<typeof SweepBelowSchema>;
|
|
158
|
+
//# sourceMappingURL=definitions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.d.ts","sourceRoot":"","sources":["../../../src/tools/wallet/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,eAAO,MAAM,eAAe,IAAK,CAAC;AAClC,eAAO,MAAM,eAAe,IAAK,CAAC;AAClC,eAAO,MAAM,oBAAoB,IAAK,CAAC;AAEvC,eAAO,MAAM,aAAa;;;;;;;;CAkBzB,CAAC;AAEF,eAAO,MAAM,0BAA0B;;;CAGtC,CAAC;AAEF,eAAO,MAAM,uBAAuB;;;;;;;;CAQnC,CAAC;AAEF,eAAO,MAAM,gBAAgB;;CAE5B,CAAC;AAEF,eAAO,MAAM,eAAe,IAAK,CAAC;AAElC,eAAO,MAAM,0BAA0B;;CAKtC,CAAC;AAEF,eAAO,MAAM,2BAA2B;;CAEvC,CAAC;AAEF,eAAO,MAAM,qBAAqB;;CAEjC,CAAC;AAEF,eAAO,MAAM,eAAe;;;;;CAU3B,CAAC;AAGF,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;EAA0B,CAAC;AACtD,eAAO,MAAM,2BAA2B;;;;;;;;;EAAuC,CAAC;AAChF,eAAO,MAAM,wBAAwB;;;;;;;;;;;;;;;;;;;;;;;;EAAoC,CAAC;AAC1E,eAAO,MAAM,iBAAiB;;;;;;EAA6B,CAAC;AAC5D,eAAO,MAAM,2BAA2B;;;;;;EAAuC,CAAC;AAChF,eAAO,MAAM,4BAA4B;;;;;;EAAwC,CAAC;AAClF,eAAO,MAAM,sBAAsB;;;;;;EAAkC,CAAC;AACtE,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;EAA4B,CAAC;AAE1D,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,cAAc,CAAC,CAAC;AAC3D,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACrF,MAAM,MAAM,uBAAuB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,wBAAwB,CAAC,CAAC;AAC/E,MAAM,MAAM,gBAAgB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,iBAAiB,CAAC,CAAC;AACjE,MAAM,MAAM,0BAA0B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,2BAA2B,CAAC,CAAC;AACrF,MAAM,MAAM,2BAA2B,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,4BAA4B,CAAC,CAAC;AACvF,MAAM,MAAM,qBAAqB,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,sBAAsB,CAAC,CAAC;AAC3E,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,gBAAgB,CAAC,CAAC"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
export const GetBalanceShape = {};
|
|
3
|
+
export const GetAddressShape = {};
|
|
4
|
+
export const GetWalletStatusShape = {};
|
|
5
|
+
export const TransferShape = {
|
|
6
|
+
address: z.string().describe("Destination address"),
|
|
7
|
+
amount: z.string().describe("Amount in human-readable units (e.g. '1.5')"),
|
|
8
|
+
asset_id: z
|
|
9
|
+
.string()
|
|
10
|
+
.optional()
|
|
11
|
+
.describe("Asset ID to send. Omit for ZANO"),
|
|
12
|
+
payment_id: z.string().optional().describe("Payment ID (optional)"),
|
|
13
|
+
comment: z.string().optional().describe("Transaction comment (optional)"),
|
|
14
|
+
fee: z
|
|
15
|
+
.string()
|
|
16
|
+
.optional()
|
|
17
|
+
.describe("Fee in human-readable ZANO (default: 0.01)"),
|
|
18
|
+
mixin: z
|
|
19
|
+
.number()
|
|
20
|
+
.int()
|
|
21
|
+
.optional()
|
|
22
|
+
.describe("Mixin count (default: 15 normal, 0 auditable)"),
|
|
23
|
+
};
|
|
24
|
+
export const GetRecentTransactionsShape = {
|
|
25
|
+
offset: z.number().int().min(0).default(0).describe("Offset"),
|
|
26
|
+
count: z.number().int().min(1).max(100).default(20).describe("Number of transactions"),
|
|
27
|
+
};
|
|
28
|
+
export const SearchTransactionsShape = {
|
|
29
|
+
tx_id: z.string().optional().describe("Transaction hash to search for"),
|
|
30
|
+
in: z.boolean().optional().describe("Include incoming transactions"),
|
|
31
|
+
out: z.boolean().optional().describe("Include outgoing transactions"),
|
|
32
|
+
pool: z.boolean().optional().describe("Include pool transactions"),
|
|
33
|
+
filter_by_height: z.boolean().optional(),
|
|
34
|
+
min_height: z.number().int().optional(),
|
|
35
|
+
max_height: z.number().int().optional(),
|
|
36
|
+
};
|
|
37
|
+
export const SignMessageShape = {
|
|
38
|
+
message: z.string().describe("Message to sign"),
|
|
39
|
+
};
|
|
40
|
+
export const SaveWalletShape = {};
|
|
41
|
+
export const MakeIntegratedAddressShape = {
|
|
42
|
+
payment_id: z
|
|
43
|
+
.string()
|
|
44
|
+
.optional()
|
|
45
|
+
.describe("Payment ID (auto-generated if omitted)"),
|
|
46
|
+
};
|
|
47
|
+
export const SplitIntegratedAddressShape = {
|
|
48
|
+
integrated_address: z.string().describe("Integrated address to decode"),
|
|
49
|
+
};
|
|
50
|
+
export const GetMiningHistoryShape = {
|
|
51
|
+
v: z.number().int().default(0).describe("Version (0)"),
|
|
52
|
+
};
|
|
53
|
+
export const SweepBelowShape = {
|
|
54
|
+
address: z.string().describe("Address to sweep to"),
|
|
55
|
+
amount: z
|
|
56
|
+
.string()
|
|
57
|
+
.describe("Threshold in human-readable ZANO - sweep outputs below this"),
|
|
58
|
+
mixin: z.number().int().optional().describe("Mixin count (default: 15)"),
|
|
59
|
+
fee: z
|
|
60
|
+
.string()
|
|
61
|
+
.optional()
|
|
62
|
+
.describe("Fee in human-readable ZANO (default: 0.01)"),
|
|
63
|
+
};
|
|
64
|
+
// Schemas and types
|
|
65
|
+
export const TransferSchema = z.object(TransferShape);
|
|
66
|
+
export const GetRecentTransactionsSchema = z.object(GetRecentTransactionsShape);
|
|
67
|
+
export const SearchTransactionsSchema = z.object(SearchTransactionsShape);
|
|
68
|
+
export const SignMessageSchema = z.object(SignMessageShape);
|
|
69
|
+
export const MakeIntegratedAddressSchema = z.object(MakeIntegratedAddressShape);
|
|
70
|
+
export const SplitIntegratedAddressSchema = z.object(SplitIntegratedAddressShape);
|
|
71
|
+
export const GetMiningHistorySchema = z.object(GetMiningHistoryShape);
|
|
72
|
+
export const SweepBelowSchema = z.object(SweepBelowShape);
|
|
73
|
+
//# sourceMappingURL=definitions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"definitions.js","sourceRoot":"","sources":["../../../src/tools/wallet/definitions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,eAAe,GAAG,EAAE,CAAC;AAClC,MAAM,CAAC,MAAM,oBAAoB,GAAG,EAAE,CAAC;AAEvC,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC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AAE,CAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE,CAAC,QAAQ,CAAC,2BAA2B,CAAC;IACxE,GAAG,EAAE,CAAC;SACH,MAAM,EAAE;SACR,QAAQ,EAAE;SACV,QAAQ,CAAC,4CAA4C,CAAC;CAC1D,CAAC;AAEF,oBAAoB;AACpB,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,CAAC,MAAM,CAAC,aAAa,CAAC,CAAC;AACtD,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAChF,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,CAAC,MAAM,CAAC,uBAAuB,CAAC,CAAC;AAC1E,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;AAC5D,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,CAAC,MAAM,CAAC,0BAA0B,CAAC,CAAC;AAChF,MAAM,CAAC,MAAM,4BAA4B,GAAG,CAAC,CAAC,MAAM,CAAC,2BAA2B,CAAC,CAAC;AAClF,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,CAAC,MAAM,CAAC,qBAAqB,CAAC,CAAC;AACtE,MAAM,CAAC,MAAM,gBAAgB,GAAG,CAAC,CAAC,MAAM,CAAC,eAAe,CAAC,CAAC"}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { WalletClient } from "../../clients/wallet.js";
|
|
2
|
+
import { DaemonClient } from "../../clients/daemon.js";
|
|
3
|
+
import type { TransferInput, GetRecentTransactionsInput, SearchTransactionsInput, SignMessageInput, MakeIntegratedAddressInput, SplitIntegratedAddressInput, GetMiningHistoryInput, SweepBelowInput } from "./definitions.js";
|
|
4
|
+
type ToolResult = {
|
|
5
|
+
content: Array<{
|
|
6
|
+
type: "text";
|
|
7
|
+
text: string;
|
|
8
|
+
}>;
|
|
9
|
+
};
|
|
10
|
+
export declare class WalletHandlers {
|
|
11
|
+
private client;
|
|
12
|
+
private daemon;
|
|
13
|
+
constructor(client: WalletClient, daemon: DaemonClient);
|
|
14
|
+
getBalance(): Promise<ToolResult>;
|
|
15
|
+
getAddress(): Promise<ToolResult>;
|
|
16
|
+
getWalletStatus(): Promise<ToolResult>;
|
|
17
|
+
transfer(input: TransferInput): Promise<ToolResult>;
|
|
18
|
+
getRecentTransactions(input: GetRecentTransactionsInput): Promise<ToolResult>;
|
|
19
|
+
searchTransactions(input: SearchTransactionsInput): Promise<ToolResult>;
|
|
20
|
+
signMessage(input: SignMessageInput): Promise<ToolResult>;
|
|
21
|
+
saveWallet(): Promise<ToolResult>;
|
|
22
|
+
makeIntegratedAddress(input: MakeIntegratedAddressInput): Promise<ToolResult>;
|
|
23
|
+
splitIntegratedAddress(input: SplitIntegratedAddressInput): Promise<ToolResult>;
|
|
24
|
+
getMiningHistory(input: GetMiningHistoryInput): Promise<ToolResult>;
|
|
25
|
+
sweepBelow(input: SweepBelowInput): Promise<ToolResult>;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
28
|
+
//# sourceMappingURL=handlers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.d.ts","sourceRoot":"","sources":["../../../src/tools/wallet/handlers.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAWvD,OAAO,KAAK,EACV,aAAa,EACb,0BAA0B,EAC1B,uBAAuB,EACvB,gBAAgB,EAChB,0BAA0B,EAC1B,2BAA2B,EAC3B,qBAAqB,EACrB,eAAe,EAChB,MAAM,kBAAkB,CAAC;AAE1B,KAAK,UAAU,GAAG;IAAE,OAAO,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC,CAAA;CAAE,CAAC;AASrE,qBAAa,cAAc;IACzB,OAAO,CAAC,MAAM,CAAe;IAC7B,OAAO,CAAC,MAAM,CAAe;gBAEjB,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY;IAKhD,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC;IA+BjC,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC;IASjC,eAAe,IAAI,OAAO,CAAC,UAAU,CAAC;IAmBtC,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,UAAU,CAAC;IAoCnD,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,UAAU,CAAC;IAyB7E,kBAAkB,CAAC,KAAK,EAAE,uBAAuB,GAAG,OAAO,CAAC,UAAU,CAAC;IAYvE,WAAW,CAAC,KAAK,EAAE,gBAAgB,GAAG,OAAO,CAAC,UAAU,CAAC;IAWzD,UAAU,IAAI,OAAO,CAAC,UAAU,CAAC;IASjC,qBAAqB,CAAC,KAAK,EAAE,0BAA0B,GAAG,OAAO,CAAC,UAAU,CAAC;IAgB7E,sBAAsB,CAAC,KAAK,EAAE,2BAA2B,GAAG,OAAO,CAAC,UAAU,CAAC;IAc/E,gBAAgB,CAAC,KAAK,EAAE,qBAAqB,GAAG,OAAO,CAAC,UAAU,CAAC;IAsBnE,UAAU,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAAC,UAAU,CAAC;CAsB9D"}
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { atomicToHuman, humanToAtomic, formatTimestamp, formatZano, getAssetInfo, registerAsset, } from "../../utils/formatting.js";
|
|
2
|
+
import { ZANO_ASSET_ID, ZANO_DECIMALS, DEFAULT_FEE, DEFAULT_MIXIN } from "../../utils/constants.js";
|
|
3
|
+
function textResult(text) {
|
|
4
|
+
return { content: [{ type: "text", text }] };
|
|
5
|
+
}
|
|
6
|
+
function errorResult(error) {
|
|
7
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
8
|
+
return textResult(`Error: ${msg}`);
|
|
9
|
+
}
|
|
10
|
+
export class WalletHandlers {
|
|
11
|
+
client;
|
|
12
|
+
daemon;
|
|
13
|
+
constructor(client, daemon) {
|
|
14
|
+
this.client = client;
|
|
15
|
+
this.daemon = daemon;
|
|
16
|
+
}
|
|
17
|
+
async getBalance() {
|
|
18
|
+
try {
|
|
19
|
+
const res = await this.client.call("getbalance");
|
|
20
|
+
const lines = ["Wallet Balance:"];
|
|
21
|
+
const balance = BigInt(String(res.balance || 0));
|
|
22
|
+
const unlocked = BigInt(String(res.unlocked_balance || 0));
|
|
23
|
+
lines.push(` ZANO: ${atomicToHuman(unlocked, ZANO_DECIMALS)} (locked: ${atomicToHuman(balance - unlocked, ZANO_DECIMALS)})`);
|
|
24
|
+
const balances = res.balances;
|
|
25
|
+
if (balances && balances.length > 0) {
|
|
26
|
+
for (const b of balances) {
|
|
27
|
+
const assetId = String(b.asset_id || "");
|
|
28
|
+
if (assetId === ZANO_ASSET_ID)
|
|
29
|
+
continue;
|
|
30
|
+
const assetInfo = b.asset_info || {};
|
|
31
|
+
const ticker = String(assetInfo.ticker || assetId.slice(0, 8));
|
|
32
|
+
const decimals = Number(assetInfo.decimal_point ?? 12);
|
|
33
|
+
registerAsset(assetId, ticker, decimals);
|
|
34
|
+
const bal = BigInt(String(b.balance || 0));
|
|
35
|
+
const ubal = BigInt(String(b.unlocked || 0));
|
|
36
|
+
lines.push(` ${ticker}: ${atomicToHuman(ubal, decimals)} (locked: ${atomicToHuman(bal - ubal, decimals)})`);
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return textResult(lines.join("\n"));
|
|
40
|
+
}
|
|
41
|
+
catch (e) {
|
|
42
|
+
return errorResult(e);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
async getAddress() {
|
|
46
|
+
try {
|
|
47
|
+
const res = await this.client.call("getaddress");
|
|
48
|
+
return textResult(`Wallet address: ${res.address}`);
|
|
49
|
+
}
|
|
50
|
+
catch (e) {
|
|
51
|
+
return errorResult(e);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
async getWalletStatus() {
|
|
55
|
+
try {
|
|
56
|
+
const res = await this.client.call("get_wallet_info");
|
|
57
|
+
const lines = [
|
|
58
|
+
"Wallet Status:",
|
|
59
|
+
` Address: ${res.address || "N/A"}`,
|
|
60
|
+
` Current height: ${res.current_height || "N/A"}`,
|
|
61
|
+
` Daemon height: ${res.current_daemon_height || "N/A"}`,
|
|
62
|
+
` Watch only: ${res.is_whatch_only ? "Yes" : "No"}`,
|
|
63
|
+
` In audit: ${res.is_auditable ? "Yes" : "No"}`,
|
|
64
|
+
` Min confirmations: ${res.mincounted_transfer_count ?? "N/A"}`,
|
|
65
|
+
` Transfer count: ${res.transfer_entries_count ?? "N/A"}`,
|
|
66
|
+
];
|
|
67
|
+
return textResult(lines.join("\n"));
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
return errorResult(e);
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
async transfer(input) {
|
|
74
|
+
try {
|
|
75
|
+
const assetId = input.asset_id || ZANO_ASSET_ID;
|
|
76
|
+
const info = getAssetInfo(assetId);
|
|
77
|
+
const decimals = info?.decimals ?? ZANO_DECIMALS;
|
|
78
|
+
const atomicAmount = humanToAtomic(input.amount, decimals);
|
|
79
|
+
const mixin = input.mixin ?? DEFAULT_MIXIN;
|
|
80
|
+
const fee = input.fee ? humanToAtomic(input.fee, ZANO_DECIMALS) : String(DEFAULT_FEE);
|
|
81
|
+
const dest = {
|
|
82
|
+
address: input.address,
|
|
83
|
+
amount: atomicAmount,
|
|
84
|
+
};
|
|
85
|
+
if (assetId !== ZANO_ASSET_ID) {
|
|
86
|
+
dest.asset_id = assetId;
|
|
87
|
+
}
|
|
88
|
+
const params = {
|
|
89
|
+
destinations: [dest],
|
|
90
|
+
fee: Number(fee),
|
|
91
|
+
mixin,
|
|
92
|
+
};
|
|
93
|
+
if (input.payment_id)
|
|
94
|
+
params.payment_id = input.payment_id;
|
|
95
|
+
if (input.comment)
|
|
96
|
+
params.comment = input.comment;
|
|
97
|
+
const res = await this.client.call("transfer", params);
|
|
98
|
+
const ticker = info?.ticker || "ZANO";
|
|
99
|
+
return textResult(`Transfer sent: ${input.amount} ${ticker} to ${input.address}\nTX hash: ${res.tx_hash}\nTX size: ${res.tx_size || "N/A"} bytes`);
|
|
100
|
+
}
|
|
101
|
+
catch (e) {
|
|
102
|
+
return errorResult(e);
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
async getRecentTransactions(input) {
|
|
106
|
+
try {
|
|
107
|
+
const res = await this.client.call("get_recent_txs_and_info", { offset: input.offset, count: input.count, update_provision_info: true });
|
|
108
|
+
const transfers = (res.transfers || []);
|
|
109
|
+
if (transfers.length === 0) {
|
|
110
|
+
return textResult("No recent transactions found.");
|
|
111
|
+
}
|
|
112
|
+
const lines = [`Recent Transactions (${transfers.length}):`];
|
|
113
|
+
for (const tx of transfers) {
|
|
114
|
+
const dir = tx.is_income ? "IN" : "OUT";
|
|
115
|
+
const amount = tx.amount ? formatZano(tx.amount) : "N/A";
|
|
116
|
+
const ts = formatTimestamp(Number(tx.timestamp || 0));
|
|
117
|
+
const hash = String(tx.tx_hash || "").slice(0, 16);
|
|
118
|
+
const comment = tx.comment ? ` "${tx.comment}"` : "";
|
|
119
|
+
lines.push(` [${dir}] ${amount} | ${ts} | ${hash}...${comment}`);
|
|
120
|
+
}
|
|
121
|
+
return textResult(lines.join("\n"));
|
|
122
|
+
}
|
|
123
|
+
catch (e) {
|
|
124
|
+
return errorResult(e);
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
async searchTransactions(input) {
|
|
128
|
+
try {
|
|
129
|
+
const res = await this.client.call("search_for_transactions", input);
|
|
130
|
+
return textResult(JSON.stringify(res, null, 2));
|
|
131
|
+
}
|
|
132
|
+
catch (e) {
|
|
133
|
+
return errorResult(e);
|
|
134
|
+
}
|
|
135
|
+
}
|
|
136
|
+
async signMessage(input) {
|
|
137
|
+
try {
|
|
138
|
+
// sign_message requires base64 encoded message
|
|
139
|
+
const b64 = Buffer.from(input.message).toString("base64");
|
|
140
|
+
const res = await this.client.call("sign_message", { buff: b64 });
|
|
141
|
+
return textResult(`Signature: ${res.sig}`);
|
|
142
|
+
}
|
|
143
|
+
catch (e) {
|
|
144
|
+
return errorResult(e);
|
|
145
|
+
}
|
|
146
|
+
}
|
|
147
|
+
async saveWallet() {
|
|
148
|
+
try {
|
|
149
|
+
await this.client.call("store");
|
|
150
|
+
return textResult("Wallet state saved.");
|
|
151
|
+
}
|
|
152
|
+
catch (e) {
|
|
153
|
+
return errorResult(e);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
async makeIntegratedAddress(input) {
|
|
157
|
+
try {
|
|
158
|
+
const params = {};
|
|
159
|
+
if (input.payment_id)
|
|
160
|
+
params.payment_id = input.payment_id;
|
|
161
|
+
const res = await this.client.call("make_integrated_address", params);
|
|
162
|
+
return textResult(`Integrated address: ${res.integrated_address}\nPayment ID: ${res.payment_id}`);
|
|
163
|
+
}
|
|
164
|
+
catch (e) {
|
|
165
|
+
return errorResult(e);
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
async splitIntegratedAddress(input) {
|
|
169
|
+
try {
|
|
170
|
+
const res = await this.client.call("split_integrated_address", { integrated_address: input.integrated_address });
|
|
171
|
+
return textResult(`Standard address: ${res.standard_address}\nPayment ID: ${res.payment_id}`);
|
|
172
|
+
}
|
|
173
|
+
catch (e) {
|
|
174
|
+
return errorResult(e);
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
async getMiningHistory(input) {
|
|
178
|
+
try {
|
|
179
|
+
const res = await this.client.call("get_mining_history", { v: input.v });
|
|
180
|
+
const history = (res.mined_entries || []);
|
|
181
|
+
if (history.length === 0) {
|
|
182
|
+
return textResult("No staking history found.");
|
|
183
|
+
}
|
|
184
|
+
const lines = [`Staking History (${history.length} entries):`];
|
|
185
|
+
for (const entry of history) {
|
|
186
|
+
const amount = entry.a ? formatZano(entry.a) : "N/A";
|
|
187
|
+
const ts = formatTimestamp(Number(entry.t || 0));
|
|
188
|
+
lines.push(` ${ts} | ${amount} | Block ${entry.h || "N/A"}`);
|
|
189
|
+
}
|
|
190
|
+
return textResult(lines.join("\n"));
|
|
191
|
+
}
|
|
192
|
+
catch (e) {
|
|
193
|
+
return errorResult(e);
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
async sweepBelow(input) {
|
|
197
|
+
try {
|
|
198
|
+
const atomicAmount = humanToAtomic(input.amount, ZANO_DECIMALS);
|
|
199
|
+
const mixin = input.mixin ?? DEFAULT_MIXIN;
|
|
200
|
+
const fee = input.fee ? humanToAtomic(input.fee, ZANO_DECIMALS) : String(DEFAULT_FEE);
|
|
201
|
+
const res = await this.client.call("sweep_below", {
|
|
202
|
+
address: input.address,
|
|
203
|
+
amount: Number(atomicAmount),
|
|
204
|
+
mixin,
|
|
205
|
+
fee: Number(fee),
|
|
206
|
+
});
|
|
207
|
+
return textResult(`Sweep complete.\nTX hash: ${res.tx_hash}\nAmount swept: ${res.amount ? formatZano(res.amount) : "N/A"}`);
|
|
208
|
+
}
|
|
209
|
+
catch (e) {
|
|
210
|
+
return errorResult(e);
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=handlers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handlers.js","sourceRoot":"","sources":["../../../src/tools/wallet/handlers.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,aAAa,EACb,aAAa,EAEb,eAAe,EACf,UAAU,EACV,YAAY,EACZ,aAAa,GACd,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,aAAa,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAapG,SAAS,UAAU,CAAC,IAAY;IAC9B,OAAO,EAAE,OAAO,EAAE,CAAC,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CAAC,MAAgB,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CACnH,CAAC;QACJ,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC;QACxB,CAAC;IACH,CAAC;CACF"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
export declare const ZANO_ASSET_ID = "d6329b5b1f7c0805b5c345f4957554002a2f557845f64d7645dae0e051a6498a";
|
|
2
|
+
export declare const DEFAULT_PORTS: {
|
|
3
|
+
readonly mainnet: {
|
|
4
|
+
readonly daemon: 11211;
|
|
5
|
+
readonly wallet: 11212;
|
|
6
|
+
};
|
|
7
|
+
readonly testnet: {
|
|
8
|
+
readonly daemon: 12211;
|
|
9
|
+
readonly wallet: 12212;
|
|
10
|
+
};
|
|
11
|
+
};
|
|
12
|
+
export declare const PUBLIC_NODES: {
|
|
13
|
+
readonly mainnet: "http://37.27.100.59:10500/json_rpc";
|
|
14
|
+
readonly testnet: "http://37.27.100.59:10505/json_rpc";
|
|
15
|
+
};
|
|
16
|
+
export declare const ASSET_WHITELIST_URLS: {
|
|
17
|
+
readonly mainnet: "https://api.zano.org/assets_whitelist.json";
|
|
18
|
+
readonly testnet: "https://api.zano.org/assets_whitelist_testnet.json";
|
|
19
|
+
};
|
|
20
|
+
export declare const TRADE_API_URL = "https://api.trade.zano.org";
|
|
21
|
+
export declare const ZANO_DECIMALS = 12;
|
|
22
|
+
export declare const DEFAULT_MIXIN = 15;
|
|
23
|
+
export declare const AUDITABLE_MIXIN = 0;
|
|
24
|
+
export declare const DEFAULT_FEE = 10000000000;
|
|
25
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,aAAa,qEAC0C,CAAC;AAErE,eAAO,MAAM,aAAa;;;;;;;;;CAGhB,CAAC;AAEX,eAAO,MAAM,YAAY;;;CAGf,CAAC;AAEX,eAAO,MAAM,oBAAoB;;;CAGvB,CAAC;AAEX,eAAO,MAAM,aAAa,+BAA+B,CAAC;AAE1D,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,eAAO,MAAM,aAAa,KAAK,CAAC;AAChC,eAAO,MAAM,eAAe,IAAI,CAAC;AACjC,eAAO,MAAM,WAAW,cAAc,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export const ZANO_ASSET_ID = "d6329b5b1f7c0805b5c345f4957554002a2f557845f64d7645dae0e051a6498a";
|
|
2
|
+
export const DEFAULT_PORTS = {
|
|
3
|
+
mainnet: { daemon: 11211, wallet: 11212 },
|
|
4
|
+
testnet: { daemon: 12211, wallet: 12212 },
|
|
5
|
+
};
|
|
6
|
+
export const PUBLIC_NODES = {
|
|
7
|
+
mainnet: "http://37.27.100.59:10500/json_rpc",
|
|
8
|
+
testnet: "http://37.27.100.59:10505/json_rpc",
|
|
9
|
+
};
|
|
10
|
+
export const ASSET_WHITELIST_URLS = {
|
|
11
|
+
mainnet: "https://api.zano.org/assets_whitelist.json",
|
|
12
|
+
testnet: "https://api.zano.org/assets_whitelist_testnet.json",
|
|
13
|
+
};
|
|
14
|
+
export const TRADE_API_URL = "https://api.trade.zano.org";
|
|
15
|
+
export const ZANO_DECIMALS = 12;
|
|
16
|
+
export const DEFAULT_MIXIN = 15;
|
|
17
|
+
export const AUDITABLE_MIXIN = 0;
|
|
18
|
+
export const DEFAULT_FEE = 10000000000; // 0.01 ZANO
|
|
19
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/utils/constants.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,aAAa,GACxB,kEAAkE,CAAC;AAErE,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;IACzC,OAAO,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE;CACjC,CAAC;AAEX,MAAM,CAAC,MAAM,YAAY,GAAG;IAC1B,OAAO,EAAE,oCAAoC;IAC7C,OAAO,EAAE,oCAAoC;CACrC,CAAC;AAEX,MAAM,CAAC,MAAM,oBAAoB,GAAG;IAClC,OAAO,EAAE,4CAA4C;IACrD,OAAO,EAAE,oDAAoD;CACrD,CAAC;AAEX,MAAM,CAAC,MAAM,aAAa,GAAG,4BAA4B,CAAC;AAE1D,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,aAAa,GAAG,EAAE,CAAC;AAChC,MAAM,CAAC,MAAM,eAAe,GAAG,CAAC,CAAC;AACjC,MAAM,CAAC,MAAM,WAAW,GAAG,WAAW,CAAC,CAAC,YAAY"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export declare function registerAsset(assetId: string, ticker: string, decimals: number): void;
|
|
2
|
+
export declare function getAssetInfo(assetId: string): {
|
|
3
|
+
ticker: string;
|
|
4
|
+
decimals: number;
|
|
5
|
+
} | undefined;
|
|
6
|
+
export declare function atomicToHuman(amount: bigint | number | string, decimals: number): string;
|
|
7
|
+
export declare function humanToAtomic(amount: string, decimals: number): string;
|
|
8
|
+
export declare function formatZano(atomicAmount: bigint | number | string): string;
|
|
9
|
+
export declare function formatAssetAmount(atomicAmount: bigint | number | string, assetId: string): string;
|
|
10
|
+
export declare function formatTimestamp(ts: number): string;
|
|
11
|
+
export declare function formatDifficulty(diff: number): string;
|
|
12
|
+
export declare function formatHashrate(h: number): string;
|
|
13
|
+
export declare function shortenHash(hash: string, len?: number): string;
|
|
14
|
+
//# sourceMappingURL=formatting.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatting.d.ts","sourceRoot":"","sources":["../../src/utils/formatting.ts"],"names":[],"mappings":"AAIA,wBAAgB,aAAa,CAC3B,OAAO,EAAE,MAAM,EACf,MAAM,EAAE,MAAM,EACd,QAAQ,EAAE,MAAM,GACf,IAAI,CAEN;AAKD,wBAAgB,YAAY,CAC1B,OAAO,EAAE,MAAM,GACd;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,GAAG,SAAS,CAElD;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAQxF;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,MAAM,CAMtE;AAED,wBAAgB,UAAU,CAAC,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,GAAG,MAAM,CAEzE;AAED,wBAAgB,iBAAiB,CAC/B,YAAY,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,EACtC,OAAO,EAAE,MAAM,GACd,MAAM,CAMR;AAED,wBAAgB,eAAe,CAAC,EAAE,EAAE,MAAM,GAAG,MAAM,CAGlD;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAMrD;AAED,wBAAgB,cAAc,CAAC,CAAC,EAAE,MAAM,GAAG,MAAM,CAKhD;AAED,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,EAAE,GAAG,SAAI,GAAG,MAAM,CAGzD"}
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { ZANO_ASSET_ID, ZANO_DECIMALS } from "./constants.js";
|
|
2
|
+
const knownAssets = new Map();
|
|
3
|
+
export function registerAsset(assetId, ticker, decimals) {
|
|
4
|
+
knownAssets.set(assetId, { ticker, decimals });
|
|
5
|
+
}
|
|
6
|
+
// Pre-register ZANO
|
|
7
|
+
registerAsset(ZANO_ASSET_ID, "ZANO", ZANO_DECIMALS);
|
|
8
|
+
export function getAssetInfo(assetId) {
|
|
9
|
+
return knownAssets.get(assetId);
|
|
10
|
+
}
|
|
11
|
+
export function atomicToHuman(amount, decimals) {
|
|
12
|
+
const val = BigInt(amount);
|
|
13
|
+
const divisor = BigInt(10) ** BigInt(decimals);
|
|
14
|
+
const whole = val / divisor;
|
|
15
|
+
const frac = val % divisor;
|
|
16
|
+
if (frac === 0n)
|
|
17
|
+
return whole.toString();
|
|
18
|
+
const fracStr = frac.toString().padStart(decimals, "0").replace(/0+$/, "");
|
|
19
|
+
return `${whole}.${fracStr}`;
|
|
20
|
+
}
|
|
21
|
+
export function humanToAtomic(amount, decimals) {
|
|
22
|
+
const parts = amount.split(".");
|
|
23
|
+
const whole = parts[0] || "0";
|
|
24
|
+
const frac = (parts[1] || "").padEnd(decimals, "0").slice(0, decimals);
|
|
25
|
+
const val = BigInt(whole) * BigInt(10) ** BigInt(decimals) + BigInt(frac);
|
|
26
|
+
return val.toString();
|
|
27
|
+
}
|
|
28
|
+
export function formatZano(atomicAmount) {
|
|
29
|
+
return `${atomicToHuman(atomicAmount, ZANO_DECIMALS)} ZANO`;
|
|
30
|
+
}
|
|
31
|
+
export function formatAssetAmount(atomicAmount, assetId) {
|
|
32
|
+
const info = knownAssets.get(assetId);
|
|
33
|
+
if (info) {
|
|
34
|
+
return `${atomicToHuman(atomicAmount, info.decimals)} ${info.ticker}`;
|
|
35
|
+
}
|
|
36
|
+
return `${atomicAmount} (asset: ${assetId.slice(0, 8)}...)`;
|
|
37
|
+
}
|
|
38
|
+
export function formatTimestamp(ts) {
|
|
39
|
+
if (ts === 0)
|
|
40
|
+
return "N/A";
|
|
41
|
+
return new Date(ts * 1000).toISOString().replace("T", " ").replace(/\.\d+Z$/, " UTC");
|
|
42
|
+
}
|
|
43
|
+
export function formatDifficulty(diff) {
|
|
44
|
+
if (diff >= 1e12)
|
|
45
|
+
return `${(diff / 1e12).toFixed(2)} TH`;
|
|
46
|
+
if (diff >= 1e9)
|
|
47
|
+
return `${(diff / 1e9).toFixed(2)} GH`;
|
|
48
|
+
if (diff >= 1e6)
|
|
49
|
+
return `${(diff / 1e6).toFixed(2)} MH`;
|
|
50
|
+
if (diff >= 1e3)
|
|
51
|
+
return `${(diff / 1e3).toFixed(2)} KH`;
|
|
52
|
+
return diff.toString();
|
|
53
|
+
}
|
|
54
|
+
export function formatHashrate(h) {
|
|
55
|
+
if (h >= 1e9)
|
|
56
|
+
return `${(h / 1e9).toFixed(2)} GH/s`;
|
|
57
|
+
if (h >= 1e6)
|
|
58
|
+
return `${(h / 1e6).toFixed(2)} MH/s`;
|
|
59
|
+
if (h >= 1e3)
|
|
60
|
+
return `${(h / 1e3).toFixed(2)} KH/s`;
|
|
61
|
+
return `${h.toFixed(2)} H/s`;
|
|
62
|
+
}
|
|
63
|
+
export function shortenHash(hash, len = 8) {
|
|
64
|
+
if (hash.length <= len * 2)
|
|
65
|
+
return hash;
|
|
66
|
+
return `${hash.slice(0, len)}...${hash.slice(-len)}`;
|
|
67
|
+
}
|
|
68
|
+
//# sourceMappingURL=formatting.js.map
|