zano_web3 9.6.0 → 10.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.
Files changed (87) hide show
  1. package/package.json +17 -9
  2. package/server/dist/server.d.ts +13 -2
  3. package/server/dist/server.js +68 -6
  4. package/server/dist/server.js.map +1 -1
  5. package/server/dist/types.d.ts +24 -24
  6. package/server/src/server.ts +101 -8
  7. package/server/src/types.ts +111 -111
  8. package/shared/dist/utils.d.ts +61 -0
  9. package/shared/dist/utils.js +188 -0
  10. package/shared/dist/utils.js.map +1 -1
  11. package/shared/src/utils.ts +276 -1
  12. package/web/dist/index.d.ts +2 -4
  13. package/web/dist/index.js +2 -4
  14. package/web/dist/index.js.map +1 -1
  15. package/web/dist/types/errors/index.d.ts +7 -0
  16. package/web/dist/types/errors/index.js +9 -0
  17. package/web/dist/types/errors/index.js.map +1 -0
  18. package/web/dist/types/index.d.ts +4 -0
  19. package/web/dist/types/index.js +5 -0
  20. package/web/dist/types/index.js.map +1 -0
  21. package/web/dist/types/params/companion-requests/index.d.ts +1 -0
  22. package/web/dist/types/params/companion-requests/index.js +2 -0
  23. package/web/dist/types/params/companion-requests/index.js.map +1 -0
  24. package/web/dist/types/params/companion-requests/request-permissions/index.d.ts +5 -0
  25. package/web/dist/types/params/companion-requests/request-permissions/index.js +2 -0
  26. package/web/dist/types/params/companion-requests/request-permissions/index.js.map +1 -0
  27. package/web/dist/types/params/index.d.ts +1 -0
  28. package/web/dist/types/params/index.js +2 -0
  29. package/web/dist/types/params/index.js.map +1 -0
  30. package/web/dist/types/responses/companion-methods/create-alias/index.d.ts +13 -0
  31. package/web/dist/types/responses/companion-methods/create-alias/index.js +10 -0
  32. package/web/dist/types/responses/companion-methods/create-alias/index.js.map +1 -0
  33. package/web/dist/types/responses/companion-methods/get-address-by-alias/index.d.ts +12 -0
  34. package/web/dist/types/responses/companion-methods/get-address-by-alias/index.js +8 -0
  35. package/web/dist/types/responses/companion-methods/get-address-by-alias/index.js.map +1 -0
  36. package/web/dist/types/responses/companion-methods/get-wallet-data/index.d.ts +73 -0
  37. package/web/dist/types/responses/companion-methods/get-wallet-data/index.js +39 -0
  38. package/web/dist/types/responses/companion-methods/get-wallet-data/index.js.map +1 -0
  39. package/web/dist/types/responses/companion-methods/index.d.ts +5 -0
  40. package/web/dist/types/responses/companion-methods/index.js +2 -0
  41. package/web/dist/types/responses/companion-methods/index.js.map +1 -0
  42. package/web/dist/types/responses/companion-methods/request-message-sign/index.d.ts +23 -0
  43. package/web/dist/types/responses/companion-methods/request-message-sign/index.js +16 -0
  44. package/web/dist/types/responses/companion-methods/request-message-sign/index.js.map +1 -0
  45. package/web/dist/types/responses/companion-methods/request-permissions/index.d.ts +13 -0
  46. package/web/dist/types/responses/companion-methods/request-permissions/index.js +10 -0
  47. package/web/dist/types/responses/companion-methods/request-permissions/index.js.map +1 -0
  48. package/web/dist/types/responses/index.d.ts +1 -0
  49. package/web/dist/types/responses/index.js +2 -0
  50. package/web/dist/types/responses/index.js.map +1 -0
  51. package/web/dist/types/special/index.d.ts +1 -0
  52. package/web/dist/types/special/index.js +2 -0
  53. package/web/dist/types/special/index.js.map +1 -0
  54. package/web/dist/types/special/zano-window/index.d.ts +7 -0
  55. package/web/dist/types/special/zano-window/index.js +2 -0
  56. package/web/dist/types/special/zano-window/index.js.map +1 -0
  57. package/web/dist/zano-wallet.d.ts +11 -0
  58. package/web/dist/zano-wallet.js +125 -0
  59. package/web/dist/zano-wallet.js.map +1 -0
  60. package/web/src/index.ts +4 -7
  61. package/web/src/types/errors/index.ts +10 -0
  62. package/web/src/types/index.ts +4 -0
  63. package/web/src/types/params/companion-requests/index.ts +1 -0
  64. package/web/src/types/params/companion-requests/request-permissions/index.ts +10 -0
  65. package/web/src/types/params/index.ts +1 -0
  66. package/web/src/types/responses/companion-methods/create-alias/index.ts +19 -0
  67. package/web/src/types/responses/companion-methods/get-address-by-alias/index.ts +18 -0
  68. package/web/src/types/responses/companion-methods/get-wallet-data/index.ts +52 -0
  69. package/web/src/types/responses/companion-methods/index.ts +5 -0
  70. package/web/src/types/responses/companion-methods/request-message-sign/index.ts +33 -0
  71. package/web/src/types/responses/companion-methods/request-permissions/index.ts +19 -0
  72. package/web/src/types/responses/index.ts +2 -0
  73. package/web/src/types/special/index.ts +1 -0
  74. package/web/src/types/special/zano-window/index.ts +9 -0
  75. package/web/src/zano-wallet.ts +161 -0
  76. package/web/dist/hooks.d.ts +0 -3
  77. package/web/dist/hooks.js +0 -14
  78. package/web/dist/hooks.js.map +0 -1
  79. package/web/dist/types.d.ts +0 -32
  80. package/web/dist/types.js +0 -2
  81. package/web/dist/types.js.map +0 -1
  82. package/web/dist/zanoWallet.d.ts +0 -42
  83. package/web/dist/zanoWallet.js +0 -156
  84. package/web/dist/zanoWallet.js.map +0 -1
  85. package/web/src/hooks.ts +0 -18
  86. package/web/src/types.ts +0 -35
  87. package/web/src/zanoWallet.ts +0 -240
@@ -1,4 +1,7 @@
1
1
  import Decimal from "decimal.js";
2
+ import { keccak_256 } from "@noble/hashes/sha3.js";
3
+ import { bytesToHex } from "@noble/hashes/utils.js";
4
+ import { base58xmr } from "@scure/base";
2
5
 
3
6
  export function validateTokensInput(input: string | number, decimal_point: number = 12) {
4
7
 
@@ -86,4 +89,276 @@ export function validateTokensInput(input: string | number, decimal_point: numbe
86
89
  return {
87
90
  valid: true
88
91
  };
89
- }
92
+ }
93
+
94
+ export type GenerateSecureMessageForSigningResult = {
95
+ success: true;
96
+ message: string;
97
+ } | {
98
+ success: false;
99
+ error: 'NONCE_TOO_SHORT' | 'CONTROL_CHARACTERS_NOT_ALLOWED';
100
+ }
101
+ export function generateSecureMessageForSigning({
102
+ domain,
103
+ address,
104
+ statement,
105
+ uri,
106
+ nonce,
107
+ expirationTime,
108
+ isTestnet
109
+ }: {
110
+ domain: string;
111
+ address: string;
112
+ statement: string;
113
+ uri: string;
114
+ nonce: string;
115
+ expirationTime: Date;
116
+ isTestnet?: boolean;
117
+ }): GenerateSecureMessageForSigningResult {
118
+ // C0/C1 controls (covers \n, \r, \t, NUL, DEL, …) plus Unicode line/paragraph
119
+ // separators (U+2028/U+2029), which split('\n') would not catch but still break
120
+ // the positional, line-based message layout.
121
+ const CONTROL_CHARS = /[\p{Cc}\p{Zl}\p{Zp}]/u;
122
+
123
+ for (const field of ['domain', 'address', 'statement', 'uri', 'nonce'] as const) {
124
+ const value = { domain, address, statement, uri, nonce }[field];
125
+
126
+ if (CONTROL_CHARS.test(value)) {
127
+ return { success: false, error: 'CONTROL_CHARACTERS_NOT_ALLOWED' };
128
+ }
129
+ }
130
+
131
+ if (nonce.length < 8) {
132
+ return {
133
+ success: false,
134
+ error: 'NONCE_TOO_SHORT'
135
+ };
136
+ }
137
+
138
+ let result = '';
139
+
140
+ result += `${domain} wants you to sign in with your Zano account:\n`;
141
+ result += `${address}\n`;
142
+ result += `\n`;
143
+ result += `${statement}\n`;
144
+ result += `\n`;
145
+ result += `URI: ${uri}\n`;
146
+ result += `Version: 1\n`;
147
+ result += `Chain ID: ${isTestnet ? 'zano:testnet' : 'zano:mainnet'}\n`;
148
+ result += `Nonce: ${nonce}\n`;
149
+ result += `Expiration Time: ${expirationTime.toISOString()}`;
150
+
151
+ return {
152
+ success: true,
153
+ message: result
154
+ };
155
+ }
156
+
157
+ export type ParseSecureMessageForSigningResult = {
158
+ success: true;
159
+ parsingResult: {
160
+ isSecureMessage: true;
161
+ isValidSecureMessage: true;
162
+ values: {
163
+ domain: string;
164
+ address: string;
165
+ statement: string;
166
+ uri: string;
167
+ nonce: string;
168
+ expirationTime: Date;
169
+ chainId: string;
170
+ version: string;
171
+ }
172
+ } | {
173
+ isSecureMessage: boolean;
174
+ isValidSecureMessage: false;
175
+ }
176
+ } | {
177
+ success: false;
178
+ error: never;
179
+ }
180
+ export function parseSecureMessageForSigning({
181
+ message,
182
+ }: {
183
+ message: string;
184
+ }): ParseSecureMessageForSigningResult {
185
+ // The message layout is fixed and positional (see
186
+ // generateSecureMessageForSigning):
187
+ //
188
+ // 0: "{domain} wants you to sign in with your Zano account:"
189
+ // 1: {address}
190
+ // 2: ""
191
+ // 3: {statement}
192
+ // 4: ""
193
+ // 5+: "Key: value" fields (URI, Version, Chain ID, Nonce, Expiration Time)
194
+ const HEADER_SUFFIX = ' wants you to sign in with your Zano account:';
195
+ const HEADER_LINE_COUNT = 5;
196
+
197
+ // A "Version: ..." line is the cheap signal that this is a secure message at
198
+ // all, independent of whether it fully parses.
199
+ const isSecureMessage = /(\r|\n)Version:.*/g.test(message);
200
+
201
+ const lines = message.split('\n');
202
+
203
+ if (
204
+ lines.length < HEADER_LINE_COUNT ||
205
+ !lines[0].endsWith(HEADER_SUFFIX) ||
206
+ lines[2] !== '' ||
207
+ lines[4] !== ''
208
+ ) {
209
+ return {
210
+ success: true,
211
+ parsingResult: { isSecureMessage, isValidSecureMessage: false }
212
+ };
213
+ }
214
+
215
+ const domain = lines[0].slice(0, -HEADER_SUFFIX.length);
216
+ const address = lines[1];
217
+ const statement = lines[3];
218
+
219
+ // The remaining lines are "Key: value" fields and may appear in any order.
220
+ const fields = new Map<string, string>();
221
+ for (const line of lines.slice(HEADER_LINE_COUNT)) {
222
+ const separatorIndex = line.indexOf(': ');
223
+ if (separatorIndex === -1) {
224
+ continue;
225
+ }
226
+ fields.set(line.slice(0, separatorIndex), line.slice(separatorIndex + 2));
227
+ }
228
+
229
+ const uri = fields.get('URI');
230
+ const version = fields.get('Version');
231
+ const chainId = fields.get('Chain ID');
232
+ const nonce = fields.get('Nonce');
233
+ const expirationTimeRaw = fields.get('Expiration Time');
234
+
235
+ // Every field that carries a value we expose must be present.
236
+ if (
237
+ domain.length === 0 ||
238
+ uri === undefined ||
239
+ version === undefined ||
240
+ chainId === undefined ||
241
+ nonce === undefined ||
242
+ expirationTimeRaw === undefined
243
+ ) {
244
+ return {
245
+ success: true,
246
+ parsingResult: { isSecureMessage, isValidSecureMessage: false }
247
+ };
248
+ }
249
+
250
+ // Fixed-value fields must match what generateSecureMessageForSigning emits,
251
+ // and the nonce carries the same minimum length it enforces.
252
+ if (
253
+ nonce.length < 8 ||
254
+ version !== '1' ||
255
+ (chainId !== 'zano:mainnet' && chainId !== 'zano:testnet')
256
+ ) {
257
+ return {
258
+ success: true,
259
+ parsingResult: { isSecureMessage, isValidSecureMessage: false }
260
+ };
261
+ }
262
+
263
+ // Expiration Time must be a valid timestamp that has not already passed.
264
+ const expirationTime = new Date(expirationTimeRaw);
265
+ if (
266
+ Number.isNaN(expirationTime.getTime()) ||
267
+ expirationTime.getTime() <= Date.now()
268
+ ) {
269
+ return {
270
+ success: true,
271
+ parsingResult: { isSecureMessage, isValidSecureMessage: false }
272
+ };
273
+ }
274
+
275
+ return {
276
+ success: true,
277
+ parsingResult: {
278
+ isSecureMessage: true,
279
+ isValidSecureMessage: true,
280
+ values: {
281
+ domain,
282
+ address,
283
+ statement,
284
+ uri,
285
+ nonce,
286
+ expirationTime,
287
+ chainId,
288
+ version
289
+ }
290
+ }
291
+ };
292
+ }
293
+
294
+ function readVarint(buf: Uint8Array, start: number): [bigint, number] {
295
+ let result = 0n;
296
+ let shift = 0n;
297
+ let i = start;
298
+ while (true) {
299
+ const byte = buf[i++];
300
+ result |= BigInt(byte & 0x7f) << shift;
301
+ if ((byte & 0x80) === 0) {
302
+ break;
303
+ }
304
+ shift += 7n;
305
+ }
306
+ return [result, i];
307
+ }
308
+
309
+ /**
310
+ * Extracts the public spend key (`pkey`) from a Zano address.
311
+ *
312
+ * This is a pure-TS port of the decode path used by the native
313
+ * `zano-node-util` addon (`base58::decode_addr` -> parse `account_public_address`):
314
+ * 1. CryptoNote block-based base58 decode of the address.
315
+ * 2. Split the blob into `varint(prefix) | data | checksum(4)`.
316
+ * 3. Verify the checksum (first 4 bytes of keccak-256 over `prefix | data`).
317
+ * 4. Read the `spend_public_key` (first 32 bytes of `data`) as the pkey.
318
+ *
319
+ * The `pkey` accepted by the `validate_signature` daemon RPC is exactly this
320
+ * spend public key, so this can be used to bind a claimed address to a pkey.
321
+ *
322
+ * @returns The spend public key as a lowercase hex string, or `null` if the
323
+ * address is malformed (too short, checksum mismatch, or missing key).
324
+ */
325
+ export function getPkeyFromAddress({
326
+ address
327
+ }: {
328
+ address: string
329
+ }): string | null {
330
+ let blob: Uint8Array;
331
+ try {
332
+ blob = base58xmr.decode(address);
333
+ } catch {
334
+ return null;
335
+ }
336
+
337
+ // Layout: varint(prefix) | data | checksum(4)
338
+ const ADDRESS_CHECKSUM_SIZE = 4;
339
+ if (blob.length < ADDRESS_CHECKSUM_SIZE) {
340
+ return null;
341
+ }
342
+
343
+ const body = blob.subarray(0, blob.length - ADDRESS_CHECKSUM_SIZE);
344
+ const checksum = blob.subarray(blob.length - ADDRESS_CHECKSUM_SIZE);
345
+ const expectedChecksum = keccak_256(body).subarray(0, ADDRESS_CHECKSUM_SIZE);
346
+
347
+ for (let i = 0; i < ADDRESS_CHECKSUM_SIZE; i++) {
348
+ if (checksum[i] !== expectedChecksum[i]) {
349
+ return null;
350
+ }
351
+ }
352
+
353
+ // Skip the prefix varint; `account_public_address` begins with the
354
+ // 32-byte spend_public_key, followed by the 32-byte view_public_key.
355
+ const [, dataStart] = readVarint(body, 0);
356
+ const data = body.subarray(dataStart);
357
+
358
+ const PUBLIC_KEY_SIZE = 32;
359
+ if (data.length < PUBLIC_KEY_SIZE * 2) {
360
+ return null;
361
+ }
362
+
363
+ return bytesToHex(data.subarray(0, PUBLIC_KEY_SIZE));
364
+ }
@@ -1,5 +1,3 @@
1
- import zanoWallet from "./zanoWallet";
2
- import { useZanoWallet } from "./hooks";
3
- export { useZanoWallet };
1
+ import ZanoWallet from "./zano-wallet";
4
2
  export * from "./types";
5
- export { zanoWallet };
3
+ export { ZanoWallet };
package/web/dist/index.js CHANGED
@@ -1,6 +1,4 @@
1
- import zanoWallet from "./zanoWallet";
2
- import { useZanoWallet } from "./hooks";
3
- export { useZanoWallet };
1
+ import ZanoWallet from "./zano-wallet";
4
2
  export * from "./types";
5
- export { zanoWallet };
3
+ export { ZanoWallet };
6
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,cAAc,CAAC;AAEtC,OAAO,EAAC,aAAa,EAAC,MAAM,SAAS,CAAC;AACtC,OAAO,EAAC,aAAa,EAAC,CAAC;AAEvB,cAAc,SAAS,CAAC;AACxB,OAAO,EAAC,UAAU,EAAC,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,UAAU,MAAM,eAAe,CAAC;AAEvC,cAAc,SAAS,CAAC;AACxB,OAAO,EAAE,UAAU,EAAE,CAAC"}
@@ -0,0 +1,7 @@
1
+ export declare class ZanoWebError<T extends string = string> extends Error {
2
+ code: T;
3
+ constructor({ message, code }: {
4
+ message: string;
5
+ code: T;
6
+ });
7
+ }
@@ -0,0 +1,9 @@
1
+ export class ZanoWebError extends Error {
2
+ code;
3
+ constructor({ message, code }) {
4
+ super(message);
5
+ this.name = 'ZanoWebError';
6
+ this.code = code;
7
+ }
8
+ }
9
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/errors/index.ts"],"names":[],"mappings":"AAAA,MAAM,OAAO,YAAwC,SAAQ,KAAK;IAC9D,IAAI,CAAI;IAER,YAAY,EAAE,OAAO,EAAE,IAAI,EAAgC;QACvD,KAAK,CAAC,OAAO,CAAC,CAAC;QACf,IAAI,CAAC,IAAI,GAAG,cAAc,CAAC;QAE3B,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACrB,CAAC;CACJ"}
@@ -0,0 +1,4 @@
1
+ export * from './params';
2
+ export * from './responses';
3
+ export * from './errors';
4
+ export * from './special';
@@ -0,0 +1,5 @@
1
+ export * from './params';
2
+ export * from './responses';
3
+ export * from './errors';
4
+ export * from './special';
5
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,WAAW,CAAC"}
@@ -0,0 +1 @@
1
+ export { CompanionPermission, CompanionPermissionsParam, PermissionType } from './request-permissions';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/params/companion-requests/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,5 @@
1
+ export type PermissionType = 'general' | 'balance' | 'history';
2
+ export interface CompanionPermission {
3
+ type: PermissionType;
4
+ }
5
+ export type CompanionPermissionsParam = CompanionPermission[];
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/params/companion-requests/request-permissions/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1 @@
1
+ export * from './companion-requests';
@@ -0,0 +1,2 @@
1
+ export * from './companion-requests';
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/types/params/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import z from 'zod';
2
+ export declare const createAliasCompanionResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
3
+ data: z.ZodLiteral<true>;
4
+ }, z.core.$strip>, z.ZodObject<{
5
+ error: z.ZodString;
6
+ }, z.core.$strip>]>;
7
+ export type CreateAliasCompanionResponse = z.infer<typeof createAliasCompanionResponseSchema>;
8
+ export type CreateAliasResponse = {
9
+ success: true;
10
+ } | {
11
+ success: false;
12
+ error: string;
13
+ };
@@ -0,0 +1,10 @@
1
+ import z from 'zod';
2
+ export const createAliasCompanionResponseSchema = z.union([
3
+ z.object({
4
+ data: z.literal(true),
5
+ }),
6
+ z.object({
7
+ error: z.string(),
8
+ })
9
+ ]);
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/responses/companion-methods/create-alias/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,kCAAkC,GAAG,CAAC,CAAC,KAAK,CAAC;IACtD,CAAC,CAAC,MAAM,CAAC;QACL,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;KACxB,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACL,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC;CACL,CAAC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import z from 'zod';
2
+ export declare const getAddressByAliasCompanionResponseSchema: z.ZodUnion<readonly [z.ZodString, z.ZodObject<{
3
+ error: z.ZodString;
4
+ }, z.core.$strip>]>;
5
+ export type GetAddressByAliasCompanionResponse = z.infer<typeof getAddressByAliasCompanionResponseSchema>;
6
+ export type GetAddressByAliasResponse = {
7
+ success: true;
8
+ data: string;
9
+ } | {
10
+ success: false;
11
+ error: string;
12
+ };
@@ -0,0 +1,8 @@
1
+ import z from 'zod';
2
+ export const getAddressByAliasCompanionResponseSchema = z.union([
3
+ z.string(),
4
+ z.object({
5
+ error: z.string(),
6
+ })
7
+ ]);
8
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/responses/companion-methods/get-address-by-alias/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,wCAAwC,GAAG,CAAC,CAAC,KAAK,CAAC;IAC5D,CAAC,CAAC,MAAM,EAAE;IACV,CAAC,CAAC,MAAM,CAAC;QACL,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC;CACL,CAAC,CAAC"}
@@ -0,0 +1,73 @@
1
+ import z from "zod";
2
+ declare const getWalletDataCompanionResponseWalletSchema: z.ZodObject<{
3
+ address: z.ZodString;
4
+ alias: z.ZodString;
5
+ balance: z.ZodOptional<z.ZodString>;
6
+ assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
7
+ name: z.ZodString;
8
+ ticker: z.ZodString;
9
+ assetId: z.ZodString;
10
+ decimalPoint: z.ZodNumber;
11
+ balance: z.ZodString;
12
+ unlockedBalance: z.ZodString;
13
+ }, z.core.$strip>>>;
14
+ transactions: z.ZodOptional<z.ZodArray<z.ZodObject<{
15
+ isConfirmed: z.ZodBoolean;
16
+ txHash: z.ZodString;
17
+ blobSize: z.ZodCustom<number, number>;
18
+ timestamp: z.ZodCustom<number, number>;
19
+ height: z.ZodNumber;
20
+ paymentId: z.ZodCustom<string, string>;
21
+ comment: z.ZodCustom<string, string>;
22
+ fee: z.ZodCustom<string, string>;
23
+ isInitiator: z.ZodBoolean;
24
+ transfers: z.ZodArray<z.ZodObject<{
25
+ amount: z.ZodString;
26
+ assetId: z.ZodString;
27
+ incoming: z.ZodBoolean;
28
+ }, z.core.$strip>>;
29
+ }, z.core.$strip>>>;
30
+ }, z.core.$strip>;
31
+ export type GetWalletDataResponseWallet = z.infer<typeof getWalletDataCompanionResponseWalletSchema>;
32
+ export declare const getWalletDataCompanionResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
33
+ data: z.ZodObject<{
34
+ address: z.ZodString;
35
+ alias: z.ZodString;
36
+ balance: z.ZodOptional<z.ZodString>;
37
+ assets: z.ZodOptional<z.ZodArray<z.ZodObject<{
38
+ name: z.ZodString;
39
+ ticker: z.ZodString;
40
+ assetId: z.ZodString;
41
+ decimalPoint: z.ZodNumber;
42
+ balance: z.ZodString;
43
+ unlockedBalance: z.ZodString;
44
+ }, z.core.$strip>>>;
45
+ transactions: z.ZodOptional<z.ZodArray<z.ZodObject<{
46
+ isConfirmed: z.ZodBoolean;
47
+ txHash: z.ZodString;
48
+ blobSize: z.ZodCustom<number, number>;
49
+ timestamp: z.ZodCustom<number, number>;
50
+ height: z.ZodNumber;
51
+ paymentId: z.ZodCustom<string, string>;
52
+ comment: z.ZodCustom<string, string>;
53
+ fee: z.ZodCustom<string, string>;
54
+ isInitiator: z.ZodBoolean;
55
+ transfers: z.ZodArray<z.ZodObject<{
56
+ amount: z.ZodString;
57
+ assetId: z.ZodString;
58
+ incoming: z.ZodBoolean;
59
+ }, z.core.$strip>>;
60
+ }, z.core.$strip>>>;
61
+ }, z.core.$strip>;
62
+ }, z.core.$strip>, z.ZodObject<{
63
+ error: z.ZodString;
64
+ }, z.core.$strip>]>;
65
+ export type GetWalletDataCompanionResponse = z.infer<typeof getWalletDataCompanionResponseSchema>;
66
+ export type GetWalletDataResponse = {
67
+ success: true;
68
+ data: GetWalletDataResponseWallet;
69
+ } | {
70
+ success: false;
71
+ error: string;
72
+ };
73
+ export {};
@@ -0,0 +1,39 @@
1
+ import z from "zod";
2
+ const getWalletDataCompanionResponseWalletSchema = z.object({
3
+ address: z.string(),
4
+ alias: z.string(),
5
+ balance: z.string().optional(),
6
+ assets: z.array(z.object({
7
+ name: z.string(),
8
+ ticker: z.string(),
9
+ assetId: z.string(),
10
+ decimalPoint: z.number(),
11
+ balance: z.string(),
12
+ unlockedBalance: z.string(),
13
+ })).optional(),
14
+ transactions: z.array(z.object({
15
+ isConfirmed: z.boolean(),
16
+ txHash: z.string(),
17
+ blobSize: z.custom(),
18
+ timestamp: z.custom(),
19
+ height: z.number(),
20
+ paymentId: z.custom(),
21
+ comment: z.custom(),
22
+ fee: z.custom(),
23
+ isInitiator: z.boolean(),
24
+ transfers: z.array(z.object({
25
+ amount: z.string(),
26
+ assetId: z.string(),
27
+ incoming: z.boolean(),
28
+ })),
29
+ })).optional(),
30
+ });
31
+ export const getWalletDataCompanionResponseSchema = z.union([
32
+ z.object({
33
+ data: getWalletDataCompanionResponseWalletSchema,
34
+ }),
35
+ z.object({
36
+ error: z.string(),
37
+ })
38
+ ]);
39
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/responses/companion-methods/get-wallet-data/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,0CAA0C,GAAG,CAAC,CAAC,MAAM,CAAC;IACxD,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;IACnB,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;IACjB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,QAAQ,EAAE;IAC9B,MAAM,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QACrB,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,YAAY,EAAE,CAAC,CAAC,MAAM,EAAE;QACxB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;QACnB,eAAe,EAAE,CAAC,CAAC,MAAM,EAAE;KAC9B,CAAC,CAAC,CAAC,QAAQ,EAAE;IACd,YAAY,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;QAC3B,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE;QACxB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,QAAQ,EAAE,CAAC,CAAC,MAAM,EAAU;QAC5B,SAAS,EAAE,CAAC,CAAC,MAAM,EAAU;QAC7B,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;QAClB,SAAS,EAAE,CAAC,CAAC,MAAM,EAAU;QAC7B,OAAO,EAAE,CAAC,CAAC,MAAM,EAAU;QAC3B,GAAG,EAAE,CAAC,CAAC,MAAM,EAAU;QACvB,WAAW,EAAE,CAAC,CAAC,OAAO,EAAE;QACxB,SAAS,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,MAAM,CAAC;YACxB,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE;YAClB,OAAO,EAAE,CAAC,CAAC,MAAM,EAAE;YACnB,QAAQ,EAAE,CAAC,CAAC,OAAO,EAAE;SACxB,CAAC,CAAC;KACN,CAAC,CAAC,CAAC,QAAQ,EAAE;CACjB,CAAC,CAAC;AAIH,MAAM,CAAC,MAAM,oCAAoC,GAAG,CAAC,CAAC,KAAK,CAAC;IACxD,CAAC,CAAC,MAAM,CAAC;QACL,IAAI,EAAE,0CAA0C;KACnD,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACL,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC;CACL,CAAC,CAAC"}
@@ -0,0 +1,5 @@
1
+ export { RequestPermissionsResponse } from './request-permissions';
2
+ export { GetWalletDataResponse, GetWalletDataResponseWallet } from './get-wallet-data';
3
+ export { GetAddressByAliasResponse } from './get-address-by-alias';
4
+ export { CreateAliasResponse } from './create-alias';
5
+ export { RequestMessageSignResponse, RequestMessageSignData } from './request-message-sign';
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/types/responses/companion-methods/index.ts"],"names":[],"mappings":""}
@@ -0,0 +1,23 @@
1
+ import z from 'zod';
2
+ export declare const requestMessageSignCompanionResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
3
+ data: z.ZodObject<{
4
+ result: z.ZodObject<{
5
+ pkey: z.ZodString;
6
+ sig: z.ZodString;
7
+ }, z.core.$strip>;
8
+ }, z.core.$strip>;
9
+ }, z.core.$strip>, z.ZodObject<{
10
+ error: z.ZodString;
11
+ }, z.core.$strip>]>;
12
+ export type RequestMessageSignCompanionResponse = z.infer<typeof requestMessageSignCompanionResponseSchema>;
13
+ export type RequestMessageSignData = {
14
+ pkey: string;
15
+ sig: string;
16
+ };
17
+ export type RequestMessageSignResponse = {
18
+ success: true;
19
+ data: RequestMessageSignData;
20
+ } | {
21
+ success: false;
22
+ error: string;
23
+ };
@@ -0,0 +1,16 @@
1
+ import z from 'zod';
2
+ const requestMessageSignCompanionResponseDataSchema = z.object({
3
+ result: z.object({
4
+ pkey: z.string(),
5
+ sig: z.string(),
6
+ })
7
+ });
8
+ export const requestMessageSignCompanionResponseSchema = z.union([
9
+ z.object({
10
+ data: requestMessageSignCompanionResponseDataSchema,
11
+ }),
12
+ z.object({
13
+ error: z.string(),
14
+ })
15
+ ]);
16
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/responses/companion-methods/request-message-sign/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,6CAA6C,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7D,MAAM,EAAE,CAAC,CAAC,MAAM,CAAC;QACf,IAAI,EAAE,CAAC,CAAC,MAAM,EAAE;QAChB,GAAG,EAAE,CAAC,CAAC,MAAM,EAAE;KAChB,CAAC;CACH,CAAC,CAAC;AAEH,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,CAAC,KAAK,CAAC;IAC7D,CAAC,CAAC,MAAM,CAAC;QACL,IAAI,EAAE,6CAA6C;KACtD,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACL,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC;CACL,CAAC,CAAC"}
@@ -0,0 +1,13 @@
1
+ import z from 'zod';
2
+ export declare const requestPermissionsCompanionResponseSchema: z.ZodUnion<readonly [z.ZodObject<{
3
+ success: z.ZodLiteral<true>;
4
+ }, z.core.$strip>, z.ZodObject<{
5
+ error: z.ZodString;
6
+ }, z.core.$strip>]>;
7
+ export type RequestPermissionsCompanionResponse = z.infer<typeof requestPermissionsCompanionResponseSchema>;
8
+ export type RequestPermissionsResponse = {
9
+ success: true;
10
+ } | {
11
+ success: false;
12
+ error: string;
13
+ };
@@ -0,0 +1,10 @@
1
+ import z from 'zod';
2
+ export const requestPermissionsCompanionResponseSchema = z.union([
3
+ z.object({
4
+ success: z.literal(true),
5
+ }),
6
+ z.object({
7
+ error: z.string(),
8
+ })
9
+ ]);
10
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/types/responses/companion-methods/request-permissions/index.ts"],"names":[],"mappings":"AAAA,OAAO,CAAC,MAAM,KAAK,CAAC;AAEpB,MAAM,CAAC,MAAM,yCAAyC,GAAG,CAAC,CAAC,KAAK,CAAC;IAC7D,CAAC,CAAC,MAAM,CAAC;QACL,OAAO,EAAE,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC;KAC3B,CAAC;IACF,CAAC,CAAC,MAAM,CAAC;QACL,KAAK,EAAE,CAAC,CAAC,MAAM,EAAE;KACpB,CAAC;CACL,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export * from './companion-methods';
@@ -0,0 +1,2 @@
1
+ export * from './companion-methods';
2
+ //# sourceMappingURL=index.js.map