@coopenomics/sdk 2.2.2 → 2.2.4

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.cjs CHANGED
@@ -11,6 +11,158 @@ function _interopDefaultCompat (e) { return e && typeof e === 'object' && 'defau
11
11
 
12
12
  const WebSocket__default = /*#__PURE__*/_interopDefaultCompat(WebSocket);
13
13
 
14
+ var __defProp$2 = Object.defineProperty;
15
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16
+ var __publicField$2 = (obj, key, value) => {
17
+ __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
18
+ return value;
19
+ };
20
+ class Account {
21
+ constructor() {
22
+ __publicField$2(this, "username");
23
+ __publicField$2(this, "private_key");
24
+ __publicField$2(this, "public_key");
25
+ this.username = Account.generateUsername();
26
+ const keys = Account.generateKeys();
27
+ this.private_key = keys.private_key;
28
+ this.public_key = keys.public_key;
29
+ }
30
+ /**
31
+ * Генерирует случайное имя длиной 12 символов, состоящее только из букв.
32
+ * @returns Случайное имя.
33
+ */
34
+ static generateUsername() {
35
+ let result = "";
36
+ const possible = "abcdefghijklmnopqrstuvwxyz";
37
+ for (let i = 0; i < 12; i++) {
38
+ result += possible.charAt(Math.floor(Math.random() * possible.length));
39
+ }
40
+ return result;
41
+ }
42
+ /**
43
+ * Генерирует пару ключей (приватный и публичный) с использованием библиотеки @wharfkit/antelope.
44
+ * @returns Объект с приватным и публичным ключами.
45
+ */
46
+ static generateKeys() {
47
+ const private_key_data = antelope.PrivateKey.generate("K1");
48
+ const public_key = private_key_data.toPublic().toString();
49
+ const private_key = private_key_data.toWif();
50
+ return {
51
+ private_key,
52
+ public_key
53
+ };
54
+ }
55
+ }
56
+
57
+ var __defProp$1 = Object.defineProperty;
58
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
59
+ var __publicField$1 = (obj, key, value) => {
60
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
61
+ return value;
62
+ };
63
+ class Canvas {
64
+ constructor(container, opts = {}) {
65
+ this.container = container;
66
+ this.opts = opts;
67
+ __publicField$1(this, "canvas");
68
+ __publicField$1(this, "ctx");
69
+ __publicField$1(this, "drawing", false);
70
+ __publicField$1(this, "lastX", 0);
71
+ __publicField$1(this, "lastY", 0);
72
+ __publicField$1(this, "onMouseDown", (e) => {
73
+ e.preventDefault();
74
+ this.drawing = true;
75
+ const rect = this.canvas.getBoundingClientRect();
76
+ this.lastX = e.clientX - rect.left;
77
+ this.lastY = e.clientY - rect.top;
78
+ });
79
+ __publicField$1(this, "onMouseMove", (e) => {
80
+ if (!this.drawing)
81
+ return;
82
+ e.preventDefault();
83
+ this.drawLine(e.clientX, e.clientY);
84
+ });
85
+ __publicField$1(this, "onMouseUp", () => {
86
+ this.drawing = false;
87
+ });
88
+ __publicField$1(this, "onTouchStart", (e) => {
89
+ e.preventDefault();
90
+ this.drawing = true;
91
+ const rect = this.canvas.getBoundingClientRect();
92
+ this.lastX = e.touches[0].clientX - rect.left;
93
+ this.lastY = e.touches[0].clientY - rect.top;
94
+ });
95
+ __publicField$1(this, "onTouchMove", (e) => {
96
+ if (!this.drawing)
97
+ return;
98
+ e.preventDefault();
99
+ const t = e.touches[0];
100
+ this.drawLine(t.clientX, t.clientY);
101
+ });
102
+ __publicField$1(this, "onTouchEnd", () => {
103
+ this.drawing = false;
104
+ });
105
+ this.canvas = document.createElement("canvas");
106
+ this.canvas.width = container.offsetWidth;
107
+ this.canvas.height = container.offsetHeight;
108
+ this.canvas.style.touchAction = "none";
109
+ container.appendChild(this.canvas);
110
+ const ctx = this.canvas.getContext("2d");
111
+ if (!ctx) {
112
+ throw new Error("Canvas not supported");
113
+ }
114
+ this.ctx = ctx;
115
+ this.ctx.lineWidth = this.opts.lineWidth ?? 5;
116
+ this.ctx.lineJoin = "round";
117
+ this.ctx.lineCap = "round";
118
+ this.ctx.strokeStyle = this.opts.strokeStyle ?? "#000";
119
+ this.initEvents();
120
+ }
121
+ /**
122
+ * Очистка холста.
123
+ */
124
+ clearCanvas() {
125
+ this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
126
+ }
127
+ /**
128
+ * Получение подписи в формате base64.
129
+ */
130
+ getSignature() {
131
+ return this.canvas.toDataURL("image/png");
132
+ }
133
+ /**
134
+ * Снятие всех слушателей.
135
+ */
136
+ destroy() {
137
+ this.canvas.removeEventListener("mousedown", this.onMouseDown);
138
+ this.canvas.removeEventListener("mousemove", this.onMouseMove);
139
+ this.canvas.removeEventListener("mouseup", this.onMouseUp);
140
+ this.canvas.removeEventListener("touchstart", this.onTouchStart);
141
+ this.canvas.removeEventListener("touchmove", this.onTouchMove);
142
+ this.canvas.removeEventListener("touchend", this.onTouchEnd);
143
+ }
144
+ // Внутренние методы
145
+ initEvents() {
146
+ this.canvas.addEventListener("mousedown", this.onMouseDown);
147
+ this.canvas.addEventListener("mousemove", this.onMouseMove);
148
+ this.canvas.addEventListener("mouseup", this.onMouseUp);
149
+ this.canvas.addEventListener("touchstart", this.onTouchStart, { passive: false });
150
+ this.canvas.addEventListener("touchmove", this.onTouchMove, { passive: false });
151
+ this.canvas.addEventListener("touchend", this.onTouchEnd, { passive: false });
152
+ }
153
+ drawLine(clientX, clientY) {
154
+ this.ctx.beginPath();
155
+ this.ctx.moveTo(this.lastX, this.lastY);
156
+ const rect = this.canvas.getBoundingClientRect();
157
+ const x = clientX - rect.left;
158
+ const y = clientY - rect.top;
159
+ this.ctx.lineTo(x, y);
160
+ this.ctx.stroke();
161
+ this.lastX = x;
162
+ this.lastY = y;
163
+ }
164
+ }
165
+
14
166
  var __defProp = Object.defineProperty;
15
167
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
16
168
  var __publicField = (obj, key, value) => {
@@ -103,6 +255,8 @@ class Wallet {
103
255
 
104
256
  const Classes = {
105
257
  __proto__: null,
258
+ Account: Account,
259
+ Canvas: Canvas,
106
260
  Wallet: Wallet
107
261
  };
108
262
 
@@ -1373,12 +1527,22 @@ const Gql = Chain(HOST, {
1373
1527
  const ZeusScalars = ZeusSelect();
1374
1528
  const fields = (k) => {
1375
1529
  const t = ReturnTypes[k];
1530
+ const fnType = k in AllTypesProps ? AllTypesProps[k] : void 0;
1531
+ const hasFnTypes = typeof fnType === "object" ? fnType : void 0;
1376
1532
  const o = Object.fromEntries(
1377
- Object.entries(t).filter(([, value]) => {
1533
+ Object.entries(t).filter(([k2, value]) => {
1534
+ const isFunctionType = hasFnTypes && k2 in hasFnTypes && !!hasFnTypes[k2];
1535
+ if (isFunctionType)
1536
+ return false;
1378
1537
  const isReturnType = ReturnTypes[value];
1379
- if (!isReturnType || typeof isReturnType === "string" && isReturnType.startsWith("scalar.")) {
1538
+ if (!isReturnType)
1539
+ return true;
1540
+ if (typeof isReturnType !== "string")
1541
+ return false;
1542
+ if (isReturnType.startsWith("scalar.")) {
1380
1543
  return true;
1381
1544
  }
1545
+ return false;
1382
1546
  }).map(([key]) => [key, true])
1383
1547
  );
1384
1548
  return o;
@@ -3147,6 +3311,14 @@ if (typeof globalThis.WebSocket === "undefined") {
3147
3311
  globalThis.WebSocket = WebSocket__default;
3148
3312
  }
3149
3313
  let currentHeaders = {};
3314
+ const scalars = ZeusScalars({
3315
+ DateTime: {
3316
+ decode: (e) => new Date(e),
3317
+ // Преобразует строку в объект Date
3318
+ encode: (e) => e.toISOString()
3319
+ // Преобразует Date в ISO-строку
3320
+ }
3321
+ });
3150
3322
  function createThunder(baseUrl) {
3151
3323
  return Thunder(async (query, variables) => {
3152
3324
  const response = await fetch(baseUrl, {
@@ -3175,7 +3347,7 @@ function createThunder(baseUrl) {
3175
3347
  throw json.errors;
3176
3348
  }
3177
3349
  return json.data;
3178
- });
3350
+ }, { scalars });
3179
3351
  }
3180
3352
  function createClient(options) {
3181
3353
  currentHeaders = options.headers || {};
package/dist/index.d.cts CHANGED
@@ -50,9 +50,10 @@ declare const Gql: <O extends keyof typeof Ops, OVERRIDESCLR extends ScalarDefin
50
50
  variables?: Record<string, unknown>;
51
51
  }) => Promise<InputType<GraphQLTypes[R], Z, UnionOverrideKeys<ScalarDefinition, OVERRIDESCLR>>>;
52
52
  declare const ZeusScalars: SelectionFunction<ScalarCoders>;
53
+ type BaseSymbol = number | string | undefined | boolean | null;
53
54
  type ScalarsSelector<T> = {
54
55
  [X in Required<{
55
- [P in keyof T]: T[P] extends number | string | undefined | boolean ? P : never;
56
+ [P in keyof T]: T[P] extends BaseSymbol | Array<BaseSymbol> ? P : never;
56
57
  }>[keyof T]]: true;
57
58
  };
58
59
  declare const fields: <T extends keyof ModelTypes>(k: T) => ScalarsSelector<ModelTypes[T]>;
@@ -300,6 +301,7 @@ type ValueTypes = {
300
301
  totalPages?: boolean | `@${string}`;
301
302
  __typename?: boolean | `@${string}`;
302
303
  }>;
304
+ /** Массив комплексных актов, содержащих полную информацию о сгенерированном и опубликованном документах */
303
305
  ["ActDetail"]: AliasType<{
304
306
  action?: ValueTypes["ExtendedBlockchainAction"];
305
307
  document?: ValueTypes["GeneratedDocument"];
@@ -951,15 +953,15 @@ type ValueTypes = {
951
953
  __typename?: boolean | `@${string}`;
952
954
  }>;
953
955
  ["ExtensionInput"]: {
954
- /** Configuration settings for the extension */
956
+ /** Объект конфигурации расширения */
955
957
  config: ValueTypes["JSON"] | Variable<any, string>;
956
- /** Timestamp of when the extension was created */
958
+ /** Дата установки расширения */
957
959
  created_at?: ValueTypes["DateTime"] | undefined | null | Variable<any, string>;
958
- /** Indicates whether the extension is enabled */
960
+ /** Флаг того, включено ли расширение сейчас */
959
961
  enabled: boolean | Variable<any, string>;
960
- /** Unique name of the extension */
962
+ /** Уникальное имя расширения (является идентификатором) */
961
963
  name: string | Variable<any, string>;
962
- /** Timestamp of the last update to the extension */
964
+ /** Дата обновления расширения */
963
965
  updated_at?: ValueTypes["DateTime"] | undefined | null | Variable<any, string>;
964
966
  };
965
967
  ["FreeDecisionDocument"]: AliasType<{
@@ -2454,6 +2456,7 @@ type ResolverInputTypes = {
2454
2456
  totalPages?: boolean | `@${string}`;
2455
2457
  __typename?: boolean | `@${string}`;
2456
2458
  }>;
2459
+ /** Массив комплексных актов, содержащих полную информацию о сгенерированном и опубликованном документах */
2457
2460
  ["ActDetail"]: AliasType<{
2458
2461
  action?: ResolverInputTypes["ExtendedBlockchainAction"];
2459
2462
  document?: ResolverInputTypes["GeneratedDocument"];
@@ -3105,15 +3108,15 @@ type ResolverInputTypes = {
3105
3108
  __typename?: boolean | `@${string}`;
3106
3109
  }>;
3107
3110
  ["ExtensionInput"]: {
3108
- /** Configuration settings for the extension */
3111
+ /** Объект конфигурации расширения */
3109
3112
  config: ResolverInputTypes["JSON"];
3110
- /** Timestamp of when the extension was created */
3113
+ /** Дата установки расширения */
3111
3114
  created_at?: ResolverInputTypes["DateTime"] | undefined | null;
3112
- /** Indicates whether the extension is enabled */
3115
+ /** Флаг того, включено ли расширение сейчас */
3113
3116
  enabled: boolean;
3114
- /** Unique name of the extension */
3117
+ /** Уникальное имя расширения (является идентификатором) */
3115
3118
  name: string;
3116
- /** Timestamp of the last update to the extension */
3119
+ /** Дата обновления расширения */
3117
3120
  updated_at?: ResolverInputTypes["DateTime"] | undefined | null;
3118
3121
  };
3119
3122
  ["FreeDecisionDocument"]: AliasType<{
@@ -4608,6 +4611,7 @@ type ModelTypes = {
4608
4611
  /** Общее количество страниц */
4609
4612
  totalPages: number;
4610
4613
  };
4614
+ /** Массив комплексных актов, содержащих полную информацию о сгенерированном и опубликованном документах */
4611
4615
  ["ActDetail"]: {
4612
4616
  action?: ModelTypes["ExtendedBlockchainAction"] | undefined | null;
4613
4617
  document?: ModelTypes["GeneratedDocument"] | undefined | null;
@@ -5229,15 +5233,15 @@ type ModelTypes = {
5229
5233
  updated_at: ModelTypes["DateTime"];
5230
5234
  };
5231
5235
  ["ExtensionInput"]: {
5232
- /** Configuration settings for the extension */
5236
+ /** Объект конфигурации расширения */
5233
5237
  config: ModelTypes["JSON"];
5234
- /** Timestamp of when the extension was created */
5238
+ /** Дата установки расширения */
5235
5239
  created_at?: ModelTypes["DateTime"] | undefined | null;
5236
- /** Indicates whether the extension is enabled */
5240
+ /** Флаг того, включено ли расширение сейчас */
5237
5241
  enabled: boolean;
5238
- /** Unique name of the extension */
5242
+ /** Уникальное имя расширения (является идентификатором) */
5239
5243
  name: string;
5240
- /** Timestamp of the last update to the extension */
5244
+ /** Дата обновления расширения */
5241
5245
  updated_at?: ModelTypes["DateTime"] | undefined | null;
5242
5246
  };
5243
5247
  ["FreeDecisionDocument"]: {
@@ -6613,6 +6617,7 @@ type GraphQLTypes = {
6613
6617
  /** Общее количество страниц */
6614
6618
  totalPages: number;
6615
6619
  };
6620
+ /** Массив комплексных актов, содержащих полную информацию о сгенерированном и опубликованном документах */
6616
6621
  ["ActDetail"]: {
6617
6622
  __typename: "ActDetail";
6618
6623
  action?: GraphQLTypes["ExtendedBlockchainAction"] | undefined | null;
@@ -7266,15 +7271,15 @@ type GraphQLTypes = {
7266
7271
  updated_at: GraphQLTypes["DateTime"];
7267
7272
  };
7268
7273
  ["ExtensionInput"]: {
7269
- /** Configuration settings for the extension */
7274
+ /** Объект конфигурации расширения */
7270
7275
  config: GraphQLTypes["JSON"];
7271
- /** Timestamp of when the extension was created */
7276
+ /** Дата установки расширения */
7272
7277
  created_at?: GraphQLTypes["DateTime"] | undefined | null;
7273
- /** Indicates whether the extension is enabled */
7278
+ /** Флаг того, включено ли расширение сейчас */
7274
7279
  enabled: boolean;
7275
- /** Unique name of the extension */
7280
+ /** Уникальное имя расширения (является идентификатором) */
7276
7281
  name: string;
7277
- /** Timestamp of the last update to the extension */
7282
+ /** Дата обновления расширения */
7278
7283
  updated_at?: GraphQLTypes["DateTime"] | undefined | null;
7279
7284
  };
7280
7285
  ["FreeDecisionDocument"]: {
@@ -9081,6 +9086,71 @@ declare namespace index$j {
9081
9086
  export type { index$j_AccountResourceInfo as AccountResourceInfo, index$j_Authority as Authority, index$j_BlockchainAccountInterface as BlockchainAccountInterface, index$j_BlockchainConfig as BlockchainConfig, index$j_ClientConnectionOptions as ClientConnectionOptions, index$j_DeserializedDescriptionOfExtension as DeserializedDescriptionOfExtension, index$j_GetInfoResult as GetInfoResult, index$j_IndexPosition as IndexPosition, index$j_KeyWeight as KeyWeight, index$j_Permission as Permission, index$j_PermissionLevel as PermissionLevel, index$j_PermissionLevelWeight as PermissionLevelWeight, index$j_RefundRequest as RefundRequest, index$j_ResourceDelegation as ResourceDelegation, index$j_ResourceOverview as ResourceOverview, index$j_WaitWeight as WaitWeight };
9082
9087
  }
9083
9088
 
9089
+ /**
9090
+ * Класс `Account` генерирует объект с именем, приватным и публичным ключами.
9091
+ *
9092
+ * @example
9093
+ * ```ts
9094
+ * const account = new Account();
9095
+ * console.log(account);
9096
+ * // {
9097
+ * // name: "abcdxyzuvwrs",
9098
+ * // privateKey: "5JxyzABC1234567890defGHIJKLMNopqRSTUV",
9099
+ * // publicKey: "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5SozEZ8i8jUBS6yX79y6"
9100
+ * // }
9101
+ * ```
9102
+ */
9103
+ declare class Account {
9104
+ username: string;
9105
+ private_key: string;
9106
+ public_key: string;
9107
+ constructor();
9108
+ /**
9109
+ * Генерирует случайное имя длиной 12 символов, состоящее только из букв.
9110
+ * @returns Случайное имя.
9111
+ */
9112
+ private static generateUsername;
9113
+ /**
9114
+ * Генерирует пару ключей (приватный и публичный) с использованием библиотеки @wharfkit/antelope.
9115
+ * @returns Объект с приватным и публичным ключами.
9116
+ */
9117
+ private static generateKeys;
9118
+ }
9119
+
9120
+ declare class Canvas {
9121
+ private container;
9122
+ private opts;
9123
+ canvas: HTMLCanvasElement;
9124
+ ctx: CanvasRenderingContext2D;
9125
+ private drawing;
9126
+ private lastX;
9127
+ private lastY;
9128
+ constructor(container: HTMLElement, opts?: {
9129
+ lineWidth?: number;
9130
+ strokeStyle?: string;
9131
+ });
9132
+ /**
9133
+ * Очистка холста.
9134
+ */
9135
+ clearCanvas(): void;
9136
+ /**
9137
+ * Получение подписи в формате base64.
9138
+ */
9139
+ getSignature(): string;
9140
+ /**
9141
+ * Снятие всех слушателей.
9142
+ */
9143
+ destroy(): void;
9144
+ private initEvents;
9145
+ private onMouseDown;
9146
+ private onMouseMove;
9147
+ private onMouseUp;
9148
+ private onTouchStart;
9149
+ private onTouchMove;
9150
+ private onTouchEnd;
9151
+ private drawLine;
9152
+ }
9153
+
9084
9154
  /**
9085
9155
  * Описание класса будет здесь
9086
9156
  */
@@ -9112,10 +9182,14 @@ declare class Wallet {
9112
9182
  private createTable;
9113
9183
  }
9114
9184
 
9185
+ type Classes_Account = Account;
9186
+ declare const Classes_Account: typeof Account;
9187
+ type Classes_Canvas = Canvas;
9188
+ declare const Classes_Canvas: typeof Canvas;
9115
9189
  type Classes_Wallet = Wallet;
9116
9190
  declare const Classes_Wallet: typeof Wallet;
9117
9191
  declare namespace Classes {
9118
- export { Classes_Wallet as Wallet };
9192
+ export { Classes_Account as Account, Classes_Canvas as Canvas, Classes_Wallet as Wallet };
9119
9193
  }
9120
9194
 
9121
9195
  declare const name$J = "installExtension";
@@ -14060,7 +14134,17 @@ declare function createClient(options: ClientConnectionOptions): {
14060
14134
  getPaymentMethods: GraphQLTypes["PaymentMethodPaginationResult"];
14061
14135
  getPayments: GraphQLTypes["PaymentPaginationResult"];
14062
14136
  getSystemInfo: GraphQLTypes["SystemInfo"];
14063
- }, Z, Omit<ScalarDefinition, string> & ScalarDefinition>>;
14137
+ }, Z, Omit<{
14138
+ DateTime: {
14139
+ decode: (e: unknown) => Date;
14140
+ encode: (e: unknown) => string;
14141
+ };
14142
+ }, "DateTime"> & {
14143
+ DateTime: {
14144
+ decode: (e: unknown) => Date;
14145
+ encode: (e: unknown) => string;
14146
+ };
14147
+ }>>;
14064
14148
  Mutation: <Z extends AliasType<{
14065
14149
  addParticipant?: [{
14066
14150
  data: ValueTypes["AddParticipantInput"] | Variable<any, string>;
@@ -14236,7 +14320,17 @@ declare function createClient(options: ClientConnectionOptions): {
14236
14320
  updateBankAccount: GraphQLTypes["PaymentMethod"];
14237
14321
  updateExtension: GraphQLTypes["Extension"];
14238
14322
  updateSystem: GraphQLTypes["SystemInfo"];
14239
- }, Z, Omit<ScalarDefinition, string> & ScalarDefinition>>;
14323
+ }, Z, Omit<{
14324
+ DateTime: {
14325
+ decode: (e: unknown) => Date;
14326
+ encode: (e: unknown) => string;
14327
+ };
14328
+ }, "DateTime"> & {
14329
+ DateTime: {
14330
+ decode: (e: unknown) => Date;
14331
+ encode: (e: unknown) => string;
14332
+ };
14333
+ }>>;
14240
14334
  Subscription: <O extends keyof typeof Ops, OVERRIDESCLR extends ScalarDefinition, R extends keyof ValueTypes = GenericOperation<O>>(operation: O, graphqlOptions?: ThunderGraphQLOptions<OVERRIDESCLR> | undefined) => <Z extends ValueTypes[R]>(o: Z & { [P in keyof Z]: P extends keyof ValueTypes[R] ? Z[P] : never; }, ops?: (OperationOptions & {
14241
14335
  variables?: ExtractVariables<Z> | undefined;
14242
14336
  }) | undefined) => SubscriptionToGraphQL<Z, GraphQLTypes[R], Omit<ScalarDefinition, keyof OVERRIDESCLR> & OVERRIDESCLR>;
package/dist/index.d.mts CHANGED
@@ -50,9 +50,10 @@ declare const Gql: <O extends keyof typeof Ops, OVERRIDESCLR extends ScalarDefin
50
50
  variables?: Record<string, unknown>;
51
51
  }) => Promise<InputType<GraphQLTypes[R], Z, UnionOverrideKeys<ScalarDefinition, OVERRIDESCLR>>>;
52
52
  declare const ZeusScalars: SelectionFunction<ScalarCoders>;
53
+ type BaseSymbol = number | string | undefined | boolean | null;
53
54
  type ScalarsSelector<T> = {
54
55
  [X in Required<{
55
- [P in keyof T]: T[P] extends number | string | undefined | boolean ? P : never;
56
+ [P in keyof T]: T[P] extends BaseSymbol | Array<BaseSymbol> ? P : never;
56
57
  }>[keyof T]]: true;
57
58
  };
58
59
  declare const fields: <T extends keyof ModelTypes>(k: T) => ScalarsSelector<ModelTypes[T]>;
@@ -300,6 +301,7 @@ type ValueTypes = {
300
301
  totalPages?: boolean | `@${string}`;
301
302
  __typename?: boolean | `@${string}`;
302
303
  }>;
304
+ /** Массив комплексных актов, содержащих полную информацию о сгенерированном и опубликованном документах */
303
305
  ["ActDetail"]: AliasType<{
304
306
  action?: ValueTypes["ExtendedBlockchainAction"];
305
307
  document?: ValueTypes["GeneratedDocument"];
@@ -951,15 +953,15 @@ type ValueTypes = {
951
953
  __typename?: boolean | `@${string}`;
952
954
  }>;
953
955
  ["ExtensionInput"]: {
954
- /** Configuration settings for the extension */
956
+ /** Объект конфигурации расширения */
955
957
  config: ValueTypes["JSON"] | Variable<any, string>;
956
- /** Timestamp of when the extension was created */
958
+ /** Дата установки расширения */
957
959
  created_at?: ValueTypes["DateTime"] | undefined | null | Variable<any, string>;
958
- /** Indicates whether the extension is enabled */
960
+ /** Флаг того, включено ли расширение сейчас */
959
961
  enabled: boolean | Variable<any, string>;
960
- /** Unique name of the extension */
962
+ /** Уникальное имя расширения (является идентификатором) */
961
963
  name: string | Variable<any, string>;
962
- /** Timestamp of the last update to the extension */
964
+ /** Дата обновления расширения */
963
965
  updated_at?: ValueTypes["DateTime"] | undefined | null | Variable<any, string>;
964
966
  };
965
967
  ["FreeDecisionDocument"]: AliasType<{
@@ -2454,6 +2456,7 @@ type ResolverInputTypes = {
2454
2456
  totalPages?: boolean | `@${string}`;
2455
2457
  __typename?: boolean | `@${string}`;
2456
2458
  }>;
2459
+ /** Массив комплексных актов, содержащих полную информацию о сгенерированном и опубликованном документах */
2457
2460
  ["ActDetail"]: AliasType<{
2458
2461
  action?: ResolverInputTypes["ExtendedBlockchainAction"];
2459
2462
  document?: ResolverInputTypes["GeneratedDocument"];
@@ -3105,15 +3108,15 @@ type ResolverInputTypes = {
3105
3108
  __typename?: boolean | `@${string}`;
3106
3109
  }>;
3107
3110
  ["ExtensionInput"]: {
3108
- /** Configuration settings for the extension */
3111
+ /** Объект конфигурации расширения */
3109
3112
  config: ResolverInputTypes["JSON"];
3110
- /** Timestamp of when the extension was created */
3113
+ /** Дата установки расширения */
3111
3114
  created_at?: ResolverInputTypes["DateTime"] | undefined | null;
3112
- /** Indicates whether the extension is enabled */
3115
+ /** Флаг того, включено ли расширение сейчас */
3113
3116
  enabled: boolean;
3114
- /** Unique name of the extension */
3117
+ /** Уникальное имя расширения (является идентификатором) */
3115
3118
  name: string;
3116
- /** Timestamp of the last update to the extension */
3119
+ /** Дата обновления расширения */
3117
3120
  updated_at?: ResolverInputTypes["DateTime"] | undefined | null;
3118
3121
  };
3119
3122
  ["FreeDecisionDocument"]: AliasType<{
@@ -4608,6 +4611,7 @@ type ModelTypes = {
4608
4611
  /** Общее количество страниц */
4609
4612
  totalPages: number;
4610
4613
  };
4614
+ /** Массив комплексных актов, содержащих полную информацию о сгенерированном и опубликованном документах */
4611
4615
  ["ActDetail"]: {
4612
4616
  action?: ModelTypes["ExtendedBlockchainAction"] | undefined | null;
4613
4617
  document?: ModelTypes["GeneratedDocument"] | undefined | null;
@@ -5229,15 +5233,15 @@ type ModelTypes = {
5229
5233
  updated_at: ModelTypes["DateTime"];
5230
5234
  };
5231
5235
  ["ExtensionInput"]: {
5232
- /** Configuration settings for the extension */
5236
+ /** Объект конфигурации расширения */
5233
5237
  config: ModelTypes["JSON"];
5234
- /** Timestamp of when the extension was created */
5238
+ /** Дата установки расширения */
5235
5239
  created_at?: ModelTypes["DateTime"] | undefined | null;
5236
- /** Indicates whether the extension is enabled */
5240
+ /** Флаг того, включено ли расширение сейчас */
5237
5241
  enabled: boolean;
5238
- /** Unique name of the extension */
5242
+ /** Уникальное имя расширения (является идентификатором) */
5239
5243
  name: string;
5240
- /** Timestamp of the last update to the extension */
5244
+ /** Дата обновления расширения */
5241
5245
  updated_at?: ModelTypes["DateTime"] | undefined | null;
5242
5246
  };
5243
5247
  ["FreeDecisionDocument"]: {
@@ -6613,6 +6617,7 @@ type GraphQLTypes = {
6613
6617
  /** Общее количество страниц */
6614
6618
  totalPages: number;
6615
6619
  };
6620
+ /** Массив комплексных актов, содержащих полную информацию о сгенерированном и опубликованном документах */
6616
6621
  ["ActDetail"]: {
6617
6622
  __typename: "ActDetail";
6618
6623
  action?: GraphQLTypes["ExtendedBlockchainAction"] | undefined | null;
@@ -7266,15 +7271,15 @@ type GraphQLTypes = {
7266
7271
  updated_at: GraphQLTypes["DateTime"];
7267
7272
  };
7268
7273
  ["ExtensionInput"]: {
7269
- /** Configuration settings for the extension */
7274
+ /** Объект конфигурации расширения */
7270
7275
  config: GraphQLTypes["JSON"];
7271
- /** Timestamp of when the extension was created */
7276
+ /** Дата установки расширения */
7272
7277
  created_at?: GraphQLTypes["DateTime"] | undefined | null;
7273
- /** Indicates whether the extension is enabled */
7278
+ /** Флаг того, включено ли расширение сейчас */
7274
7279
  enabled: boolean;
7275
- /** Unique name of the extension */
7280
+ /** Уникальное имя расширения (является идентификатором) */
7276
7281
  name: string;
7277
- /** Timestamp of the last update to the extension */
7282
+ /** Дата обновления расширения */
7278
7283
  updated_at?: GraphQLTypes["DateTime"] | undefined | null;
7279
7284
  };
7280
7285
  ["FreeDecisionDocument"]: {
@@ -9081,6 +9086,71 @@ declare namespace index$j {
9081
9086
  export type { index$j_AccountResourceInfo as AccountResourceInfo, index$j_Authority as Authority, index$j_BlockchainAccountInterface as BlockchainAccountInterface, index$j_BlockchainConfig as BlockchainConfig, index$j_ClientConnectionOptions as ClientConnectionOptions, index$j_DeserializedDescriptionOfExtension as DeserializedDescriptionOfExtension, index$j_GetInfoResult as GetInfoResult, index$j_IndexPosition as IndexPosition, index$j_KeyWeight as KeyWeight, index$j_Permission as Permission, index$j_PermissionLevel as PermissionLevel, index$j_PermissionLevelWeight as PermissionLevelWeight, index$j_RefundRequest as RefundRequest, index$j_ResourceDelegation as ResourceDelegation, index$j_ResourceOverview as ResourceOverview, index$j_WaitWeight as WaitWeight };
9082
9087
  }
9083
9088
 
9089
+ /**
9090
+ * Класс `Account` генерирует объект с именем, приватным и публичным ключами.
9091
+ *
9092
+ * @example
9093
+ * ```ts
9094
+ * const account = new Account();
9095
+ * console.log(account);
9096
+ * // {
9097
+ * // name: "abcdxyzuvwrs",
9098
+ * // privateKey: "5JxyzABC1234567890defGHIJKLMNopqRSTUV",
9099
+ * // publicKey: "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5SozEZ8i8jUBS6yX79y6"
9100
+ * // }
9101
+ * ```
9102
+ */
9103
+ declare class Account {
9104
+ username: string;
9105
+ private_key: string;
9106
+ public_key: string;
9107
+ constructor();
9108
+ /**
9109
+ * Генерирует случайное имя длиной 12 символов, состоящее только из букв.
9110
+ * @returns Случайное имя.
9111
+ */
9112
+ private static generateUsername;
9113
+ /**
9114
+ * Генерирует пару ключей (приватный и публичный) с использованием библиотеки @wharfkit/antelope.
9115
+ * @returns Объект с приватным и публичным ключами.
9116
+ */
9117
+ private static generateKeys;
9118
+ }
9119
+
9120
+ declare class Canvas {
9121
+ private container;
9122
+ private opts;
9123
+ canvas: HTMLCanvasElement;
9124
+ ctx: CanvasRenderingContext2D;
9125
+ private drawing;
9126
+ private lastX;
9127
+ private lastY;
9128
+ constructor(container: HTMLElement, opts?: {
9129
+ lineWidth?: number;
9130
+ strokeStyle?: string;
9131
+ });
9132
+ /**
9133
+ * Очистка холста.
9134
+ */
9135
+ clearCanvas(): void;
9136
+ /**
9137
+ * Получение подписи в формате base64.
9138
+ */
9139
+ getSignature(): string;
9140
+ /**
9141
+ * Снятие всех слушателей.
9142
+ */
9143
+ destroy(): void;
9144
+ private initEvents;
9145
+ private onMouseDown;
9146
+ private onMouseMove;
9147
+ private onMouseUp;
9148
+ private onTouchStart;
9149
+ private onTouchMove;
9150
+ private onTouchEnd;
9151
+ private drawLine;
9152
+ }
9153
+
9084
9154
  /**
9085
9155
  * Описание класса будет здесь
9086
9156
  */
@@ -9112,10 +9182,14 @@ declare class Wallet {
9112
9182
  private createTable;
9113
9183
  }
9114
9184
 
9185
+ type Classes_Account = Account;
9186
+ declare const Classes_Account: typeof Account;
9187
+ type Classes_Canvas = Canvas;
9188
+ declare const Classes_Canvas: typeof Canvas;
9115
9189
  type Classes_Wallet = Wallet;
9116
9190
  declare const Classes_Wallet: typeof Wallet;
9117
9191
  declare namespace Classes {
9118
- export { Classes_Wallet as Wallet };
9192
+ export { Classes_Account as Account, Classes_Canvas as Canvas, Classes_Wallet as Wallet };
9119
9193
  }
9120
9194
 
9121
9195
  declare const name$J = "installExtension";
@@ -14060,7 +14134,17 @@ declare function createClient(options: ClientConnectionOptions): {
14060
14134
  getPaymentMethods: GraphQLTypes["PaymentMethodPaginationResult"];
14061
14135
  getPayments: GraphQLTypes["PaymentPaginationResult"];
14062
14136
  getSystemInfo: GraphQLTypes["SystemInfo"];
14063
- }, Z, Omit<ScalarDefinition, string> & ScalarDefinition>>;
14137
+ }, Z, Omit<{
14138
+ DateTime: {
14139
+ decode: (e: unknown) => Date;
14140
+ encode: (e: unknown) => string;
14141
+ };
14142
+ }, "DateTime"> & {
14143
+ DateTime: {
14144
+ decode: (e: unknown) => Date;
14145
+ encode: (e: unknown) => string;
14146
+ };
14147
+ }>>;
14064
14148
  Mutation: <Z extends AliasType<{
14065
14149
  addParticipant?: [{
14066
14150
  data: ValueTypes["AddParticipantInput"] | Variable<any, string>;
@@ -14236,7 +14320,17 @@ declare function createClient(options: ClientConnectionOptions): {
14236
14320
  updateBankAccount: GraphQLTypes["PaymentMethod"];
14237
14321
  updateExtension: GraphQLTypes["Extension"];
14238
14322
  updateSystem: GraphQLTypes["SystemInfo"];
14239
- }, Z, Omit<ScalarDefinition, string> & ScalarDefinition>>;
14323
+ }, Z, Omit<{
14324
+ DateTime: {
14325
+ decode: (e: unknown) => Date;
14326
+ encode: (e: unknown) => string;
14327
+ };
14328
+ }, "DateTime"> & {
14329
+ DateTime: {
14330
+ decode: (e: unknown) => Date;
14331
+ encode: (e: unknown) => string;
14332
+ };
14333
+ }>>;
14240
14334
  Subscription: <O extends keyof typeof Ops, OVERRIDESCLR extends ScalarDefinition, R extends keyof ValueTypes = GenericOperation<O>>(operation: O, graphqlOptions?: ThunderGraphQLOptions<OVERRIDESCLR> | undefined) => <Z extends ValueTypes[R]>(o: Z & { [P in keyof Z]: P extends keyof ValueTypes[R] ? Z[P] : never; }, ops?: (OperationOptions & {
14241
14335
  variables?: ExtractVariables<Z> | undefined;
14242
14336
  }) | undefined) => SubscriptionToGraphQL<Z, GraphQLTypes[R], Omit<ScalarDefinition, keyof OVERRIDESCLR> & OVERRIDESCLR>;
package/dist/index.d.ts CHANGED
@@ -50,9 +50,10 @@ declare const Gql: <O extends keyof typeof Ops, OVERRIDESCLR extends ScalarDefin
50
50
  variables?: Record<string, unknown>;
51
51
  }) => Promise<InputType<GraphQLTypes[R], Z, UnionOverrideKeys<ScalarDefinition, OVERRIDESCLR>>>;
52
52
  declare const ZeusScalars: SelectionFunction<ScalarCoders>;
53
+ type BaseSymbol = number | string | undefined | boolean | null;
53
54
  type ScalarsSelector<T> = {
54
55
  [X in Required<{
55
- [P in keyof T]: T[P] extends number | string | undefined | boolean ? P : never;
56
+ [P in keyof T]: T[P] extends BaseSymbol | Array<BaseSymbol> ? P : never;
56
57
  }>[keyof T]]: true;
57
58
  };
58
59
  declare const fields: <T extends keyof ModelTypes>(k: T) => ScalarsSelector<ModelTypes[T]>;
@@ -300,6 +301,7 @@ type ValueTypes = {
300
301
  totalPages?: boolean | `@${string}`;
301
302
  __typename?: boolean | `@${string}`;
302
303
  }>;
304
+ /** Массив комплексных актов, содержащих полную информацию о сгенерированном и опубликованном документах */
303
305
  ["ActDetail"]: AliasType<{
304
306
  action?: ValueTypes["ExtendedBlockchainAction"];
305
307
  document?: ValueTypes["GeneratedDocument"];
@@ -951,15 +953,15 @@ type ValueTypes = {
951
953
  __typename?: boolean | `@${string}`;
952
954
  }>;
953
955
  ["ExtensionInput"]: {
954
- /** Configuration settings for the extension */
956
+ /** Объект конфигурации расширения */
955
957
  config: ValueTypes["JSON"] | Variable<any, string>;
956
- /** Timestamp of when the extension was created */
958
+ /** Дата установки расширения */
957
959
  created_at?: ValueTypes["DateTime"] | undefined | null | Variable<any, string>;
958
- /** Indicates whether the extension is enabled */
960
+ /** Флаг того, включено ли расширение сейчас */
959
961
  enabled: boolean | Variable<any, string>;
960
- /** Unique name of the extension */
962
+ /** Уникальное имя расширения (является идентификатором) */
961
963
  name: string | Variable<any, string>;
962
- /** Timestamp of the last update to the extension */
964
+ /** Дата обновления расширения */
963
965
  updated_at?: ValueTypes["DateTime"] | undefined | null | Variable<any, string>;
964
966
  };
965
967
  ["FreeDecisionDocument"]: AliasType<{
@@ -2454,6 +2456,7 @@ type ResolverInputTypes = {
2454
2456
  totalPages?: boolean | `@${string}`;
2455
2457
  __typename?: boolean | `@${string}`;
2456
2458
  }>;
2459
+ /** Массив комплексных актов, содержащих полную информацию о сгенерированном и опубликованном документах */
2457
2460
  ["ActDetail"]: AliasType<{
2458
2461
  action?: ResolverInputTypes["ExtendedBlockchainAction"];
2459
2462
  document?: ResolverInputTypes["GeneratedDocument"];
@@ -3105,15 +3108,15 @@ type ResolverInputTypes = {
3105
3108
  __typename?: boolean | `@${string}`;
3106
3109
  }>;
3107
3110
  ["ExtensionInput"]: {
3108
- /** Configuration settings for the extension */
3111
+ /** Объект конфигурации расширения */
3109
3112
  config: ResolverInputTypes["JSON"];
3110
- /** Timestamp of when the extension was created */
3113
+ /** Дата установки расширения */
3111
3114
  created_at?: ResolverInputTypes["DateTime"] | undefined | null;
3112
- /** Indicates whether the extension is enabled */
3115
+ /** Флаг того, включено ли расширение сейчас */
3113
3116
  enabled: boolean;
3114
- /** Unique name of the extension */
3117
+ /** Уникальное имя расширения (является идентификатором) */
3115
3118
  name: string;
3116
- /** Timestamp of the last update to the extension */
3119
+ /** Дата обновления расширения */
3117
3120
  updated_at?: ResolverInputTypes["DateTime"] | undefined | null;
3118
3121
  };
3119
3122
  ["FreeDecisionDocument"]: AliasType<{
@@ -4608,6 +4611,7 @@ type ModelTypes = {
4608
4611
  /** Общее количество страниц */
4609
4612
  totalPages: number;
4610
4613
  };
4614
+ /** Массив комплексных актов, содержащих полную информацию о сгенерированном и опубликованном документах */
4611
4615
  ["ActDetail"]: {
4612
4616
  action?: ModelTypes["ExtendedBlockchainAction"] | undefined | null;
4613
4617
  document?: ModelTypes["GeneratedDocument"] | undefined | null;
@@ -5229,15 +5233,15 @@ type ModelTypes = {
5229
5233
  updated_at: ModelTypes["DateTime"];
5230
5234
  };
5231
5235
  ["ExtensionInput"]: {
5232
- /** Configuration settings for the extension */
5236
+ /** Объект конфигурации расширения */
5233
5237
  config: ModelTypes["JSON"];
5234
- /** Timestamp of when the extension was created */
5238
+ /** Дата установки расширения */
5235
5239
  created_at?: ModelTypes["DateTime"] | undefined | null;
5236
- /** Indicates whether the extension is enabled */
5240
+ /** Флаг того, включено ли расширение сейчас */
5237
5241
  enabled: boolean;
5238
- /** Unique name of the extension */
5242
+ /** Уникальное имя расширения (является идентификатором) */
5239
5243
  name: string;
5240
- /** Timestamp of the last update to the extension */
5244
+ /** Дата обновления расширения */
5241
5245
  updated_at?: ModelTypes["DateTime"] | undefined | null;
5242
5246
  };
5243
5247
  ["FreeDecisionDocument"]: {
@@ -6613,6 +6617,7 @@ type GraphQLTypes = {
6613
6617
  /** Общее количество страниц */
6614
6618
  totalPages: number;
6615
6619
  };
6620
+ /** Массив комплексных актов, содержащих полную информацию о сгенерированном и опубликованном документах */
6616
6621
  ["ActDetail"]: {
6617
6622
  __typename: "ActDetail";
6618
6623
  action?: GraphQLTypes["ExtendedBlockchainAction"] | undefined | null;
@@ -7266,15 +7271,15 @@ type GraphQLTypes = {
7266
7271
  updated_at: GraphQLTypes["DateTime"];
7267
7272
  };
7268
7273
  ["ExtensionInput"]: {
7269
- /** Configuration settings for the extension */
7274
+ /** Объект конфигурации расширения */
7270
7275
  config: GraphQLTypes["JSON"];
7271
- /** Timestamp of when the extension was created */
7276
+ /** Дата установки расширения */
7272
7277
  created_at?: GraphQLTypes["DateTime"] | undefined | null;
7273
- /** Indicates whether the extension is enabled */
7278
+ /** Флаг того, включено ли расширение сейчас */
7274
7279
  enabled: boolean;
7275
- /** Unique name of the extension */
7280
+ /** Уникальное имя расширения (является идентификатором) */
7276
7281
  name: string;
7277
- /** Timestamp of the last update to the extension */
7282
+ /** Дата обновления расширения */
7278
7283
  updated_at?: GraphQLTypes["DateTime"] | undefined | null;
7279
7284
  };
7280
7285
  ["FreeDecisionDocument"]: {
@@ -9081,6 +9086,71 @@ declare namespace index$j {
9081
9086
  export type { index$j_AccountResourceInfo as AccountResourceInfo, index$j_Authority as Authority, index$j_BlockchainAccountInterface as BlockchainAccountInterface, index$j_BlockchainConfig as BlockchainConfig, index$j_ClientConnectionOptions as ClientConnectionOptions, index$j_DeserializedDescriptionOfExtension as DeserializedDescriptionOfExtension, index$j_GetInfoResult as GetInfoResult, index$j_IndexPosition as IndexPosition, index$j_KeyWeight as KeyWeight, index$j_Permission as Permission, index$j_PermissionLevel as PermissionLevel, index$j_PermissionLevelWeight as PermissionLevelWeight, index$j_RefundRequest as RefundRequest, index$j_ResourceDelegation as ResourceDelegation, index$j_ResourceOverview as ResourceOverview, index$j_WaitWeight as WaitWeight };
9082
9087
  }
9083
9088
 
9089
+ /**
9090
+ * Класс `Account` генерирует объект с именем, приватным и публичным ключами.
9091
+ *
9092
+ * @example
9093
+ * ```ts
9094
+ * const account = new Account();
9095
+ * console.log(account);
9096
+ * // {
9097
+ * // name: "abcdxyzuvwrs",
9098
+ * // privateKey: "5JxyzABC1234567890defGHIJKLMNopqRSTUV",
9099
+ * // publicKey: "EOS6MRyAjQq8ud7hVNYcfnVPJqcVpscN5SozEZ8i8jUBS6yX79y6"
9100
+ * // }
9101
+ * ```
9102
+ */
9103
+ declare class Account {
9104
+ username: string;
9105
+ private_key: string;
9106
+ public_key: string;
9107
+ constructor();
9108
+ /**
9109
+ * Генерирует случайное имя длиной 12 символов, состоящее только из букв.
9110
+ * @returns Случайное имя.
9111
+ */
9112
+ private static generateUsername;
9113
+ /**
9114
+ * Генерирует пару ключей (приватный и публичный) с использованием библиотеки @wharfkit/antelope.
9115
+ * @returns Объект с приватным и публичным ключами.
9116
+ */
9117
+ private static generateKeys;
9118
+ }
9119
+
9120
+ declare class Canvas {
9121
+ private container;
9122
+ private opts;
9123
+ canvas: HTMLCanvasElement;
9124
+ ctx: CanvasRenderingContext2D;
9125
+ private drawing;
9126
+ private lastX;
9127
+ private lastY;
9128
+ constructor(container: HTMLElement, opts?: {
9129
+ lineWidth?: number;
9130
+ strokeStyle?: string;
9131
+ });
9132
+ /**
9133
+ * Очистка холста.
9134
+ */
9135
+ clearCanvas(): void;
9136
+ /**
9137
+ * Получение подписи в формате base64.
9138
+ */
9139
+ getSignature(): string;
9140
+ /**
9141
+ * Снятие всех слушателей.
9142
+ */
9143
+ destroy(): void;
9144
+ private initEvents;
9145
+ private onMouseDown;
9146
+ private onMouseMove;
9147
+ private onMouseUp;
9148
+ private onTouchStart;
9149
+ private onTouchMove;
9150
+ private onTouchEnd;
9151
+ private drawLine;
9152
+ }
9153
+
9084
9154
  /**
9085
9155
  * Описание класса будет здесь
9086
9156
  */
@@ -9112,10 +9182,14 @@ declare class Wallet {
9112
9182
  private createTable;
9113
9183
  }
9114
9184
 
9185
+ type Classes_Account = Account;
9186
+ declare const Classes_Account: typeof Account;
9187
+ type Classes_Canvas = Canvas;
9188
+ declare const Classes_Canvas: typeof Canvas;
9115
9189
  type Classes_Wallet = Wallet;
9116
9190
  declare const Classes_Wallet: typeof Wallet;
9117
9191
  declare namespace Classes {
9118
- export { Classes_Wallet as Wallet };
9192
+ export { Classes_Account as Account, Classes_Canvas as Canvas, Classes_Wallet as Wallet };
9119
9193
  }
9120
9194
 
9121
9195
  declare const name$J = "installExtension";
@@ -14060,7 +14134,17 @@ declare function createClient(options: ClientConnectionOptions): {
14060
14134
  getPaymentMethods: GraphQLTypes["PaymentMethodPaginationResult"];
14061
14135
  getPayments: GraphQLTypes["PaymentPaginationResult"];
14062
14136
  getSystemInfo: GraphQLTypes["SystemInfo"];
14063
- }, Z, Omit<ScalarDefinition, string> & ScalarDefinition>>;
14137
+ }, Z, Omit<{
14138
+ DateTime: {
14139
+ decode: (e: unknown) => Date;
14140
+ encode: (e: unknown) => string;
14141
+ };
14142
+ }, "DateTime"> & {
14143
+ DateTime: {
14144
+ decode: (e: unknown) => Date;
14145
+ encode: (e: unknown) => string;
14146
+ };
14147
+ }>>;
14064
14148
  Mutation: <Z extends AliasType<{
14065
14149
  addParticipant?: [{
14066
14150
  data: ValueTypes["AddParticipantInput"] | Variable<any, string>;
@@ -14236,7 +14320,17 @@ declare function createClient(options: ClientConnectionOptions): {
14236
14320
  updateBankAccount: GraphQLTypes["PaymentMethod"];
14237
14321
  updateExtension: GraphQLTypes["Extension"];
14238
14322
  updateSystem: GraphQLTypes["SystemInfo"];
14239
- }, Z, Omit<ScalarDefinition, string> & ScalarDefinition>>;
14323
+ }, Z, Omit<{
14324
+ DateTime: {
14325
+ decode: (e: unknown) => Date;
14326
+ encode: (e: unknown) => string;
14327
+ };
14328
+ }, "DateTime"> & {
14329
+ DateTime: {
14330
+ decode: (e: unknown) => Date;
14331
+ encode: (e: unknown) => string;
14332
+ };
14333
+ }>>;
14240
14334
  Subscription: <O extends keyof typeof Ops, OVERRIDESCLR extends ScalarDefinition, R extends keyof ValueTypes = GenericOperation<O>>(operation: O, graphqlOptions?: ThunderGraphQLOptions<OVERRIDESCLR> | undefined) => <Z extends ValueTypes[R]>(o: Z & { [P in keyof Z]: P extends keyof ValueTypes[R] ? Z[P] : never; }, ops?: (OperationOptions & {
14241
14335
  variables?: ExtractVariables<Z> | undefined;
14242
14336
  }) | undefined) => SubscriptionToGraphQL<Z, GraphQLTypes[R], Omit<ScalarDefinition, keyof OVERRIDESCLR> & OVERRIDESCLR>;
package/dist/index.mjs CHANGED
@@ -1,10 +1,162 @@
1
1
  import { Session, PrivateKey as PrivateKey$1, Bytes, Checksum256 } from '@wharfkit/session';
2
2
  import WebSocket from 'isomorphic-ws';
3
- import { APIClient, PrivateKey, Action } from '@wharfkit/antelope';
3
+ import { PrivateKey, APIClient, Action } from '@wharfkit/antelope';
4
4
  import { ContractKit, Table } from '@wharfkit/contract';
5
5
  import { WalletPluginPrivateKey } from '@wharfkit/wallet-plugin-privatekey';
6
6
  import { createClient as createClient$1 } from 'graphql-ws';
7
7
 
8
+ var __defProp$2 = Object.defineProperty;
9
+ var __defNormalProp$2 = (obj, key, value) => key in obj ? __defProp$2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
+ var __publicField$2 = (obj, key, value) => {
11
+ __defNormalProp$2(obj, typeof key !== "symbol" ? key + "" : key, value);
12
+ return value;
13
+ };
14
+ class Account {
15
+ constructor() {
16
+ __publicField$2(this, "username");
17
+ __publicField$2(this, "private_key");
18
+ __publicField$2(this, "public_key");
19
+ this.username = Account.generateUsername();
20
+ const keys = Account.generateKeys();
21
+ this.private_key = keys.private_key;
22
+ this.public_key = keys.public_key;
23
+ }
24
+ /**
25
+ * Генерирует случайное имя длиной 12 символов, состоящее только из букв.
26
+ * @returns Случайное имя.
27
+ */
28
+ static generateUsername() {
29
+ let result = "";
30
+ const possible = "abcdefghijklmnopqrstuvwxyz";
31
+ for (let i = 0; i < 12; i++) {
32
+ result += possible.charAt(Math.floor(Math.random() * possible.length));
33
+ }
34
+ return result;
35
+ }
36
+ /**
37
+ * Генерирует пару ключей (приватный и публичный) с использованием библиотеки @wharfkit/antelope.
38
+ * @returns Объект с приватным и публичным ключами.
39
+ */
40
+ static generateKeys() {
41
+ const private_key_data = PrivateKey.generate("K1");
42
+ const public_key = private_key_data.toPublic().toString();
43
+ const private_key = private_key_data.toWif();
44
+ return {
45
+ private_key,
46
+ public_key
47
+ };
48
+ }
49
+ }
50
+
51
+ var __defProp$1 = Object.defineProperty;
52
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
53
+ var __publicField$1 = (obj, key, value) => {
54
+ __defNormalProp$1(obj, typeof key !== "symbol" ? key + "" : key, value);
55
+ return value;
56
+ };
57
+ class Canvas {
58
+ constructor(container, opts = {}) {
59
+ this.container = container;
60
+ this.opts = opts;
61
+ __publicField$1(this, "canvas");
62
+ __publicField$1(this, "ctx");
63
+ __publicField$1(this, "drawing", false);
64
+ __publicField$1(this, "lastX", 0);
65
+ __publicField$1(this, "lastY", 0);
66
+ __publicField$1(this, "onMouseDown", (e) => {
67
+ e.preventDefault();
68
+ this.drawing = true;
69
+ const rect = this.canvas.getBoundingClientRect();
70
+ this.lastX = e.clientX - rect.left;
71
+ this.lastY = e.clientY - rect.top;
72
+ });
73
+ __publicField$1(this, "onMouseMove", (e) => {
74
+ if (!this.drawing)
75
+ return;
76
+ e.preventDefault();
77
+ this.drawLine(e.clientX, e.clientY);
78
+ });
79
+ __publicField$1(this, "onMouseUp", () => {
80
+ this.drawing = false;
81
+ });
82
+ __publicField$1(this, "onTouchStart", (e) => {
83
+ e.preventDefault();
84
+ this.drawing = true;
85
+ const rect = this.canvas.getBoundingClientRect();
86
+ this.lastX = e.touches[0].clientX - rect.left;
87
+ this.lastY = e.touches[0].clientY - rect.top;
88
+ });
89
+ __publicField$1(this, "onTouchMove", (e) => {
90
+ if (!this.drawing)
91
+ return;
92
+ e.preventDefault();
93
+ const t = e.touches[0];
94
+ this.drawLine(t.clientX, t.clientY);
95
+ });
96
+ __publicField$1(this, "onTouchEnd", () => {
97
+ this.drawing = false;
98
+ });
99
+ this.canvas = document.createElement("canvas");
100
+ this.canvas.width = container.offsetWidth;
101
+ this.canvas.height = container.offsetHeight;
102
+ this.canvas.style.touchAction = "none";
103
+ container.appendChild(this.canvas);
104
+ const ctx = this.canvas.getContext("2d");
105
+ if (!ctx) {
106
+ throw new Error("Canvas not supported");
107
+ }
108
+ this.ctx = ctx;
109
+ this.ctx.lineWidth = this.opts.lineWidth ?? 5;
110
+ this.ctx.lineJoin = "round";
111
+ this.ctx.lineCap = "round";
112
+ this.ctx.strokeStyle = this.opts.strokeStyle ?? "#000";
113
+ this.initEvents();
114
+ }
115
+ /**
116
+ * Очистка холста.
117
+ */
118
+ clearCanvas() {
119
+ this.ctx.clearRect(0, 0, this.canvas.width, this.canvas.height);
120
+ }
121
+ /**
122
+ * Получение подписи в формате base64.
123
+ */
124
+ getSignature() {
125
+ return this.canvas.toDataURL("image/png");
126
+ }
127
+ /**
128
+ * Снятие всех слушателей.
129
+ */
130
+ destroy() {
131
+ this.canvas.removeEventListener("mousedown", this.onMouseDown);
132
+ this.canvas.removeEventListener("mousemove", this.onMouseMove);
133
+ this.canvas.removeEventListener("mouseup", this.onMouseUp);
134
+ this.canvas.removeEventListener("touchstart", this.onTouchStart);
135
+ this.canvas.removeEventListener("touchmove", this.onTouchMove);
136
+ this.canvas.removeEventListener("touchend", this.onTouchEnd);
137
+ }
138
+ // Внутренние методы
139
+ initEvents() {
140
+ this.canvas.addEventListener("mousedown", this.onMouseDown);
141
+ this.canvas.addEventListener("mousemove", this.onMouseMove);
142
+ this.canvas.addEventListener("mouseup", this.onMouseUp);
143
+ this.canvas.addEventListener("touchstart", this.onTouchStart, { passive: false });
144
+ this.canvas.addEventListener("touchmove", this.onTouchMove, { passive: false });
145
+ this.canvas.addEventListener("touchend", this.onTouchEnd, { passive: false });
146
+ }
147
+ drawLine(clientX, clientY) {
148
+ this.ctx.beginPath();
149
+ this.ctx.moveTo(this.lastX, this.lastY);
150
+ const rect = this.canvas.getBoundingClientRect();
151
+ const x = clientX - rect.left;
152
+ const y = clientY - rect.top;
153
+ this.ctx.lineTo(x, y);
154
+ this.ctx.stroke();
155
+ this.lastX = x;
156
+ this.lastY = y;
157
+ }
158
+ }
159
+
8
160
  var __defProp = Object.defineProperty;
9
161
  var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
10
162
  var __publicField = (obj, key, value) => {
@@ -97,6 +249,8 @@ class Wallet {
97
249
 
98
250
  const Classes = {
99
251
  __proto__: null,
252
+ Account: Account,
253
+ Canvas: Canvas,
100
254
  Wallet: Wallet
101
255
  };
102
256
 
@@ -1367,12 +1521,22 @@ const Gql = Chain(HOST, {
1367
1521
  const ZeusScalars = ZeusSelect();
1368
1522
  const fields = (k) => {
1369
1523
  const t = ReturnTypes[k];
1524
+ const fnType = k in AllTypesProps ? AllTypesProps[k] : void 0;
1525
+ const hasFnTypes = typeof fnType === "object" ? fnType : void 0;
1370
1526
  const o = Object.fromEntries(
1371
- Object.entries(t).filter(([, value]) => {
1527
+ Object.entries(t).filter(([k2, value]) => {
1528
+ const isFunctionType = hasFnTypes && k2 in hasFnTypes && !!hasFnTypes[k2];
1529
+ if (isFunctionType)
1530
+ return false;
1372
1531
  const isReturnType = ReturnTypes[value];
1373
- if (!isReturnType || typeof isReturnType === "string" && isReturnType.startsWith("scalar.")) {
1532
+ if (!isReturnType)
1533
+ return true;
1534
+ if (typeof isReturnType !== "string")
1535
+ return false;
1536
+ if (isReturnType.startsWith("scalar.")) {
1374
1537
  return true;
1375
1538
  }
1539
+ return false;
1376
1540
  }).map(([key]) => [key, true])
1377
1541
  );
1378
1542
  return o;
@@ -3141,6 +3305,14 @@ if (typeof globalThis.WebSocket === "undefined") {
3141
3305
  globalThis.WebSocket = WebSocket;
3142
3306
  }
3143
3307
  let currentHeaders = {};
3308
+ const scalars = ZeusScalars({
3309
+ DateTime: {
3310
+ decode: (e) => new Date(e),
3311
+ // Преобразует строку в объект Date
3312
+ encode: (e) => e.toISOString()
3313
+ // Преобразует Date в ISO-строку
3314
+ }
3315
+ });
3144
3316
  function createThunder(baseUrl) {
3145
3317
  return Thunder(async (query, variables) => {
3146
3318
  const response = await fetch(baseUrl, {
@@ -3169,7 +3341,7 @@ function createThunder(baseUrl) {
3169
3341
  throw json.errors;
3170
3342
  }
3171
3343
  return json.data;
3172
- });
3344
+ }, { scalars });
3173
3345
  }
3174
3346
  function createClient(options) {
3175
3347
  currentHeaders = options.headers || {};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@coopenomics/sdk",
3
3
  "type": "module",
4
- "version": "2.2.2",
4
+ "version": "2.2.4",
5
5
  "private": false,
6
6
  "packageManager": "pnpm@9.9.0",
7
7
  "description": "",
@@ -74,5 +74,5 @@
74
74
  "vite": "^5.4.3",
75
75
  "vitest": "^2.0.5"
76
76
  },
77
- "gitHead": "88352202b02fd190abd2c892290cb668ba137cb8"
77
+ "gitHead": "cbfe37dbba00574ec4f1ca354ecf5a4438d72bc1"
78
78
  }