@coopenomics/desktop 2.2.4 → 2.2.5

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/CHANGELOG.md CHANGED
@@ -3,6 +3,14 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ ## [2.2.5](https://github.com/coopenomics/monocoop/compare/v2.2.4...v2.2.5) (2025-01-18)
7
+
8
+ **Note:** Version bump only for package @coopenomics/desktop
9
+
10
+
11
+
12
+
13
+
6
14
  ## [2.2.4](https://github.com/coopenomics/monocoop/compare/v2.2.0...v2.2.4) (2025-01-17)
7
15
 
8
16
  **Note:** Version bump only for package @coopenomics/desktop
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@coopenomics/desktop",
3
- "version": "2.2.4",
3
+ "version": "2.2.5",
4
4
  "description": "A Desktop Project",
5
5
  "productName": "Desktop App",
6
6
  "author": "Alex Ant <dacom.dark.sun@gmail.com>",
@@ -20,8 +20,8 @@
20
20
  "prepublishOnly": "npm run build:lib"
21
21
  },
22
22
  "dependencies": {
23
- "@coopenomics/controller": "2.2.4",
24
- "@coopenomics/sdk": "2.2.4",
23
+ "@coopenomics/controller": "2.2.5",
24
+ "@coopenomics/sdk": "2.2.5",
25
25
  "@dicebear/collection": "^9.0.1",
26
26
  "@dicebear/core": "^9.0.1",
27
27
  "@fortawesome/fontawesome-svg-core": "^6.5.2",
@@ -45,7 +45,7 @@
45
45
  "@wharfkit/wallet-plugin-privatekey": "^1.1.0",
46
46
  "axios": "^1.2.1",
47
47
  "compression": "^1.7.4",
48
- "cooptypes": "2.2.4",
48
+ "cooptypes": "2.2.5",
49
49
  "dompurify": "^3.1.7",
50
50
  "dotenv": "^16.4.5",
51
51
  "email-regex": "^5.0.0",
@@ -94,5 +94,5 @@
94
94
  "npm": ">= 6.13.4",
95
95
  "yarn": ">= 1.21.1"
96
96
  },
97
- "gitHead": "cbfe37dbba00574ec4f1ca354ecf5a4438d72bc1"
97
+ "gitHead": "97b21a9d69b6c387a1a7f2c32642d29c0898694e"
98
98
  }
@@ -6,7 +6,7 @@ export type ISchemaType = 'string' | 'number' | 'integer' | 'boolean' | 'object'
6
6
 
7
7
  export type ISchemaProperty = {
8
8
  type?: ISchemaType;
9
- description?: Types.DeserializedDescriptionOfExtension
9
+ description?: Types.Controller.DeserializedDescriptionOfExtension
10
10
  default?: any;
11
11
  required?: string[];
12
12
  properties?: ISchemaProperty;
@@ -7,7 +7,6 @@ import { IGeneratedAccount, ISendStatement } from 'src/shared/lib/types/user';
7
7
  import { useSessionStore } from 'src/entities/Session';
8
8
  import { useGlobalStore } from 'src/shared/store';
9
9
  import { COOPNAME } from 'src/shared/config';
10
- import { DigitalDocument } from 'src/shared/lib/document';
11
10
  import { IObjectedDocument } from 'src/shared/lib/types/document';
12
11
  import {
13
12
  ICreatedPayment,
@@ -17,7 +16,8 @@ import {
17
16
  } from 'src/entities/User';
18
17
  import { useRegistratorStore } from 'src/entities/Registrator'
19
18
  import { IEntrepreneurData, IIndividualData, IOrganizationData, IUserData } from 'src/shared/lib/types/user/IUserData';
20
- import { Cooperative } from 'cooptypes';
19
+ import { client } from 'src/shared/api/client';
20
+ import { Mutations } from '@coopenomics/sdk';
21
21
 
22
22
  export interface ICreateUser {
23
23
  email: string;
@@ -56,113 +56,124 @@ export function useCreateUser() {
56
56
 
57
57
 
58
58
  async function signStatement(): Promise<IObjectedDocument> {
59
- const data: Cooperative.Registry.ParticipantApplication.Action = {
60
- registry_id: Cooperative.Registry.ParticipantApplication.registry_id,
61
- signature: store.signature,
62
- skip_save: false,
63
- coopname: COOPNAME,
64
- username: store.account.username,
65
- braname: store.selectedBranch,
66
- links: [store.walletAgreement.hash, store.privacyAgreement.hash, store.signatureAgreement.hash, store.userAgreement.hash]
59
+ const variables: Mutations.Participants.GenerateParticipantApplication.IInput = {
60
+ data: {
61
+ signature: store.signature,
62
+ skip_save: false,
63
+ coopname: COOPNAME,
64
+ username: store.account.username,
65
+ braname: store.selectedBranch,
66
+ links: [store.walletAgreement.hash, store.privacyAgreement.hash, store.signatureAgreement.hash, store.userAgreement.hash]
67
+ }
67
68
  }
68
69
 
69
- const document = await new DigitalDocument().generate<Cooperative.Registry.ParticipantApplication.Action>(data);
70
- const globalStore = useGlobalStore();
71
- const digital_signature = await globalStore.signDigest(document.hash);
70
+ const { [Mutations.Participants.GenerateParticipantApplication.name]: result } = await client.Mutation(
71
+ Mutations.Participants.GenerateParticipantApplication.mutation,
72
+ { variables }
73
+ );
72
74
 
73
- store.statement = {
74
- hash: document.hash,
75
- meta: document.meta,
76
- public_key: digital_signature.public_key,
77
- signature: digital_signature.signature,
78
- } as IObjectedDocument;
75
+ store.statement = await client.Document.signDocument(result)
79
76
 
80
77
  return store.statement;
81
78
  }
82
79
 
83
80
  async function signPrivacyAgreement(): Promise<IObjectedDocument> {
84
- const data: Cooperative.Registry.PrivacyPolicy.Action= {
85
- registry_id: Cooperative.Registry.PrivacyPolicy.registry_id,
86
- coopname: COOPNAME,
87
- username: store.account.username,
88
- };
81
+ const variables: Mutations.Agreements.GeneratePrivacyAgreement.IInput = {
82
+ data: {
83
+ coopname: COOPNAME,
84
+ username: store.account.username,
85
+ }
86
+ }
89
87
 
90
- const document = new DigitalDocument();
91
- await document.generate(data);
92
- await document.sign();
88
+ const { [Mutations.Agreements.GeneratePrivacyAgreement.name]: result } = await client.Mutation(
89
+ Mutations.Agreements.GeneratePrivacyAgreement.mutation,
90
+ { variables }
91
+ );
93
92
 
94
- store.privacyAgreement = document.signedDocument as IObjectedDocument;
93
+ store.privacyAgreement = await client.Document.signDocument(result)
95
94
 
96
95
  return store.privacyAgreement;
97
96
  }
98
97
 
99
98
  async function signSignatureAgreement(): Promise<IObjectedDocument> {
100
- const data: Cooperative.Registry.RegulationElectronicSignature.Action= {
101
- registry_id: Cooperative.Registry.RegulationElectronicSignature.registry_id,
102
- coopname: COOPNAME,
103
- username: store.account.username,
104
- };
99
+ const variables: Mutations.Agreements.GenerateSignatureAgreement.IInput = {
100
+ data: {
101
+ coopname: COOPNAME,
102
+ username: store.account.username,
103
+ }
104
+ }
105
105
 
106
- const document = new DigitalDocument();
107
- await document.generate(data);
108
- await document.sign();
106
+ const { [Mutations.Agreements.GenerateSignatureAgreement.name]: result } = await client.Mutation(
107
+ Mutations.Agreements.GenerateSignatureAgreement.mutation,
108
+ { variables }
109
+ );
109
110
 
110
- store.signatureAgreement = document.signedDocument as IObjectedDocument;
111
+ store.signatureAgreement = await client.Document.signDocument(result)
111
112
 
112
113
  return store.signatureAgreement;
114
+
113
115
  }
114
116
 
115
117
 
116
118
  async function signUserAgreement(): Promise<IObjectedDocument> {
117
- const data: Cooperative.Registry.UserAgreement.Action= {
118
- registry_id: Cooperative.Registry.UserAgreement.registry_id,
119
- coopname: COOPNAME,
120
- username: store.account.username,
121
- };
119
+ const variables: Mutations.Agreements.GenerateUserAgreement.IInput = {
120
+ data: {
121
+ coopname: COOPNAME,
122
+ username: store.account.username,
123
+ }
124
+ }
122
125
 
123
- const document = new DigitalDocument();
124
- await document.generate(data);
125
- await document.sign();
126
+ const { [Mutations.Agreements.GenerateUserAgreement.name]: result } = await client.Mutation(
127
+ Mutations.Agreements.GenerateUserAgreement.mutation,
128
+ { variables }
129
+ );
126
130
 
127
- store.userAgreement = document.signedDocument as IObjectedDocument;
131
+ store.userAgreement = await client.Document.signDocument(result)
128
132
 
129
133
  return store.userAgreement;
134
+
130
135
  }
131
136
 
132
137
 
133
138
 
134
139
 
135
140
  async function signWalletAgreement(): Promise<IObjectedDocument> {
136
- const data: Cooperative.Registry.WalletAgreement.Action= {
137
- registry_id: Cooperative.Registry.WalletAgreement.registry_id,
138
- coopname: COOPNAME,
139
- username: store.account.username,
140
- };
141
-
142
- const document = new DigitalDocument();
143
- await document.generate(data);
144
- await document.sign();
141
+ const variables: Mutations.Agreements.GenerateWalletAgreement.IInput = {
142
+ data: {
143
+ coopname: COOPNAME,
144
+ username: store.account.username,
145
+ }
146
+ }
145
147
 
146
- store.walletAgreement = document.signedDocument as IObjectedDocument;
148
+ const { [Mutations.Agreements.GenerateWalletAgreement.name]: result } = await client.Mutation(
149
+ Mutations.Agreements.GenerateWalletAgreement.mutation,
150
+ { variables }
151
+ );
147
152
 
148
- console.log('walletAgreement: ', store.walletAgreement)
153
+ store.walletAgreement = await client.Document.signDocument(result)
149
154
 
150
155
  return store.walletAgreement;
151
156
  }
152
157
 
153
158
 
154
159
  async function generateStatementWithoutSignature() {
160
+ const variables: Mutations.Participants.GenerateParticipantApplication.IInput = {
161
+ data: {
162
+ signature: '',
163
+ skip_save: true,
164
+ coopname: COOPNAME,
165
+ username: store.account.username,
166
+ braname: store.selectedBranch,
167
+ }
168
+ }
155
169
 
156
- const document = await new DigitalDocument().generate<Cooperative.Registry.ParticipantApplication.Action>({
157
- signature: '',
158
- skip_save: true,
159
- coopname: COOPNAME,
160
- username: store.account.username,
161
- braname: store.selectedBranch,
162
- registry_id: Cooperative.Registry.ParticipantApplication.registry_id
163
- });
170
+ const { [Mutations.Participants.GenerateParticipantApplication.name]: result } = await client.Mutation(
171
+ Mutations.Participants.GenerateParticipantApplication.mutation,
172
+ { variables }
173
+ );
174
+
175
+ return result;
164
176
 
165
- return document;
166
177
  }
167
178
 
168
179
  async function createUser(
@@ -43,7 +43,7 @@ div
43
43
  <script lang="ts" setup>
44
44
  import { ref, computed, watch, onMounted } from 'vue'
45
45
  import { useCreateUser } from 'src/features/User/CreateUser'
46
- import { FailAlert } from 'src/shared/api';
46
+ import { failAlert } from 'src/shared/api';
47
47
  import { Loader } from 'src/shared/ui/Loader';
48
48
  import { ReadAgreementDialog } from 'src/features/Agreementer/ReadAgreementDialog';
49
49
  import { useAgreementStore } from 'src/entities/Agreement'
@@ -70,7 +70,7 @@ const loadStatement = async (): Promise<void> => {
70
70
  isLoading.value = false
71
71
  } catch (e: any) {
72
72
  isLoading.value = false
73
- FailAlert(e.message)
73
+ failAlert(e.message)
74
74
  }
75
75
  }
76
76
 
@@ -28,13 +28,14 @@
28
28
  <script lang="ts" setup>
29
29
  import { ref, onMounted, onBeforeUnmount, watch, nextTick } from 'vue'
30
30
  import { Notify } from 'quasar'
31
- import { FailAlert } from 'src/shared/api'
31
+ import { failAlert, FailAlert } from 'src/shared/api'
32
32
  import { Loader } from 'src/shared/ui/Loader'
33
33
  import { useRegistratorStore } from 'src/entities/Registrator'
34
34
  import { useCreateUser } from 'src/features/User/CreateUser'
35
35
 
36
36
  // Импортируем класс
37
37
  import { Classes } from '@coopenomics/sdk'
38
+ import { client } from 'src/shared/api/client'
38
39
 
39
40
  const store = useRegistratorStore()
40
41
  const createUser = useCreateUser()
@@ -124,6 +125,9 @@
124
125
  onSign.value = true
125
126
  store.state.signature = sign
126
127
 
128
+ // устанавливаем ключ для подписи документов
129
+ client.Document.setWif(store.state.account.private_key)
130
+
127
131
  loadingText.value = 'Подписываем положение о ЦПП "Цифровой Кошелёк"'
128
132
  await createUser.signWalletAgreement()
129
133
 
@@ -147,7 +151,7 @@
147
151
  store.next()
148
152
  } catch (err: any) {
149
153
  onSign.value = false
150
- FailAlert(err.message)
154
+ failAlert(err)
151
155
  }
152
156
  }
153
157
  </script>
@@ -1,8 +1,8 @@
1
- import {createClient} from '@coopenomics/sdk'
1
+ import { Client } from '@coopenomics/sdk'
2
2
  import { BACKEND_URL, CHAIN_ID, CHAIN_URL } from '../config'
3
3
 
4
4
  // Создаем и экспортируем экземпляр API-клиента
5
- export const client = createClient({
5
+ export const client = Client.create({
6
6
  api_url: BACKEND_URL + '/v1/graphql',
7
7
  headers: {
8
8
  'Content-Type': 'application/json',