@turnkey/core 1.0.0-beta.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +201 -0
- package/README.MD +5 -0
- package/dist/__clients__/core.d.ts +1010 -0
- package/dist/__clients__/core.d.ts.map +1 -0
- package/dist/__clients__/core.js +2358 -0
- package/dist/__clients__/core.js.map +1 -0
- package/dist/__clients__/core.mjs +2356 -0
- package/dist/__clients__/core.mjs.map +1 -0
- package/dist/__generated__/sdk-client-base.d.ts +211 -0
- package/dist/__generated__/sdk-client-base.d.ts.map +1 -0
- package/dist/__generated__/sdk-client-base.js +3219 -0
- package/dist/__generated__/sdk-client-base.js.map +1 -0
- package/dist/__generated__/sdk-client-base.mjs +3217 -0
- package/dist/__generated__/sdk-client-base.mjs.map +1 -0
- package/dist/__generated__/version.d.ts +2 -0
- package/dist/__generated__/version.d.ts.map +1 -0
- package/dist/__generated__/version.js +6 -0
- package/dist/__generated__/version.js.map +1 -0
- package/dist/__generated__/version.mjs +4 -0
- package/dist/__generated__/version.mjs.map +1 -0
- package/dist/__inputs__/public_api.types.d.ts +5170 -0
- package/dist/__inputs__/public_api.types.d.ts.map +1 -0
- package/dist/__polyfills__/window.d.ts +15 -0
- package/dist/__polyfills__/window.d.ts.map +1 -0
- package/dist/__polyfills__/window.js +30 -0
- package/dist/__polyfills__/window.js.map +1 -0
- package/dist/__polyfills__/window.mjs +28 -0
- package/dist/__polyfills__/window.mjs.map +1 -0
- package/dist/__stampers__/api/base.d.ts +20 -0
- package/dist/__stampers__/api/base.d.ts.map +1 -0
- package/dist/__stampers__/api/base.js +67 -0
- package/dist/__stampers__/api/base.js.map +1 -0
- package/dist/__stampers__/api/base.mjs +65 -0
- package/dist/__stampers__/api/base.mjs.map +1 -0
- package/dist/__stampers__/api/mobile/stamper.d.ts +13 -0
- package/dist/__stampers__/api/mobile/stamper.d.ts.map +1 -0
- package/dist/__stampers__/api/mobile/stamper.js +69 -0
- package/dist/__stampers__/api/mobile/stamper.js.map +1 -0
- package/dist/__stampers__/api/mobile/stamper.mjs +67 -0
- package/dist/__stampers__/api/mobile/stamper.mjs.map +1 -0
- package/dist/__stampers__/api/web/stamper.d.ts +14 -0
- package/dist/__stampers__/api/web/stamper.d.ts.map +1 -0
- package/dist/__stampers__/api/web/stamper.js +212 -0
- package/dist/__stampers__/api/web/stamper.js.map +1 -0
- package/dist/__stampers__/api/web/stamper.mjs +210 -0
- package/dist/__stampers__/api/web/stamper.mjs.map +1 -0
- package/dist/__stampers__/passkey/base.d.ts +18 -0
- package/dist/__stampers__/passkey/base.d.ts.map +1 -0
- package/dist/__stampers__/passkey/base.js +138 -0
- package/dist/__stampers__/passkey/base.js.map +1 -0
- package/dist/__stampers__/passkey/base.mjs +134 -0
- package/dist/__stampers__/passkey/base.mjs.map +1 -0
- package/dist/__storage__/base.d.ts +3 -0
- package/dist/__storage__/base.d.ts.map +1 -0
- package/dist/__storage__/base.js +27 -0
- package/dist/__storage__/base.js.map +1 -0
- package/dist/__storage__/base.mjs +25 -0
- package/dist/__storage__/base.mjs.map +1 -0
- package/dist/__storage__/mobile/storage.d.ts +18 -0
- package/dist/__storage__/mobile/storage.d.ts.map +1 -0
- package/dist/__storage__/mobile/storage.js +74 -0
- package/dist/__storage__/mobile/storage.js.map +1 -0
- package/dist/__storage__/mobile/storage.mjs +72 -0
- package/dist/__storage__/mobile/storage.mjs.map +1 -0
- package/dist/__storage__/web/storage.d.ts +19 -0
- package/dist/__storage__/web/storage.d.ts.map +1 -0
- package/dist/__storage__/web/storage.js +79 -0
- package/dist/__storage__/web/storage.js.map +1 -0
- package/dist/__storage__/web/storage.mjs +77 -0
- package/dist/__storage__/web/storage.mjs.map +1 -0
- package/dist/__types__/base.d.ts +407 -0
- package/dist/__types__/base.d.ts.map +1 -0
- package/dist/__types__/base.js +88 -0
- package/dist/__types__/base.js.map +1 -0
- package/dist/__types__/base.mjs +84 -0
- package/dist/__types__/base.mjs.map +1 -0
- package/dist/__wallet__/base.d.ts +3 -0
- package/dist/__wallet__/base.d.ts.map +1 -0
- package/dist/__wallet__/base.js +24 -0
- package/dist/__wallet__/base.js.map +1 -0
- package/dist/__wallet__/base.mjs +22 -0
- package/dist/__wallet__/base.mjs.map +1 -0
- package/dist/__wallet__/connector.d.ts +33 -0
- package/dist/__wallet__/connector.d.ts.map +1 -0
- package/dist/__wallet__/connector.js +63 -0
- package/dist/__wallet__/connector.js.map +1 -0
- package/dist/__wallet__/connector.mjs +61 -0
- package/dist/__wallet__/connector.mjs.map +1 -0
- package/dist/__wallet__/mobile/manager.d.ts +35 -0
- package/dist/__wallet__/mobile/manager.d.ts.map +1 -0
- package/dist/__wallet__/mobile/manager.js +95 -0
- package/dist/__wallet__/mobile/manager.js.map +1 -0
- package/dist/__wallet__/mobile/manager.mjs +93 -0
- package/dist/__wallet__/mobile/manager.mjs.map +1 -0
- package/dist/__wallet__/stamper.d.ts +19 -0
- package/dist/__wallet__/stamper.d.ts.map +1 -0
- package/dist/__wallet__/stamper.js +116 -0
- package/dist/__wallet__/stamper.js.map +1 -0
- package/dist/__wallet__/stamper.mjs +113 -0
- package/dist/__wallet__/stamper.mjs.map +1 -0
- package/dist/__wallet__/wallet-connect/base.d.ts +83 -0
- package/dist/__wallet__/wallet-connect/base.d.ts.map +1 -0
- package/dist/__wallet__/wallet-connect/base.js +362 -0
- package/dist/__wallet__/wallet-connect/base.js.map +1 -0
- package/dist/__wallet__/wallet-connect/base.mjs +360 -0
- package/dist/__wallet__/wallet-connect/base.mjs.map +1 -0
- package/dist/__wallet__/wallet-connect/client.d.ts +78 -0
- package/dist/__wallet__/wallet-connect/client.d.ts.map +1 -0
- package/dist/__wallet__/wallet-connect/client.js +139 -0
- package/dist/__wallet__/wallet-connect/client.js.map +1 -0
- package/dist/__wallet__/wallet-connect/client.mjs +137 -0
- package/dist/__wallet__/wallet-connect/client.mjs.map +1 -0
- package/dist/__wallet__/web/manager.d.ts +41 -0
- package/dist/__wallet__/web/manager.d.ts.map +1 -0
- package/dist/__wallet__/web/manager.js +115 -0
- package/dist/__wallet__/web/manager.js.map +1 -0
- package/dist/__wallet__/web/manager.mjs +113 -0
- package/dist/__wallet__/web/manager.mjs.map +1 -0
- package/dist/__wallet__/web/native/ethereum.d.ts +67 -0
- package/dist/__wallet__/web/native/ethereum.d.ts.map +1 -0
- package/dist/__wallet__/web/native/ethereum.js +248 -0
- package/dist/__wallet__/web/native/ethereum.js.map +1 -0
- package/dist/__wallet__/web/native/ethereum.mjs +245 -0
- package/dist/__wallet__/web/native/ethereum.mjs.map +1 -0
- package/dist/__wallet__/web/native/solana.d.ts +19 -0
- package/dist/__wallet__/web/native/solana.d.ts.map +1 -0
- package/dist/__wallet__/web/native/solana.js +149 -0
- package/dist/__wallet__/web/native/solana.js.map +1 -0
- package/dist/__wallet__/web/native/solana.mjs +146 -0
- package/dist/__wallet__/web/native/solana.mjs.map +1 -0
- package/dist/index.d.ts +9 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +78 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +8 -0
- package/dist/index.mjs.map +1 -0
- package/dist/turnkey-helpers.d.ts +68 -0
- package/dist/turnkey-helpers.d.ts.map +1 -0
- package/dist/turnkey-helpers.js +466 -0
- package/dist/turnkey-helpers.js.map +1 -0
- package/dist/turnkey-helpers.mjs +399 -0
- package/dist/turnkey-helpers.mjs.map +1 -0
- package/dist/utils.d.ts +54 -0
- package/dist/utils.d.ts.map +1 -0
- package/dist/utils.js +596 -0
- package/dist/utils.js.map +1 -0
- package/dist/utils.mjs +574 -0
- package/dist/utils.mjs.map +1 -0
- package/package.json +67 -0
|
@@ -0,0 +1,3219 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var http = require('@turnkey/http');
|
|
4
|
+
var base = require('../__types__/base.js');
|
|
5
|
+
var version = require('./version.js');
|
|
6
|
+
var sdkTypes = require('@turnkey/sdk-types');
|
|
7
|
+
var utils = require('../utils.js');
|
|
8
|
+
|
|
9
|
+
/* @generated by codegen. DO NOT EDIT BY HAND */
|
|
10
|
+
class TurnkeySDKClientBase {
|
|
11
|
+
constructor(config) {
|
|
12
|
+
this.getActivity = async (input, stampWith) => {
|
|
13
|
+
let session = await this.storageManager?.getActiveSession();
|
|
14
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
15
|
+
return this.request("/public/v1/query/get_activity", {
|
|
16
|
+
...input,
|
|
17
|
+
organizationId: input.organizationId ??
|
|
18
|
+
session?.organizationId ??
|
|
19
|
+
this.config.organizationId,
|
|
20
|
+
}, stampWith);
|
|
21
|
+
};
|
|
22
|
+
this.stampGetActivity = async (input, stampWith) => {
|
|
23
|
+
const activeStamper = this.getStamper(stampWith);
|
|
24
|
+
if (!activeStamper) {
|
|
25
|
+
return undefined;
|
|
26
|
+
}
|
|
27
|
+
const { organizationId, ...parameters } = input;
|
|
28
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_activity";
|
|
29
|
+
const bodyWithType = {
|
|
30
|
+
parameters,
|
|
31
|
+
organizationId,
|
|
32
|
+
type: "ACTIVITY_TYPE_GET_ACTIVITY",
|
|
33
|
+
};
|
|
34
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
35
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
36
|
+
return {
|
|
37
|
+
body: stringifiedBody,
|
|
38
|
+
stamp: stamp,
|
|
39
|
+
url: fullUrl,
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
this.getApiKey = async (input, stampWith) => {
|
|
43
|
+
let session = await this.storageManager?.getActiveSession();
|
|
44
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
45
|
+
return this.request("/public/v1/query/get_api_key", {
|
|
46
|
+
...input,
|
|
47
|
+
organizationId: input.organizationId ??
|
|
48
|
+
session?.organizationId ??
|
|
49
|
+
this.config.organizationId,
|
|
50
|
+
}, stampWith);
|
|
51
|
+
};
|
|
52
|
+
this.stampGetApiKey = async (input, stampWith) => {
|
|
53
|
+
const activeStamper = this.getStamper(stampWith);
|
|
54
|
+
if (!activeStamper) {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
const { organizationId, ...parameters } = input;
|
|
58
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_api_key";
|
|
59
|
+
const bodyWithType = {
|
|
60
|
+
parameters,
|
|
61
|
+
organizationId,
|
|
62
|
+
type: "ACTIVITY_TYPE_GET_API_KEY",
|
|
63
|
+
};
|
|
64
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
65
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
66
|
+
return {
|
|
67
|
+
body: stringifiedBody,
|
|
68
|
+
stamp: stamp,
|
|
69
|
+
url: fullUrl,
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
this.getApiKeys = async (input = {}, stampWith) => {
|
|
73
|
+
let session = await this.storageManager?.getActiveSession();
|
|
74
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
75
|
+
return this.request("/public/v1/query/get_api_keys", {
|
|
76
|
+
...input,
|
|
77
|
+
organizationId: input.organizationId ??
|
|
78
|
+
session?.organizationId ??
|
|
79
|
+
this.config.organizationId,
|
|
80
|
+
}, stampWith);
|
|
81
|
+
};
|
|
82
|
+
this.stampGetApiKeys = async (input, stampWith) => {
|
|
83
|
+
const activeStamper = this.getStamper(stampWith);
|
|
84
|
+
if (!activeStamper) {
|
|
85
|
+
return undefined;
|
|
86
|
+
}
|
|
87
|
+
const { organizationId, ...parameters } = input;
|
|
88
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_api_keys";
|
|
89
|
+
const bodyWithType = {
|
|
90
|
+
parameters,
|
|
91
|
+
organizationId,
|
|
92
|
+
type: "ACTIVITY_TYPE_GET_API_KEYS",
|
|
93
|
+
};
|
|
94
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
95
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
96
|
+
return {
|
|
97
|
+
body: stringifiedBody,
|
|
98
|
+
stamp: stamp,
|
|
99
|
+
url: fullUrl,
|
|
100
|
+
};
|
|
101
|
+
};
|
|
102
|
+
this.getAttestationDocument = async (input, stampWith) => {
|
|
103
|
+
let session = await this.storageManager?.getActiveSession();
|
|
104
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
105
|
+
return this.request("/public/v1/query/get_attestation", {
|
|
106
|
+
...input,
|
|
107
|
+
organizationId: input.organizationId ??
|
|
108
|
+
session?.organizationId ??
|
|
109
|
+
this.config.organizationId,
|
|
110
|
+
}, stampWith);
|
|
111
|
+
};
|
|
112
|
+
this.stampGetAttestationDocument = async (input, stampWith) => {
|
|
113
|
+
const activeStamper = this.getStamper(stampWith);
|
|
114
|
+
if (!activeStamper) {
|
|
115
|
+
return undefined;
|
|
116
|
+
}
|
|
117
|
+
const { organizationId, ...parameters } = input;
|
|
118
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_attestation";
|
|
119
|
+
const bodyWithType = {
|
|
120
|
+
parameters,
|
|
121
|
+
organizationId,
|
|
122
|
+
type: "ACTIVITY_TYPE_GET_ATTESTATION_DOCUMENT",
|
|
123
|
+
};
|
|
124
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
125
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
126
|
+
return {
|
|
127
|
+
body: stringifiedBody,
|
|
128
|
+
stamp: stamp,
|
|
129
|
+
url: fullUrl,
|
|
130
|
+
};
|
|
131
|
+
};
|
|
132
|
+
this.getAuthenticator = async (input, stampWith) => {
|
|
133
|
+
let session = await this.storageManager?.getActiveSession();
|
|
134
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
135
|
+
return this.request("/public/v1/query/get_authenticator", {
|
|
136
|
+
...input,
|
|
137
|
+
organizationId: input.organizationId ??
|
|
138
|
+
session?.organizationId ??
|
|
139
|
+
this.config.organizationId,
|
|
140
|
+
}, stampWith);
|
|
141
|
+
};
|
|
142
|
+
this.stampGetAuthenticator = async (input, stampWith) => {
|
|
143
|
+
const activeStamper = this.getStamper(stampWith);
|
|
144
|
+
if (!activeStamper) {
|
|
145
|
+
return undefined;
|
|
146
|
+
}
|
|
147
|
+
const { organizationId, ...parameters } = input;
|
|
148
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_authenticator";
|
|
149
|
+
const bodyWithType = {
|
|
150
|
+
parameters,
|
|
151
|
+
organizationId,
|
|
152
|
+
type: "ACTIVITY_TYPE_GET_AUTHENTICATOR",
|
|
153
|
+
};
|
|
154
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
155
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
156
|
+
return {
|
|
157
|
+
body: stringifiedBody,
|
|
158
|
+
stamp: stamp,
|
|
159
|
+
url: fullUrl,
|
|
160
|
+
};
|
|
161
|
+
};
|
|
162
|
+
this.getAuthenticators = async (input, stampWith) => {
|
|
163
|
+
let session = await this.storageManager?.getActiveSession();
|
|
164
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
165
|
+
return this.request("/public/v1/query/get_authenticators", {
|
|
166
|
+
...input,
|
|
167
|
+
organizationId: input.organizationId ??
|
|
168
|
+
session?.organizationId ??
|
|
169
|
+
this.config.organizationId,
|
|
170
|
+
}, stampWith);
|
|
171
|
+
};
|
|
172
|
+
this.stampGetAuthenticators = async (input, stampWith) => {
|
|
173
|
+
const activeStamper = this.getStamper(stampWith);
|
|
174
|
+
if (!activeStamper) {
|
|
175
|
+
return undefined;
|
|
176
|
+
}
|
|
177
|
+
const { organizationId, ...parameters } = input;
|
|
178
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_authenticators";
|
|
179
|
+
const bodyWithType = {
|
|
180
|
+
parameters,
|
|
181
|
+
organizationId,
|
|
182
|
+
type: "ACTIVITY_TYPE_GET_AUTHENTICATORS",
|
|
183
|
+
};
|
|
184
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
185
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
186
|
+
return {
|
|
187
|
+
body: stringifiedBody,
|
|
188
|
+
stamp: stamp,
|
|
189
|
+
url: fullUrl,
|
|
190
|
+
};
|
|
191
|
+
};
|
|
192
|
+
this.getOauthProviders = async (input, stampWith) => {
|
|
193
|
+
let session = await this.storageManager?.getActiveSession();
|
|
194
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
195
|
+
return this.request("/public/v1/query/get_oauth_providers", {
|
|
196
|
+
...input,
|
|
197
|
+
organizationId: input.organizationId ??
|
|
198
|
+
session?.organizationId ??
|
|
199
|
+
this.config.organizationId,
|
|
200
|
+
}, stampWith);
|
|
201
|
+
};
|
|
202
|
+
this.stampGetOauthProviders = async (input, stampWith) => {
|
|
203
|
+
const activeStamper = this.getStamper(stampWith);
|
|
204
|
+
if (!activeStamper) {
|
|
205
|
+
return undefined;
|
|
206
|
+
}
|
|
207
|
+
const { organizationId, ...parameters } = input;
|
|
208
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_oauth_providers";
|
|
209
|
+
const bodyWithType = {
|
|
210
|
+
parameters,
|
|
211
|
+
organizationId,
|
|
212
|
+
type: "ACTIVITY_TYPE_GET_OAUTH_PROVIDERS",
|
|
213
|
+
};
|
|
214
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
215
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
216
|
+
return {
|
|
217
|
+
body: stringifiedBody,
|
|
218
|
+
stamp: stamp,
|
|
219
|
+
url: fullUrl,
|
|
220
|
+
};
|
|
221
|
+
};
|
|
222
|
+
this.getOrganization = async (input = {}, stampWith) => {
|
|
223
|
+
let session = await this.storageManager?.getActiveSession();
|
|
224
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
225
|
+
return this.request("/public/v1/query/get_organization", {
|
|
226
|
+
...input,
|
|
227
|
+
organizationId: input.organizationId ??
|
|
228
|
+
session?.organizationId ??
|
|
229
|
+
this.config.organizationId,
|
|
230
|
+
}, stampWith);
|
|
231
|
+
};
|
|
232
|
+
this.stampGetOrganization = async (input, stampWith) => {
|
|
233
|
+
const activeStamper = this.getStamper(stampWith);
|
|
234
|
+
if (!activeStamper) {
|
|
235
|
+
return undefined;
|
|
236
|
+
}
|
|
237
|
+
const { organizationId, ...parameters } = input;
|
|
238
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_organization";
|
|
239
|
+
const bodyWithType = {
|
|
240
|
+
parameters,
|
|
241
|
+
organizationId,
|
|
242
|
+
type: "ACTIVITY_TYPE_GET_ORGANIZATION",
|
|
243
|
+
};
|
|
244
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
245
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
246
|
+
return {
|
|
247
|
+
body: stringifiedBody,
|
|
248
|
+
stamp: stamp,
|
|
249
|
+
url: fullUrl,
|
|
250
|
+
};
|
|
251
|
+
};
|
|
252
|
+
this.getOrganizationConfigs = async (input, stampWith) => {
|
|
253
|
+
let session = await this.storageManager?.getActiveSession();
|
|
254
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
255
|
+
return this.request("/public/v1/query/get_organization_configs", {
|
|
256
|
+
...input,
|
|
257
|
+
organizationId: input.organizationId ??
|
|
258
|
+
session?.organizationId ??
|
|
259
|
+
this.config.organizationId,
|
|
260
|
+
}, stampWith);
|
|
261
|
+
};
|
|
262
|
+
this.stampGetOrganizationConfigs = async (input, stampWith) => {
|
|
263
|
+
const activeStamper = this.getStamper(stampWith);
|
|
264
|
+
if (!activeStamper) {
|
|
265
|
+
return undefined;
|
|
266
|
+
}
|
|
267
|
+
const { organizationId, ...parameters } = input;
|
|
268
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_organization_configs";
|
|
269
|
+
const bodyWithType = {
|
|
270
|
+
parameters,
|
|
271
|
+
organizationId,
|
|
272
|
+
type: "ACTIVITY_TYPE_GET_ORGANIZATION_CONFIGS",
|
|
273
|
+
};
|
|
274
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
275
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
276
|
+
return {
|
|
277
|
+
body: stringifiedBody,
|
|
278
|
+
stamp: stamp,
|
|
279
|
+
url: fullUrl,
|
|
280
|
+
};
|
|
281
|
+
};
|
|
282
|
+
this.getPolicy = async (input, stampWith) => {
|
|
283
|
+
let session = await this.storageManager?.getActiveSession();
|
|
284
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
285
|
+
return this.request("/public/v1/query/get_policy", {
|
|
286
|
+
...input,
|
|
287
|
+
organizationId: input.organizationId ??
|
|
288
|
+
session?.organizationId ??
|
|
289
|
+
this.config.organizationId,
|
|
290
|
+
}, stampWith);
|
|
291
|
+
};
|
|
292
|
+
this.stampGetPolicy = async (input, stampWith) => {
|
|
293
|
+
const activeStamper = this.getStamper(stampWith);
|
|
294
|
+
if (!activeStamper) {
|
|
295
|
+
return undefined;
|
|
296
|
+
}
|
|
297
|
+
const { organizationId, ...parameters } = input;
|
|
298
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_policy";
|
|
299
|
+
const bodyWithType = {
|
|
300
|
+
parameters,
|
|
301
|
+
organizationId,
|
|
302
|
+
type: "ACTIVITY_TYPE_GET_POLICY",
|
|
303
|
+
};
|
|
304
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
305
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
306
|
+
return {
|
|
307
|
+
body: stringifiedBody,
|
|
308
|
+
stamp: stamp,
|
|
309
|
+
url: fullUrl,
|
|
310
|
+
};
|
|
311
|
+
};
|
|
312
|
+
this.getPolicyEvaluations = async (input, stampWith) => {
|
|
313
|
+
let session = await this.storageManager?.getActiveSession();
|
|
314
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
315
|
+
return this.request("/public/v1/query/get_policy_evaluations", {
|
|
316
|
+
...input,
|
|
317
|
+
organizationId: input.organizationId ??
|
|
318
|
+
session?.organizationId ??
|
|
319
|
+
this.config.organizationId,
|
|
320
|
+
}, stampWith);
|
|
321
|
+
};
|
|
322
|
+
this.stampGetPolicyEvaluations = async (input, stampWith) => {
|
|
323
|
+
const activeStamper = this.getStamper(stampWith);
|
|
324
|
+
if (!activeStamper) {
|
|
325
|
+
return undefined;
|
|
326
|
+
}
|
|
327
|
+
const { organizationId, ...parameters } = input;
|
|
328
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_policy_evaluations";
|
|
329
|
+
const bodyWithType = {
|
|
330
|
+
parameters,
|
|
331
|
+
organizationId,
|
|
332
|
+
type: "ACTIVITY_TYPE_GET_POLICY_EVALUATIONS",
|
|
333
|
+
};
|
|
334
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
335
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
336
|
+
return {
|
|
337
|
+
body: stringifiedBody,
|
|
338
|
+
stamp: stamp,
|
|
339
|
+
url: fullUrl,
|
|
340
|
+
};
|
|
341
|
+
};
|
|
342
|
+
this.getPrivateKey = async (input, stampWith) => {
|
|
343
|
+
let session = await this.storageManager?.getActiveSession();
|
|
344
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
345
|
+
return this.request("/public/v1/query/get_private_key", {
|
|
346
|
+
...input,
|
|
347
|
+
organizationId: input.organizationId ??
|
|
348
|
+
session?.organizationId ??
|
|
349
|
+
this.config.organizationId,
|
|
350
|
+
}, stampWith);
|
|
351
|
+
};
|
|
352
|
+
this.stampGetPrivateKey = async (input, stampWith) => {
|
|
353
|
+
const activeStamper = this.getStamper(stampWith);
|
|
354
|
+
if (!activeStamper) {
|
|
355
|
+
return undefined;
|
|
356
|
+
}
|
|
357
|
+
const { organizationId, ...parameters } = input;
|
|
358
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_private_key";
|
|
359
|
+
const bodyWithType = {
|
|
360
|
+
parameters,
|
|
361
|
+
organizationId,
|
|
362
|
+
type: "ACTIVITY_TYPE_GET_PRIVATE_KEY",
|
|
363
|
+
};
|
|
364
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
365
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
366
|
+
return {
|
|
367
|
+
body: stringifiedBody,
|
|
368
|
+
stamp: stamp,
|
|
369
|
+
url: fullUrl,
|
|
370
|
+
};
|
|
371
|
+
};
|
|
372
|
+
this.getSmartContractInterface = async (input, stampWith) => {
|
|
373
|
+
let session = await this.storageManager?.getActiveSession();
|
|
374
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
375
|
+
return this.request("/public/v1/query/get_smart_contract_interface", {
|
|
376
|
+
...input,
|
|
377
|
+
organizationId: input.organizationId ??
|
|
378
|
+
session?.organizationId ??
|
|
379
|
+
this.config.organizationId,
|
|
380
|
+
}, stampWith);
|
|
381
|
+
};
|
|
382
|
+
this.stampGetSmartContractInterface = async (input, stampWith) => {
|
|
383
|
+
const activeStamper = this.getStamper(stampWith);
|
|
384
|
+
if (!activeStamper) {
|
|
385
|
+
return undefined;
|
|
386
|
+
}
|
|
387
|
+
const { organizationId, ...parameters } = input;
|
|
388
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_smart_contract_interface";
|
|
389
|
+
const bodyWithType = {
|
|
390
|
+
parameters,
|
|
391
|
+
organizationId,
|
|
392
|
+
type: "ACTIVITY_TYPE_GET_SMART_CONTRACT_INTERFACE",
|
|
393
|
+
};
|
|
394
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
395
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
396
|
+
return {
|
|
397
|
+
body: stringifiedBody,
|
|
398
|
+
stamp: stamp,
|
|
399
|
+
url: fullUrl,
|
|
400
|
+
};
|
|
401
|
+
};
|
|
402
|
+
this.getUser = async (input, stampWith) => {
|
|
403
|
+
let session = await this.storageManager?.getActiveSession();
|
|
404
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
405
|
+
return this.request("/public/v1/query/get_user", {
|
|
406
|
+
...input,
|
|
407
|
+
organizationId: input.organizationId ??
|
|
408
|
+
session?.organizationId ??
|
|
409
|
+
this.config.organizationId,
|
|
410
|
+
}, stampWith);
|
|
411
|
+
};
|
|
412
|
+
this.stampGetUser = async (input, stampWith) => {
|
|
413
|
+
const activeStamper = this.getStamper(stampWith);
|
|
414
|
+
if (!activeStamper) {
|
|
415
|
+
return undefined;
|
|
416
|
+
}
|
|
417
|
+
const { organizationId, ...parameters } = input;
|
|
418
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_user";
|
|
419
|
+
const bodyWithType = {
|
|
420
|
+
parameters,
|
|
421
|
+
organizationId,
|
|
422
|
+
type: "ACTIVITY_TYPE_GET_USER",
|
|
423
|
+
};
|
|
424
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
425
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
426
|
+
return {
|
|
427
|
+
body: stringifiedBody,
|
|
428
|
+
stamp: stamp,
|
|
429
|
+
url: fullUrl,
|
|
430
|
+
};
|
|
431
|
+
};
|
|
432
|
+
this.getWallet = async (input, stampWith) => {
|
|
433
|
+
let session = await this.storageManager?.getActiveSession();
|
|
434
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
435
|
+
return this.request("/public/v1/query/get_wallet", {
|
|
436
|
+
...input,
|
|
437
|
+
organizationId: input.organizationId ??
|
|
438
|
+
session?.organizationId ??
|
|
439
|
+
this.config.organizationId,
|
|
440
|
+
}, stampWith);
|
|
441
|
+
};
|
|
442
|
+
this.stampGetWallet = async (input, stampWith) => {
|
|
443
|
+
const activeStamper = this.getStamper(stampWith);
|
|
444
|
+
if (!activeStamper) {
|
|
445
|
+
return undefined;
|
|
446
|
+
}
|
|
447
|
+
const { organizationId, ...parameters } = input;
|
|
448
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_wallet";
|
|
449
|
+
const bodyWithType = {
|
|
450
|
+
parameters,
|
|
451
|
+
organizationId,
|
|
452
|
+
type: "ACTIVITY_TYPE_GET_WALLET",
|
|
453
|
+
};
|
|
454
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
455
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
456
|
+
return {
|
|
457
|
+
body: stringifiedBody,
|
|
458
|
+
stamp: stamp,
|
|
459
|
+
url: fullUrl,
|
|
460
|
+
};
|
|
461
|
+
};
|
|
462
|
+
this.getWalletAccount = async (input, stampWith) => {
|
|
463
|
+
let session = await this.storageManager?.getActiveSession();
|
|
464
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
465
|
+
return this.request("/public/v1/query/get_wallet_account", {
|
|
466
|
+
...input,
|
|
467
|
+
organizationId: input.organizationId ??
|
|
468
|
+
session?.organizationId ??
|
|
469
|
+
this.config.organizationId,
|
|
470
|
+
}, stampWith);
|
|
471
|
+
};
|
|
472
|
+
this.stampGetWalletAccount = async (input, stampWith) => {
|
|
473
|
+
const activeStamper = this.getStamper(stampWith);
|
|
474
|
+
if (!activeStamper) {
|
|
475
|
+
return undefined;
|
|
476
|
+
}
|
|
477
|
+
const { organizationId, ...parameters } = input;
|
|
478
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/get_wallet_account";
|
|
479
|
+
const bodyWithType = {
|
|
480
|
+
parameters,
|
|
481
|
+
organizationId,
|
|
482
|
+
type: "ACTIVITY_TYPE_GET_WALLET_ACCOUNT",
|
|
483
|
+
};
|
|
484
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
485
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
486
|
+
return {
|
|
487
|
+
body: stringifiedBody,
|
|
488
|
+
stamp: stamp,
|
|
489
|
+
url: fullUrl,
|
|
490
|
+
};
|
|
491
|
+
};
|
|
492
|
+
this.getActivities = async (input = {}, stampWith) => {
|
|
493
|
+
let session = await this.storageManager?.getActiveSession();
|
|
494
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
495
|
+
return this.request("/public/v1/query/list_activities", {
|
|
496
|
+
...input,
|
|
497
|
+
organizationId: input.organizationId ??
|
|
498
|
+
session?.organizationId ??
|
|
499
|
+
this.config.organizationId,
|
|
500
|
+
}, stampWith);
|
|
501
|
+
};
|
|
502
|
+
this.stampGetActivities = async (input, stampWith) => {
|
|
503
|
+
const activeStamper = this.getStamper(stampWith);
|
|
504
|
+
if (!activeStamper) {
|
|
505
|
+
return undefined;
|
|
506
|
+
}
|
|
507
|
+
const { organizationId, ...parameters } = input;
|
|
508
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_activities";
|
|
509
|
+
const bodyWithType = {
|
|
510
|
+
parameters,
|
|
511
|
+
organizationId,
|
|
512
|
+
type: "ACTIVITY_TYPE_GET_ACTIVITIES",
|
|
513
|
+
};
|
|
514
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
515
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
516
|
+
return {
|
|
517
|
+
body: stringifiedBody,
|
|
518
|
+
stamp: stamp,
|
|
519
|
+
url: fullUrl,
|
|
520
|
+
};
|
|
521
|
+
};
|
|
522
|
+
this.getPolicies = async (input = {}, stampWith) => {
|
|
523
|
+
let session = await this.storageManager?.getActiveSession();
|
|
524
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
525
|
+
return this.request("/public/v1/query/list_policies", {
|
|
526
|
+
...input,
|
|
527
|
+
organizationId: input.organizationId ??
|
|
528
|
+
session?.organizationId ??
|
|
529
|
+
this.config.organizationId,
|
|
530
|
+
}, stampWith);
|
|
531
|
+
};
|
|
532
|
+
this.stampGetPolicies = async (input, stampWith) => {
|
|
533
|
+
const activeStamper = this.getStamper(stampWith);
|
|
534
|
+
if (!activeStamper) {
|
|
535
|
+
return undefined;
|
|
536
|
+
}
|
|
537
|
+
const { organizationId, ...parameters } = input;
|
|
538
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_policies";
|
|
539
|
+
const bodyWithType = {
|
|
540
|
+
parameters,
|
|
541
|
+
organizationId,
|
|
542
|
+
type: "ACTIVITY_TYPE_GET_POLICIES",
|
|
543
|
+
};
|
|
544
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
545
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
546
|
+
return {
|
|
547
|
+
body: stringifiedBody,
|
|
548
|
+
stamp: stamp,
|
|
549
|
+
url: fullUrl,
|
|
550
|
+
};
|
|
551
|
+
};
|
|
552
|
+
this.listPrivateKeyTags = async (input, stampWith) => {
|
|
553
|
+
let session = await this.storageManager?.getActiveSession();
|
|
554
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
555
|
+
return this.request("/public/v1/query/list_private_key_tags", {
|
|
556
|
+
...input,
|
|
557
|
+
organizationId: input.organizationId ??
|
|
558
|
+
session?.organizationId ??
|
|
559
|
+
this.config.organizationId,
|
|
560
|
+
}, stampWith);
|
|
561
|
+
};
|
|
562
|
+
this.stampListPrivateKeyTags = async (input, stampWith) => {
|
|
563
|
+
const activeStamper = this.getStamper(stampWith);
|
|
564
|
+
if (!activeStamper) {
|
|
565
|
+
return undefined;
|
|
566
|
+
}
|
|
567
|
+
const { organizationId, ...parameters } = input;
|
|
568
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_private_key_tags";
|
|
569
|
+
const bodyWithType = {
|
|
570
|
+
parameters,
|
|
571
|
+
organizationId,
|
|
572
|
+
type: "ACTIVITY_TYPE_LIST_PRIVATE_KEY_TAGS",
|
|
573
|
+
};
|
|
574
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
575
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
576
|
+
return {
|
|
577
|
+
body: stringifiedBody,
|
|
578
|
+
stamp: stamp,
|
|
579
|
+
url: fullUrl,
|
|
580
|
+
};
|
|
581
|
+
};
|
|
582
|
+
this.getPrivateKeys = async (input = {}, stampWith) => {
|
|
583
|
+
let session = await this.storageManager?.getActiveSession();
|
|
584
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
585
|
+
return this.request("/public/v1/query/list_private_keys", {
|
|
586
|
+
...input,
|
|
587
|
+
organizationId: input.organizationId ??
|
|
588
|
+
session?.organizationId ??
|
|
589
|
+
this.config.organizationId,
|
|
590
|
+
}, stampWith);
|
|
591
|
+
};
|
|
592
|
+
this.stampGetPrivateKeys = async (input, stampWith) => {
|
|
593
|
+
const activeStamper = this.getStamper(stampWith);
|
|
594
|
+
if (!activeStamper) {
|
|
595
|
+
return undefined;
|
|
596
|
+
}
|
|
597
|
+
const { organizationId, ...parameters } = input;
|
|
598
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_private_keys";
|
|
599
|
+
const bodyWithType = {
|
|
600
|
+
parameters,
|
|
601
|
+
organizationId,
|
|
602
|
+
type: "ACTIVITY_TYPE_GET_PRIVATE_KEYS",
|
|
603
|
+
};
|
|
604
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
605
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
606
|
+
return {
|
|
607
|
+
body: stringifiedBody,
|
|
608
|
+
stamp: stamp,
|
|
609
|
+
url: fullUrl,
|
|
610
|
+
};
|
|
611
|
+
};
|
|
612
|
+
this.getSmartContractInterfaces = async (input, stampWith) => {
|
|
613
|
+
let session = await this.storageManager?.getActiveSession();
|
|
614
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
615
|
+
return this.request("/public/v1/query/list_smart_contract_interfaces", {
|
|
616
|
+
...input,
|
|
617
|
+
organizationId: input.organizationId ??
|
|
618
|
+
session?.organizationId ??
|
|
619
|
+
this.config.organizationId,
|
|
620
|
+
}, stampWith);
|
|
621
|
+
};
|
|
622
|
+
this.stampGetSmartContractInterfaces = async (input, stampWith) => {
|
|
623
|
+
const activeStamper = this.getStamper(stampWith);
|
|
624
|
+
if (!activeStamper) {
|
|
625
|
+
return undefined;
|
|
626
|
+
}
|
|
627
|
+
const { organizationId, ...parameters } = input;
|
|
628
|
+
const fullUrl = this.config.apiBaseUrl +
|
|
629
|
+
"/public/v1/query/list_smart_contract_interfaces";
|
|
630
|
+
const bodyWithType = {
|
|
631
|
+
parameters,
|
|
632
|
+
organizationId,
|
|
633
|
+
type: "ACTIVITY_TYPE_GET_SMART_CONTRACT_INTERFACES",
|
|
634
|
+
};
|
|
635
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
636
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
637
|
+
return {
|
|
638
|
+
body: stringifiedBody,
|
|
639
|
+
stamp: stamp,
|
|
640
|
+
url: fullUrl,
|
|
641
|
+
};
|
|
642
|
+
};
|
|
643
|
+
this.getSubOrgIds = async (input = {}, stampWith) => {
|
|
644
|
+
let session = await this.storageManager?.getActiveSession();
|
|
645
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
646
|
+
return this.request("/public/v1/query/list_suborgs", {
|
|
647
|
+
...input,
|
|
648
|
+
organizationId: input.organizationId ??
|
|
649
|
+
session?.organizationId ??
|
|
650
|
+
this.config.organizationId,
|
|
651
|
+
}, stampWith);
|
|
652
|
+
};
|
|
653
|
+
this.stampGetSubOrgIds = async (input, stampWith) => {
|
|
654
|
+
const activeStamper = this.getStamper(stampWith);
|
|
655
|
+
if (!activeStamper) {
|
|
656
|
+
return undefined;
|
|
657
|
+
}
|
|
658
|
+
const { organizationId, ...parameters } = input;
|
|
659
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_suborgs";
|
|
660
|
+
const bodyWithType = {
|
|
661
|
+
parameters,
|
|
662
|
+
organizationId,
|
|
663
|
+
type: "ACTIVITY_TYPE_GET_SUB_ORG_IDS",
|
|
664
|
+
};
|
|
665
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
666
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
667
|
+
return {
|
|
668
|
+
body: stringifiedBody,
|
|
669
|
+
stamp: stamp,
|
|
670
|
+
url: fullUrl,
|
|
671
|
+
};
|
|
672
|
+
};
|
|
673
|
+
this.listUserTags = async (input = {}, stampWith) => {
|
|
674
|
+
let session = await this.storageManager?.getActiveSession();
|
|
675
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
676
|
+
return this.request("/public/v1/query/list_user_tags", {
|
|
677
|
+
...input,
|
|
678
|
+
organizationId: input.organizationId ??
|
|
679
|
+
session?.organizationId ??
|
|
680
|
+
this.config.organizationId,
|
|
681
|
+
}, stampWith);
|
|
682
|
+
};
|
|
683
|
+
this.stampListUserTags = async (input, stampWith) => {
|
|
684
|
+
const activeStamper = this.getStamper(stampWith);
|
|
685
|
+
if (!activeStamper) {
|
|
686
|
+
return undefined;
|
|
687
|
+
}
|
|
688
|
+
const { organizationId, ...parameters } = input;
|
|
689
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_user_tags";
|
|
690
|
+
const bodyWithType = {
|
|
691
|
+
parameters,
|
|
692
|
+
organizationId,
|
|
693
|
+
type: "ACTIVITY_TYPE_LIST_USER_TAGS",
|
|
694
|
+
};
|
|
695
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
696
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
697
|
+
return {
|
|
698
|
+
body: stringifiedBody,
|
|
699
|
+
stamp: stamp,
|
|
700
|
+
url: fullUrl,
|
|
701
|
+
};
|
|
702
|
+
};
|
|
703
|
+
this.getUsers = async (input = {}, stampWith) => {
|
|
704
|
+
let session = await this.storageManager?.getActiveSession();
|
|
705
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
706
|
+
return this.request("/public/v1/query/list_users", {
|
|
707
|
+
...input,
|
|
708
|
+
organizationId: input.organizationId ??
|
|
709
|
+
session?.organizationId ??
|
|
710
|
+
this.config.organizationId,
|
|
711
|
+
}, stampWith);
|
|
712
|
+
};
|
|
713
|
+
this.stampGetUsers = async (input, stampWith) => {
|
|
714
|
+
const activeStamper = this.getStamper(stampWith);
|
|
715
|
+
if (!activeStamper) {
|
|
716
|
+
return undefined;
|
|
717
|
+
}
|
|
718
|
+
const { organizationId, ...parameters } = input;
|
|
719
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_users";
|
|
720
|
+
const bodyWithType = {
|
|
721
|
+
parameters,
|
|
722
|
+
organizationId,
|
|
723
|
+
type: "ACTIVITY_TYPE_GET_USERS",
|
|
724
|
+
};
|
|
725
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
726
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
727
|
+
return {
|
|
728
|
+
body: stringifiedBody,
|
|
729
|
+
stamp: stamp,
|
|
730
|
+
url: fullUrl,
|
|
731
|
+
};
|
|
732
|
+
};
|
|
733
|
+
this.getVerifiedSubOrgIds = async (input, stampWith) => {
|
|
734
|
+
let session = await this.storageManager?.getActiveSession();
|
|
735
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
736
|
+
return this.request("/public/v1/query/list_verified_suborgs", {
|
|
737
|
+
...input,
|
|
738
|
+
organizationId: input.organizationId ??
|
|
739
|
+
session?.organizationId ??
|
|
740
|
+
this.config.organizationId,
|
|
741
|
+
}, stampWith);
|
|
742
|
+
};
|
|
743
|
+
this.stampGetVerifiedSubOrgIds = async (input, stampWith) => {
|
|
744
|
+
const activeStamper = this.getStamper(stampWith);
|
|
745
|
+
if (!activeStamper) {
|
|
746
|
+
return undefined;
|
|
747
|
+
}
|
|
748
|
+
const { organizationId, ...parameters } = input;
|
|
749
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_verified_suborgs";
|
|
750
|
+
const bodyWithType = {
|
|
751
|
+
parameters,
|
|
752
|
+
organizationId,
|
|
753
|
+
type: "ACTIVITY_TYPE_GET_VERIFIED_SUB_ORG_IDS",
|
|
754
|
+
};
|
|
755
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
756
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
757
|
+
return {
|
|
758
|
+
body: stringifiedBody,
|
|
759
|
+
stamp: stamp,
|
|
760
|
+
url: fullUrl,
|
|
761
|
+
};
|
|
762
|
+
};
|
|
763
|
+
this.getWalletAccounts = async (input, stampWith) => {
|
|
764
|
+
let session = await this.storageManager?.getActiveSession();
|
|
765
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
766
|
+
return this.request("/public/v1/query/list_wallet_accounts", {
|
|
767
|
+
...input,
|
|
768
|
+
organizationId: input.organizationId ??
|
|
769
|
+
session?.organizationId ??
|
|
770
|
+
this.config.organizationId,
|
|
771
|
+
}, stampWith);
|
|
772
|
+
};
|
|
773
|
+
this.stampGetWalletAccounts = async (input, stampWith) => {
|
|
774
|
+
const activeStamper = this.getStamper(stampWith);
|
|
775
|
+
if (!activeStamper) {
|
|
776
|
+
return undefined;
|
|
777
|
+
}
|
|
778
|
+
const { organizationId, ...parameters } = input;
|
|
779
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_wallet_accounts";
|
|
780
|
+
const bodyWithType = {
|
|
781
|
+
parameters,
|
|
782
|
+
organizationId,
|
|
783
|
+
type: "ACTIVITY_TYPE_GET_WALLET_ACCOUNTS",
|
|
784
|
+
};
|
|
785
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
786
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
787
|
+
return {
|
|
788
|
+
body: stringifiedBody,
|
|
789
|
+
stamp: stamp,
|
|
790
|
+
url: fullUrl,
|
|
791
|
+
};
|
|
792
|
+
};
|
|
793
|
+
this.getWallets = async (input = {}, stampWith) => {
|
|
794
|
+
let session = await this.storageManager?.getActiveSession();
|
|
795
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
796
|
+
return this.request("/public/v1/query/list_wallets", {
|
|
797
|
+
...input,
|
|
798
|
+
organizationId: input.organizationId ??
|
|
799
|
+
session?.organizationId ??
|
|
800
|
+
this.config.organizationId,
|
|
801
|
+
}, stampWith);
|
|
802
|
+
};
|
|
803
|
+
this.stampGetWallets = async (input, stampWith) => {
|
|
804
|
+
const activeStamper = this.getStamper(stampWith);
|
|
805
|
+
if (!activeStamper) {
|
|
806
|
+
return undefined;
|
|
807
|
+
}
|
|
808
|
+
const { organizationId, ...parameters } = input;
|
|
809
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/list_wallets";
|
|
810
|
+
const bodyWithType = {
|
|
811
|
+
parameters,
|
|
812
|
+
organizationId,
|
|
813
|
+
type: "ACTIVITY_TYPE_GET_WALLETS",
|
|
814
|
+
};
|
|
815
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
816
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
817
|
+
return {
|
|
818
|
+
body: stringifiedBody,
|
|
819
|
+
stamp: stamp,
|
|
820
|
+
url: fullUrl,
|
|
821
|
+
};
|
|
822
|
+
};
|
|
823
|
+
this.getWhoami = async (input = {}, stampWith) => {
|
|
824
|
+
let session = await this.storageManager?.getActiveSession();
|
|
825
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
826
|
+
return this.request("/public/v1/query/whoami", {
|
|
827
|
+
...input,
|
|
828
|
+
organizationId: input.organizationId ??
|
|
829
|
+
session?.organizationId ??
|
|
830
|
+
this.config.organizationId,
|
|
831
|
+
}, stampWith);
|
|
832
|
+
};
|
|
833
|
+
this.stampGetWhoami = async (input, stampWith) => {
|
|
834
|
+
const activeStamper = this.getStamper(stampWith);
|
|
835
|
+
if (!activeStamper) {
|
|
836
|
+
return undefined;
|
|
837
|
+
}
|
|
838
|
+
const { organizationId, ...parameters } = input;
|
|
839
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/query/whoami";
|
|
840
|
+
const bodyWithType = {
|
|
841
|
+
parameters,
|
|
842
|
+
organizationId,
|
|
843
|
+
type: "ACTIVITY_TYPE_GET_WHOAMI",
|
|
844
|
+
};
|
|
845
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
846
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
847
|
+
return {
|
|
848
|
+
body: stringifiedBody,
|
|
849
|
+
stamp: stamp,
|
|
850
|
+
url: fullUrl,
|
|
851
|
+
};
|
|
852
|
+
};
|
|
853
|
+
this.approveActivity = async (input, stampWith) => {
|
|
854
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
855
|
+
let session = await this.storageManager?.getActiveSession();
|
|
856
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
857
|
+
return this.activityDecision("/public/v1/submit/approve_activity", {
|
|
858
|
+
parameters: rest,
|
|
859
|
+
organizationId: organizationId ??
|
|
860
|
+
session?.organizationId ??
|
|
861
|
+
this.config.organizationId,
|
|
862
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
863
|
+
type: "ACTIVITY_TYPE_APPROVE_ACTIVITY",
|
|
864
|
+
}, stampWith);
|
|
865
|
+
};
|
|
866
|
+
this.stampApproveActivity = async (input, stampWith) => {
|
|
867
|
+
const activeStamper = this.getStamper(stampWith);
|
|
868
|
+
if (!activeStamper) {
|
|
869
|
+
return undefined;
|
|
870
|
+
}
|
|
871
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
872
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/approve_activity";
|
|
873
|
+
const bodyWithType = {
|
|
874
|
+
parameters,
|
|
875
|
+
organizationId,
|
|
876
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
877
|
+
type: "ACTIVITY_TYPE_APPROVE_ACTIVITY",
|
|
878
|
+
};
|
|
879
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
880
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
881
|
+
return {
|
|
882
|
+
body: stringifiedBody,
|
|
883
|
+
stamp: stamp,
|
|
884
|
+
url: fullUrl,
|
|
885
|
+
};
|
|
886
|
+
};
|
|
887
|
+
this.createApiKeys = async (input, stampWith) => {
|
|
888
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
889
|
+
let session = await this.storageManager?.getActiveSession();
|
|
890
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
891
|
+
return this.command("/public/v1/submit/create_api_keys", {
|
|
892
|
+
parameters: rest,
|
|
893
|
+
organizationId: organizationId ??
|
|
894
|
+
session?.organizationId ??
|
|
895
|
+
this.config.organizationId,
|
|
896
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
897
|
+
type: "ACTIVITY_TYPE_CREATE_API_KEYS_V2",
|
|
898
|
+
}, "createApiKeysResult", stampWith);
|
|
899
|
+
};
|
|
900
|
+
this.stampCreateApiKeys = async (input, stampWith) => {
|
|
901
|
+
const activeStamper = this.getStamper(stampWith);
|
|
902
|
+
if (!activeStamper) {
|
|
903
|
+
return undefined;
|
|
904
|
+
}
|
|
905
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
906
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_api_keys";
|
|
907
|
+
const bodyWithType = {
|
|
908
|
+
parameters,
|
|
909
|
+
organizationId,
|
|
910
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
911
|
+
type: "ACTIVITY_TYPE_CREATE_API_KEYS_V2",
|
|
912
|
+
};
|
|
913
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
914
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
915
|
+
return {
|
|
916
|
+
body: stringifiedBody,
|
|
917
|
+
stamp: stamp,
|
|
918
|
+
url: fullUrl,
|
|
919
|
+
};
|
|
920
|
+
};
|
|
921
|
+
this.createApiOnlyUsers = async (input, stampWith) => {
|
|
922
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
923
|
+
let session = await this.storageManager?.getActiveSession();
|
|
924
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
925
|
+
return this.command("/public/v1/submit/create_api_only_users", {
|
|
926
|
+
parameters: rest,
|
|
927
|
+
organizationId: organizationId ??
|
|
928
|
+
session?.organizationId ??
|
|
929
|
+
this.config.organizationId,
|
|
930
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
931
|
+
type: "ACTIVITY_TYPE_CREATE_API_ONLY_USERS",
|
|
932
|
+
}, "createApiOnlyUsersResult", stampWith);
|
|
933
|
+
};
|
|
934
|
+
this.stampCreateApiOnlyUsers = async (input, stampWith) => {
|
|
935
|
+
const activeStamper = this.getStamper(stampWith);
|
|
936
|
+
if (!activeStamper) {
|
|
937
|
+
return undefined;
|
|
938
|
+
}
|
|
939
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
940
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_api_only_users";
|
|
941
|
+
const bodyWithType = {
|
|
942
|
+
parameters,
|
|
943
|
+
organizationId,
|
|
944
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
945
|
+
type: "ACTIVITY_TYPE_CREATE_API_ONLY_USERS",
|
|
946
|
+
};
|
|
947
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
948
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
949
|
+
return {
|
|
950
|
+
body: stringifiedBody,
|
|
951
|
+
stamp: stamp,
|
|
952
|
+
url: fullUrl,
|
|
953
|
+
};
|
|
954
|
+
};
|
|
955
|
+
this.createAuthenticators = async (input, stampWith) => {
|
|
956
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
957
|
+
let session = await this.storageManager?.getActiveSession();
|
|
958
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
959
|
+
return this.command("/public/v1/submit/create_authenticators", {
|
|
960
|
+
parameters: rest,
|
|
961
|
+
organizationId: organizationId ??
|
|
962
|
+
session?.organizationId ??
|
|
963
|
+
this.config.organizationId,
|
|
964
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
965
|
+
type: "ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2",
|
|
966
|
+
}, "createAuthenticatorsResult", stampWith);
|
|
967
|
+
};
|
|
968
|
+
this.stampCreateAuthenticators = async (input, stampWith) => {
|
|
969
|
+
const activeStamper = this.getStamper(stampWith);
|
|
970
|
+
if (!activeStamper) {
|
|
971
|
+
return undefined;
|
|
972
|
+
}
|
|
973
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
974
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_authenticators";
|
|
975
|
+
const bodyWithType = {
|
|
976
|
+
parameters,
|
|
977
|
+
organizationId,
|
|
978
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
979
|
+
type: "ACTIVITY_TYPE_CREATE_AUTHENTICATORS_V2",
|
|
980
|
+
};
|
|
981
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
982
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
983
|
+
return {
|
|
984
|
+
body: stringifiedBody,
|
|
985
|
+
stamp: stamp,
|
|
986
|
+
url: fullUrl,
|
|
987
|
+
};
|
|
988
|
+
};
|
|
989
|
+
this.createInvitations = async (input, stampWith) => {
|
|
990
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
991
|
+
let session = await this.storageManager?.getActiveSession();
|
|
992
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
993
|
+
return this.command("/public/v1/submit/create_invitations", {
|
|
994
|
+
parameters: rest,
|
|
995
|
+
organizationId: organizationId ??
|
|
996
|
+
session?.organizationId ??
|
|
997
|
+
this.config.organizationId,
|
|
998
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
999
|
+
type: "ACTIVITY_TYPE_CREATE_INVITATIONS",
|
|
1000
|
+
}, "createInvitationsResult", stampWith);
|
|
1001
|
+
};
|
|
1002
|
+
this.stampCreateInvitations = async (input, stampWith) => {
|
|
1003
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1004
|
+
if (!activeStamper) {
|
|
1005
|
+
return undefined;
|
|
1006
|
+
}
|
|
1007
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1008
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_invitations";
|
|
1009
|
+
const bodyWithType = {
|
|
1010
|
+
parameters,
|
|
1011
|
+
organizationId,
|
|
1012
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1013
|
+
type: "ACTIVITY_TYPE_CREATE_INVITATIONS",
|
|
1014
|
+
};
|
|
1015
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1016
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1017
|
+
return {
|
|
1018
|
+
body: stringifiedBody,
|
|
1019
|
+
stamp: stamp,
|
|
1020
|
+
url: fullUrl,
|
|
1021
|
+
};
|
|
1022
|
+
};
|
|
1023
|
+
this.createOauthProviders = async (input, stampWith) => {
|
|
1024
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1025
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1026
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1027
|
+
return this.command("/public/v1/submit/create_oauth_providers", {
|
|
1028
|
+
parameters: rest,
|
|
1029
|
+
organizationId: organizationId ??
|
|
1030
|
+
session?.organizationId ??
|
|
1031
|
+
this.config.organizationId,
|
|
1032
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1033
|
+
type: "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS",
|
|
1034
|
+
}, "createOauthProvidersResult", stampWith);
|
|
1035
|
+
};
|
|
1036
|
+
this.stampCreateOauthProviders = async (input, stampWith) => {
|
|
1037
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1038
|
+
if (!activeStamper) {
|
|
1039
|
+
return undefined;
|
|
1040
|
+
}
|
|
1041
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1042
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_oauth_providers";
|
|
1043
|
+
const bodyWithType = {
|
|
1044
|
+
parameters,
|
|
1045
|
+
organizationId,
|
|
1046
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1047
|
+
type: "ACTIVITY_TYPE_CREATE_OAUTH_PROVIDERS",
|
|
1048
|
+
};
|
|
1049
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1050
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1051
|
+
return {
|
|
1052
|
+
body: stringifiedBody,
|
|
1053
|
+
stamp: stamp,
|
|
1054
|
+
url: fullUrl,
|
|
1055
|
+
};
|
|
1056
|
+
};
|
|
1057
|
+
this.createPolicies = async (input, stampWith) => {
|
|
1058
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1059
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1060
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1061
|
+
return this.command("/public/v1/submit/create_policies", {
|
|
1062
|
+
parameters: rest,
|
|
1063
|
+
organizationId: organizationId ??
|
|
1064
|
+
session?.organizationId ??
|
|
1065
|
+
this.config.organizationId,
|
|
1066
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1067
|
+
type: "ACTIVITY_TYPE_CREATE_POLICIES",
|
|
1068
|
+
}, "createPoliciesResult", stampWith);
|
|
1069
|
+
};
|
|
1070
|
+
this.stampCreatePolicies = async (input, stampWith) => {
|
|
1071
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1072
|
+
if (!activeStamper) {
|
|
1073
|
+
return undefined;
|
|
1074
|
+
}
|
|
1075
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1076
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_policies";
|
|
1077
|
+
const bodyWithType = {
|
|
1078
|
+
parameters,
|
|
1079
|
+
organizationId,
|
|
1080
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1081
|
+
type: "ACTIVITY_TYPE_CREATE_POLICIES",
|
|
1082
|
+
};
|
|
1083
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1084
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1085
|
+
return {
|
|
1086
|
+
body: stringifiedBody,
|
|
1087
|
+
stamp: stamp,
|
|
1088
|
+
url: fullUrl,
|
|
1089
|
+
};
|
|
1090
|
+
};
|
|
1091
|
+
this.createPolicy = async (input, stampWith) => {
|
|
1092
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1093
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1094
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1095
|
+
return this.command("/public/v1/submit/create_policy", {
|
|
1096
|
+
parameters: rest,
|
|
1097
|
+
organizationId: organizationId ??
|
|
1098
|
+
session?.organizationId ??
|
|
1099
|
+
this.config.organizationId,
|
|
1100
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1101
|
+
type: "ACTIVITY_TYPE_CREATE_POLICY_V3",
|
|
1102
|
+
}, "createPolicyResult", stampWith);
|
|
1103
|
+
};
|
|
1104
|
+
this.stampCreatePolicy = async (input, stampWith) => {
|
|
1105
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1106
|
+
if (!activeStamper) {
|
|
1107
|
+
return undefined;
|
|
1108
|
+
}
|
|
1109
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1110
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_policy";
|
|
1111
|
+
const bodyWithType = {
|
|
1112
|
+
parameters,
|
|
1113
|
+
organizationId,
|
|
1114
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1115
|
+
type: "ACTIVITY_TYPE_CREATE_POLICY_V3",
|
|
1116
|
+
};
|
|
1117
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1118
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1119
|
+
return {
|
|
1120
|
+
body: stringifiedBody,
|
|
1121
|
+
stamp: stamp,
|
|
1122
|
+
url: fullUrl,
|
|
1123
|
+
};
|
|
1124
|
+
};
|
|
1125
|
+
this.createPrivateKeyTag = async (input, stampWith) => {
|
|
1126
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1127
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1128
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1129
|
+
return this.command("/public/v1/submit/create_private_key_tag", {
|
|
1130
|
+
parameters: rest,
|
|
1131
|
+
organizationId: organizationId ??
|
|
1132
|
+
session?.organizationId ??
|
|
1133
|
+
this.config.organizationId,
|
|
1134
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1135
|
+
type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG",
|
|
1136
|
+
}, "createPrivateKeyTagResult", stampWith);
|
|
1137
|
+
};
|
|
1138
|
+
this.stampCreatePrivateKeyTag = async (input, stampWith) => {
|
|
1139
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1140
|
+
if (!activeStamper) {
|
|
1141
|
+
return undefined;
|
|
1142
|
+
}
|
|
1143
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1144
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_private_key_tag";
|
|
1145
|
+
const bodyWithType = {
|
|
1146
|
+
parameters,
|
|
1147
|
+
organizationId,
|
|
1148
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1149
|
+
type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEY_TAG",
|
|
1150
|
+
};
|
|
1151
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1152
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1153
|
+
return {
|
|
1154
|
+
body: stringifiedBody,
|
|
1155
|
+
stamp: stamp,
|
|
1156
|
+
url: fullUrl,
|
|
1157
|
+
};
|
|
1158
|
+
};
|
|
1159
|
+
this.createPrivateKeys = async (input, stampWith) => {
|
|
1160
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1161
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1162
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1163
|
+
return this.command("/public/v1/submit/create_private_keys", {
|
|
1164
|
+
parameters: rest,
|
|
1165
|
+
organizationId: organizationId ??
|
|
1166
|
+
session?.organizationId ??
|
|
1167
|
+
this.config.organizationId,
|
|
1168
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1169
|
+
type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2",
|
|
1170
|
+
}, "createPrivateKeysResultV2", stampWith);
|
|
1171
|
+
};
|
|
1172
|
+
this.stampCreatePrivateKeys = async (input, stampWith) => {
|
|
1173
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1174
|
+
if (!activeStamper) {
|
|
1175
|
+
return undefined;
|
|
1176
|
+
}
|
|
1177
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1178
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_private_keys";
|
|
1179
|
+
const bodyWithType = {
|
|
1180
|
+
parameters,
|
|
1181
|
+
organizationId,
|
|
1182
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1183
|
+
type: "ACTIVITY_TYPE_CREATE_PRIVATE_KEYS_V2",
|
|
1184
|
+
};
|
|
1185
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1186
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1187
|
+
return {
|
|
1188
|
+
body: stringifiedBody,
|
|
1189
|
+
stamp: stamp,
|
|
1190
|
+
url: fullUrl,
|
|
1191
|
+
};
|
|
1192
|
+
};
|
|
1193
|
+
this.createReadOnlySession = async (input, stampWith) => {
|
|
1194
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1195
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1196
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1197
|
+
return this.command("/public/v1/submit/create_read_only_session", {
|
|
1198
|
+
parameters: rest,
|
|
1199
|
+
organizationId: organizationId ??
|
|
1200
|
+
session?.organizationId ??
|
|
1201
|
+
this.config.organizationId,
|
|
1202
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1203
|
+
type: "ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION",
|
|
1204
|
+
}, "createReadOnlySessionResult", stampWith);
|
|
1205
|
+
};
|
|
1206
|
+
this.stampCreateReadOnlySession = async (input, stampWith) => {
|
|
1207
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1208
|
+
if (!activeStamper) {
|
|
1209
|
+
return undefined;
|
|
1210
|
+
}
|
|
1211
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1212
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_read_only_session";
|
|
1213
|
+
const bodyWithType = {
|
|
1214
|
+
parameters,
|
|
1215
|
+
organizationId,
|
|
1216
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1217
|
+
type: "ACTIVITY_TYPE_CREATE_READ_ONLY_SESSION",
|
|
1218
|
+
};
|
|
1219
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1220
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1221
|
+
return {
|
|
1222
|
+
body: stringifiedBody,
|
|
1223
|
+
stamp: stamp,
|
|
1224
|
+
url: fullUrl,
|
|
1225
|
+
};
|
|
1226
|
+
};
|
|
1227
|
+
this.createReadWriteSession = async (input, stampWith) => {
|
|
1228
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1229
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1230
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1231
|
+
return this.command("/public/v1/submit/create_read_write_session", {
|
|
1232
|
+
parameters: rest,
|
|
1233
|
+
organizationId: organizationId ??
|
|
1234
|
+
session?.organizationId ??
|
|
1235
|
+
this.config.organizationId,
|
|
1236
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1237
|
+
type: "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2",
|
|
1238
|
+
}, "createReadWriteSessionResultV2", stampWith);
|
|
1239
|
+
};
|
|
1240
|
+
this.stampCreateReadWriteSession = async (input, stampWith) => {
|
|
1241
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1242
|
+
if (!activeStamper) {
|
|
1243
|
+
return undefined;
|
|
1244
|
+
}
|
|
1245
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1246
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_read_write_session";
|
|
1247
|
+
const bodyWithType = {
|
|
1248
|
+
parameters,
|
|
1249
|
+
organizationId,
|
|
1250
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1251
|
+
type: "ACTIVITY_TYPE_CREATE_READ_WRITE_SESSION_V2",
|
|
1252
|
+
};
|
|
1253
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1254
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1255
|
+
return {
|
|
1256
|
+
body: stringifiedBody,
|
|
1257
|
+
stamp: stamp,
|
|
1258
|
+
url: fullUrl,
|
|
1259
|
+
};
|
|
1260
|
+
};
|
|
1261
|
+
this.createSmartContractInterface = async (input, stampWith) => {
|
|
1262
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1263
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1264
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1265
|
+
return this.command("/public/v1/submit/create_smart_contract_interface", {
|
|
1266
|
+
parameters: rest,
|
|
1267
|
+
organizationId: organizationId ??
|
|
1268
|
+
session?.organizationId ??
|
|
1269
|
+
this.config.organizationId,
|
|
1270
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1271
|
+
type: "ACTIVITY_TYPE_CREATE_SMART_CONTRACT_INTERFACE",
|
|
1272
|
+
}, "createSmartContractInterfaceResult", stampWith);
|
|
1273
|
+
};
|
|
1274
|
+
this.stampCreateSmartContractInterface = async (input, stampWith) => {
|
|
1275
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1276
|
+
if (!activeStamper) {
|
|
1277
|
+
return undefined;
|
|
1278
|
+
}
|
|
1279
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1280
|
+
const fullUrl = this.config.apiBaseUrl +
|
|
1281
|
+
"/public/v1/submit/create_smart_contract_interface";
|
|
1282
|
+
const bodyWithType = {
|
|
1283
|
+
parameters,
|
|
1284
|
+
organizationId,
|
|
1285
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1286
|
+
type: "ACTIVITY_TYPE_CREATE_SMART_CONTRACT_INTERFACE",
|
|
1287
|
+
};
|
|
1288
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1289
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1290
|
+
return {
|
|
1291
|
+
body: stringifiedBody,
|
|
1292
|
+
stamp: stamp,
|
|
1293
|
+
url: fullUrl,
|
|
1294
|
+
};
|
|
1295
|
+
};
|
|
1296
|
+
this.createSubOrganization = async (input, stampWith) => {
|
|
1297
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1298
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1299
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1300
|
+
return this.command("/public/v1/submit/create_sub_organization", {
|
|
1301
|
+
parameters: rest,
|
|
1302
|
+
organizationId: organizationId ??
|
|
1303
|
+
session?.organizationId ??
|
|
1304
|
+
this.config.organizationId,
|
|
1305
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1306
|
+
type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7",
|
|
1307
|
+
}, "createSubOrganizationResultV7", stampWith);
|
|
1308
|
+
};
|
|
1309
|
+
this.stampCreateSubOrganization = async (input, stampWith) => {
|
|
1310
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1311
|
+
if (!activeStamper) {
|
|
1312
|
+
return undefined;
|
|
1313
|
+
}
|
|
1314
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1315
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_sub_organization";
|
|
1316
|
+
const bodyWithType = {
|
|
1317
|
+
parameters,
|
|
1318
|
+
organizationId,
|
|
1319
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1320
|
+
type: "ACTIVITY_TYPE_CREATE_SUB_ORGANIZATION_V7",
|
|
1321
|
+
};
|
|
1322
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1323
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1324
|
+
return {
|
|
1325
|
+
body: stringifiedBody,
|
|
1326
|
+
stamp: stamp,
|
|
1327
|
+
url: fullUrl,
|
|
1328
|
+
};
|
|
1329
|
+
};
|
|
1330
|
+
this.createUserTag = async (input, stampWith) => {
|
|
1331
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1332
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1333
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1334
|
+
return this.command("/public/v1/submit/create_user_tag", {
|
|
1335
|
+
parameters: rest,
|
|
1336
|
+
organizationId: organizationId ??
|
|
1337
|
+
session?.organizationId ??
|
|
1338
|
+
this.config.organizationId,
|
|
1339
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1340
|
+
type: "ACTIVITY_TYPE_CREATE_USER_TAG",
|
|
1341
|
+
}, "createUserTagResult", stampWith);
|
|
1342
|
+
};
|
|
1343
|
+
this.stampCreateUserTag = async (input, stampWith) => {
|
|
1344
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1345
|
+
if (!activeStamper) {
|
|
1346
|
+
return undefined;
|
|
1347
|
+
}
|
|
1348
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1349
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_user_tag";
|
|
1350
|
+
const bodyWithType = {
|
|
1351
|
+
parameters,
|
|
1352
|
+
organizationId,
|
|
1353
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1354
|
+
type: "ACTIVITY_TYPE_CREATE_USER_TAG",
|
|
1355
|
+
};
|
|
1356
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1357
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1358
|
+
return {
|
|
1359
|
+
body: stringifiedBody,
|
|
1360
|
+
stamp: stamp,
|
|
1361
|
+
url: fullUrl,
|
|
1362
|
+
};
|
|
1363
|
+
};
|
|
1364
|
+
this.createUsers = async (input, stampWith) => {
|
|
1365
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1366
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1367
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1368
|
+
return this.command("/public/v1/submit/create_users", {
|
|
1369
|
+
parameters: rest,
|
|
1370
|
+
organizationId: organizationId ??
|
|
1371
|
+
session?.organizationId ??
|
|
1372
|
+
this.config.organizationId,
|
|
1373
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1374
|
+
type: "ACTIVITY_TYPE_CREATE_USERS_V3",
|
|
1375
|
+
}, "createUsersResult", stampWith);
|
|
1376
|
+
};
|
|
1377
|
+
this.stampCreateUsers = async (input, stampWith) => {
|
|
1378
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1379
|
+
if (!activeStamper) {
|
|
1380
|
+
return undefined;
|
|
1381
|
+
}
|
|
1382
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1383
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_users";
|
|
1384
|
+
const bodyWithType = {
|
|
1385
|
+
parameters,
|
|
1386
|
+
organizationId,
|
|
1387
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1388
|
+
type: "ACTIVITY_TYPE_CREATE_USERS_V3",
|
|
1389
|
+
};
|
|
1390
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1391
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1392
|
+
return {
|
|
1393
|
+
body: stringifiedBody,
|
|
1394
|
+
stamp: stamp,
|
|
1395
|
+
url: fullUrl,
|
|
1396
|
+
};
|
|
1397
|
+
};
|
|
1398
|
+
this.createWallet = async (input, stampWith) => {
|
|
1399
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1400
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1401
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1402
|
+
return this.command("/public/v1/submit/create_wallet", {
|
|
1403
|
+
parameters: rest,
|
|
1404
|
+
organizationId: organizationId ??
|
|
1405
|
+
session?.organizationId ??
|
|
1406
|
+
this.config.organizationId,
|
|
1407
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1408
|
+
type: "ACTIVITY_TYPE_CREATE_WALLET",
|
|
1409
|
+
}, "createWalletResult", stampWith);
|
|
1410
|
+
};
|
|
1411
|
+
this.stampCreateWallet = async (input, stampWith) => {
|
|
1412
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1413
|
+
if (!activeStamper) {
|
|
1414
|
+
return undefined;
|
|
1415
|
+
}
|
|
1416
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1417
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_wallet";
|
|
1418
|
+
const bodyWithType = {
|
|
1419
|
+
parameters,
|
|
1420
|
+
organizationId,
|
|
1421
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1422
|
+
type: "ACTIVITY_TYPE_CREATE_WALLET",
|
|
1423
|
+
};
|
|
1424
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1425
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1426
|
+
return {
|
|
1427
|
+
body: stringifiedBody,
|
|
1428
|
+
stamp: stamp,
|
|
1429
|
+
url: fullUrl,
|
|
1430
|
+
};
|
|
1431
|
+
};
|
|
1432
|
+
this.createWalletAccounts = async (input, stampWith) => {
|
|
1433
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1434
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1435
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1436
|
+
return this.command("/public/v1/submit/create_wallet_accounts", {
|
|
1437
|
+
parameters: rest,
|
|
1438
|
+
organizationId: organizationId ??
|
|
1439
|
+
session?.organizationId ??
|
|
1440
|
+
this.config.organizationId,
|
|
1441
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1442
|
+
type: "ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS",
|
|
1443
|
+
}, "createWalletAccountsResult", stampWith);
|
|
1444
|
+
};
|
|
1445
|
+
this.stampCreateWalletAccounts = async (input, stampWith) => {
|
|
1446
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1447
|
+
if (!activeStamper) {
|
|
1448
|
+
return undefined;
|
|
1449
|
+
}
|
|
1450
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1451
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/create_wallet_accounts";
|
|
1452
|
+
const bodyWithType = {
|
|
1453
|
+
parameters,
|
|
1454
|
+
organizationId,
|
|
1455
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1456
|
+
type: "ACTIVITY_TYPE_CREATE_WALLET_ACCOUNTS",
|
|
1457
|
+
};
|
|
1458
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1459
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1460
|
+
return {
|
|
1461
|
+
body: stringifiedBody,
|
|
1462
|
+
stamp: stamp,
|
|
1463
|
+
url: fullUrl,
|
|
1464
|
+
};
|
|
1465
|
+
};
|
|
1466
|
+
this.deleteApiKeys = async (input, stampWith) => {
|
|
1467
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1468
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1469
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1470
|
+
return this.command("/public/v1/submit/delete_api_keys", {
|
|
1471
|
+
parameters: rest,
|
|
1472
|
+
organizationId: organizationId ??
|
|
1473
|
+
session?.organizationId ??
|
|
1474
|
+
this.config.organizationId,
|
|
1475
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1476
|
+
type: "ACTIVITY_TYPE_DELETE_API_KEYS",
|
|
1477
|
+
}, "deleteApiKeysResult", stampWith);
|
|
1478
|
+
};
|
|
1479
|
+
this.stampDeleteApiKeys = async (input, stampWith) => {
|
|
1480
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1481
|
+
if (!activeStamper) {
|
|
1482
|
+
return undefined;
|
|
1483
|
+
}
|
|
1484
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1485
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_api_keys";
|
|
1486
|
+
const bodyWithType = {
|
|
1487
|
+
parameters,
|
|
1488
|
+
organizationId,
|
|
1489
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1490
|
+
type: "ACTIVITY_TYPE_DELETE_API_KEYS",
|
|
1491
|
+
};
|
|
1492
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1493
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1494
|
+
return {
|
|
1495
|
+
body: stringifiedBody,
|
|
1496
|
+
stamp: stamp,
|
|
1497
|
+
url: fullUrl,
|
|
1498
|
+
};
|
|
1499
|
+
};
|
|
1500
|
+
this.deleteAuthenticators = async (input, stampWith) => {
|
|
1501
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1502
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1503
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1504
|
+
return this.command("/public/v1/submit/delete_authenticators", {
|
|
1505
|
+
parameters: rest,
|
|
1506
|
+
organizationId: organizationId ??
|
|
1507
|
+
session?.organizationId ??
|
|
1508
|
+
this.config.organizationId,
|
|
1509
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1510
|
+
type: "ACTIVITY_TYPE_DELETE_AUTHENTICATORS",
|
|
1511
|
+
}, "deleteAuthenticatorsResult", stampWith);
|
|
1512
|
+
};
|
|
1513
|
+
this.stampDeleteAuthenticators = async (input, stampWith) => {
|
|
1514
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1515
|
+
if (!activeStamper) {
|
|
1516
|
+
return undefined;
|
|
1517
|
+
}
|
|
1518
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1519
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_authenticators";
|
|
1520
|
+
const bodyWithType = {
|
|
1521
|
+
parameters,
|
|
1522
|
+
organizationId,
|
|
1523
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1524
|
+
type: "ACTIVITY_TYPE_DELETE_AUTHENTICATORS",
|
|
1525
|
+
};
|
|
1526
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1527
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1528
|
+
return {
|
|
1529
|
+
body: stringifiedBody,
|
|
1530
|
+
stamp: stamp,
|
|
1531
|
+
url: fullUrl,
|
|
1532
|
+
};
|
|
1533
|
+
};
|
|
1534
|
+
this.deleteInvitation = async (input, stampWith) => {
|
|
1535
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1536
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1537
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1538
|
+
return this.command("/public/v1/submit/delete_invitation", {
|
|
1539
|
+
parameters: rest,
|
|
1540
|
+
organizationId: organizationId ??
|
|
1541
|
+
session?.organizationId ??
|
|
1542
|
+
this.config.organizationId,
|
|
1543
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1544
|
+
type: "ACTIVITY_TYPE_DELETE_INVITATION",
|
|
1545
|
+
}, "deleteInvitationResult", stampWith);
|
|
1546
|
+
};
|
|
1547
|
+
this.stampDeleteInvitation = async (input, stampWith) => {
|
|
1548
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1549
|
+
if (!activeStamper) {
|
|
1550
|
+
return undefined;
|
|
1551
|
+
}
|
|
1552
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1553
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_invitation";
|
|
1554
|
+
const bodyWithType = {
|
|
1555
|
+
parameters,
|
|
1556
|
+
organizationId,
|
|
1557
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1558
|
+
type: "ACTIVITY_TYPE_DELETE_INVITATION",
|
|
1559
|
+
};
|
|
1560
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1561
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1562
|
+
return {
|
|
1563
|
+
body: stringifiedBody,
|
|
1564
|
+
stamp: stamp,
|
|
1565
|
+
url: fullUrl,
|
|
1566
|
+
};
|
|
1567
|
+
};
|
|
1568
|
+
this.deleteOauthProviders = async (input, stampWith) => {
|
|
1569
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1570
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1571
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1572
|
+
return this.command("/public/v1/submit/delete_oauth_providers", {
|
|
1573
|
+
parameters: rest,
|
|
1574
|
+
organizationId: organizationId ??
|
|
1575
|
+
session?.organizationId ??
|
|
1576
|
+
this.config.organizationId,
|
|
1577
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1578
|
+
type: "ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS",
|
|
1579
|
+
}, "deleteOauthProvidersResult", stampWith);
|
|
1580
|
+
};
|
|
1581
|
+
this.stampDeleteOauthProviders = async (input, stampWith) => {
|
|
1582
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1583
|
+
if (!activeStamper) {
|
|
1584
|
+
return undefined;
|
|
1585
|
+
}
|
|
1586
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1587
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_oauth_providers";
|
|
1588
|
+
const bodyWithType = {
|
|
1589
|
+
parameters,
|
|
1590
|
+
organizationId,
|
|
1591
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1592
|
+
type: "ACTIVITY_TYPE_DELETE_OAUTH_PROVIDERS",
|
|
1593
|
+
};
|
|
1594
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1595
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1596
|
+
return {
|
|
1597
|
+
body: stringifiedBody,
|
|
1598
|
+
stamp: stamp,
|
|
1599
|
+
url: fullUrl,
|
|
1600
|
+
};
|
|
1601
|
+
};
|
|
1602
|
+
this.deletePolicy = async (input, stampWith) => {
|
|
1603
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1604
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1605
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1606
|
+
return this.command("/public/v1/submit/delete_policy", {
|
|
1607
|
+
parameters: rest,
|
|
1608
|
+
organizationId: organizationId ??
|
|
1609
|
+
session?.organizationId ??
|
|
1610
|
+
this.config.organizationId,
|
|
1611
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1612
|
+
type: "ACTIVITY_TYPE_DELETE_POLICY",
|
|
1613
|
+
}, "deletePolicyResult", stampWith);
|
|
1614
|
+
};
|
|
1615
|
+
this.stampDeletePolicy = async (input, stampWith) => {
|
|
1616
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1617
|
+
if (!activeStamper) {
|
|
1618
|
+
return undefined;
|
|
1619
|
+
}
|
|
1620
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1621
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_policy";
|
|
1622
|
+
const bodyWithType = {
|
|
1623
|
+
parameters,
|
|
1624
|
+
organizationId,
|
|
1625
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1626
|
+
type: "ACTIVITY_TYPE_DELETE_POLICY",
|
|
1627
|
+
};
|
|
1628
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1629
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1630
|
+
return {
|
|
1631
|
+
body: stringifiedBody,
|
|
1632
|
+
stamp: stamp,
|
|
1633
|
+
url: fullUrl,
|
|
1634
|
+
};
|
|
1635
|
+
};
|
|
1636
|
+
this.deletePrivateKeyTags = async (input, stampWith) => {
|
|
1637
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1638
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1639
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1640
|
+
return this.command("/public/v1/submit/delete_private_key_tags", {
|
|
1641
|
+
parameters: rest,
|
|
1642
|
+
organizationId: organizationId ??
|
|
1643
|
+
session?.organizationId ??
|
|
1644
|
+
this.config.organizationId,
|
|
1645
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1646
|
+
type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS",
|
|
1647
|
+
}, "deletePrivateKeyTagsResult", stampWith);
|
|
1648
|
+
};
|
|
1649
|
+
this.stampDeletePrivateKeyTags = async (input, stampWith) => {
|
|
1650
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1651
|
+
if (!activeStamper) {
|
|
1652
|
+
return undefined;
|
|
1653
|
+
}
|
|
1654
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1655
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_private_key_tags";
|
|
1656
|
+
const bodyWithType = {
|
|
1657
|
+
parameters,
|
|
1658
|
+
organizationId,
|
|
1659
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1660
|
+
type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEY_TAGS",
|
|
1661
|
+
};
|
|
1662
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1663
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1664
|
+
return {
|
|
1665
|
+
body: stringifiedBody,
|
|
1666
|
+
stamp: stamp,
|
|
1667
|
+
url: fullUrl,
|
|
1668
|
+
};
|
|
1669
|
+
};
|
|
1670
|
+
this.deletePrivateKeys = async (input, stampWith) => {
|
|
1671
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1672
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1673
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1674
|
+
return this.command("/public/v1/submit/delete_private_keys", {
|
|
1675
|
+
parameters: rest,
|
|
1676
|
+
organizationId: organizationId ??
|
|
1677
|
+
session?.organizationId ??
|
|
1678
|
+
this.config.organizationId,
|
|
1679
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1680
|
+
type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEYS",
|
|
1681
|
+
}, "deletePrivateKeysResult", stampWith);
|
|
1682
|
+
};
|
|
1683
|
+
this.stampDeletePrivateKeys = async (input, stampWith) => {
|
|
1684
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1685
|
+
if (!activeStamper) {
|
|
1686
|
+
return undefined;
|
|
1687
|
+
}
|
|
1688
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1689
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_private_keys";
|
|
1690
|
+
const bodyWithType = {
|
|
1691
|
+
parameters,
|
|
1692
|
+
organizationId,
|
|
1693
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1694
|
+
type: "ACTIVITY_TYPE_DELETE_PRIVATE_KEYS",
|
|
1695
|
+
};
|
|
1696
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1697
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1698
|
+
return {
|
|
1699
|
+
body: stringifiedBody,
|
|
1700
|
+
stamp: stamp,
|
|
1701
|
+
url: fullUrl,
|
|
1702
|
+
};
|
|
1703
|
+
};
|
|
1704
|
+
this.deleteSmartContractInterface = async (input, stampWith) => {
|
|
1705
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1706
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1707
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1708
|
+
return this.command("/public/v1/submit/delete_smart_contract_interface", {
|
|
1709
|
+
parameters: rest,
|
|
1710
|
+
organizationId: organizationId ??
|
|
1711
|
+
session?.organizationId ??
|
|
1712
|
+
this.config.organizationId,
|
|
1713
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1714
|
+
type: "ACTIVITY_TYPE_DELETE_SMART_CONTRACT_INTERFACE",
|
|
1715
|
+
}, "deleteSmartContractInterfaceResult", stampWith);
|
|
1716
|
+
};
|
|
1717
|
+
this.stampDeleteSmartContractInterface = async (input, stampWith) => {
|
|
1718
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1719
|
+
if (!activeStamper) {
|
|
1720
|
+
return undefined;
|
|
1721
|
+
}
|
|
1722
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1723
|
+
const fullUrl = this.config.apiBaseUrl +
|
|
1724
|
+
"/public/v1/submit/delete_smart_contract_interface";
|
|
1725
|
+
const bodyWithType = {
|
|
1726
|
+
parameters,
|
|
1727
|
+
organizationId,
|
|
1728
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1729
|
+
type: "ACTIVITY_TYPE_DELETE_SMART_CONTRACT_INTERFACE",
|
|
1730
|
+
};
|
|
1731
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1732
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1733
|
+
return {
|
|
1734
|
+
body: stringifiedBody,
|
|
1735
|
+
stamp: stamp,
|
|
1736
|
+
url: fullUrl,
|
|
1737
|
+
};
|
|
1738
|
+
};
|
|
1739
|
+
this.deleteSubOrganization = async (input, stampWith) => {
|
|
1740
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1741
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1742
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1743
|
+
return this.command("/public/v1/submit/delete_sub_organization", {
|
|
1744
|
+
parameters: rest,
|
|
1745
|
+
organizationId: organizationId ??
|
|
1746
|
+
session?.organizationId ??
|
|
1747
|
+
this.config.organizationId,
|
|
1748
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1749
|
+
type: "ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION",
|
|
1750
|
+
}, "deleteSubOrganizationResult", stampWith);
|
|
1751
|
+
};
|
|
1752
|
+
this.stampDeleteSubOrganization = async (input, stampWith) => {
|
|
1753
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1754
|
+
if (!activeStamper) {
|
|
1755
|
+
return undefined;
|
|
1756
|
+
}
|
|
1757
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1758
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_sub_organization";
|
|
1759
|
+
const bodyWithType = {
|
|
1760
|
+
parameters,
|
|
1761
|
+
organizationId,
|
|
1762
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1763
|
+
type: "ACTIVITY_TYPE_DELETE_SUB_ORGANIZATION",
|
|
1764
|
+
};
|
|
1765
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1766
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1767
|
+
return {
|
|
1768
|
+
body: stringifiedBody,
|
|
1769
|
+
stamp: stamp,
|
|
1770
|
+
url: fullUrl,
|
|
1771
|
+
};
|
|
1772
|
+
};
|
|
1773
|
+
this.deleteUserTags = async (input, stampWith) => {
|
|
1774
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1775
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1776
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1777
|
+
return this.command("/public/v1/submit/delete_user_tags", {
|
|
1778
|
+
parameters: rest,
|
|
1779
|
+
organizationId: organizationId ??
|
|
1780
|
+
session?.organizationId ??
|
|
1781
|
+
this.config.organizationId,
|
|
1782
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1783
|
+
type: "ACTIVITY_TYPE_DELETE_USER_TAGS",
|
|
1784
|
+
}, "deleteUserTagsResult", stampWith);
|
|
1785
|
+
};
|
|
1786
|
+
this.stampDeleteUserTags = async (input, stampWith) => {
|
|
1787
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1788
|
+
if (!activeStamper) {
|
|
1789
|
+
return undefined;
|
|
1790
|
+
}
|
|
1791
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1792
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_user_tags";
|
|
1793
|
+
const bodyWithType = {
|
|
1794
|
+
parameters,
|
|
1795
|
+
organizationId,
|
|
1796
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1797
|
+
type: "ACTIVITY_TYPE_DELETE_USER_TAGS",
|
|
1798
|
+
};
|
|
1799
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1800
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1801
|
+
return {
|
|
1802
|
+
body: stringifiedBody,
|
|
1803
|
+
stamp: stamp,
|
|
1804
|
+
url: fullUrl,
|
|
1805
|
+
};
|
|
1806
|
+
};
|
|
1807
|
+
this.deleteUsers = async (input, stampWith) => {
|
|
1808
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1809
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1810
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1811
|
+
return this.command("/public/v1/submit/delete_users", {
|
|
1812
|
+
parameters: rest,
|
|
1813
|
+
organizationId: organizationId ??
|
|
1814
|
+
session?.organizationId ??
|
|
1815
|
+
this.config.organizationId,
|
|
1816
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1817
|
+
type: "ACTIVITY_TYPE_DELETE_USERS",
|
|
1818
|
+
}, "deleteUsersResult", stampWith);
|
|
1819
|
+
};
|
|
1820
|
+
this.stampDeleteUsers = async (input, stampWith) => {
|
|
1821
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1822
|
+
if (!activeStamper) {
|
|
1823
|
+
return undefined;
|
|
1824
|
+
}
|
|
1825
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1826
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_users";
|
|
1827
|
+
const bodyWithType = {
|
|
1828
|
+
parameters,
|
|
1829
|
+
organizationId,
|
|
1830
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1831
|
+
type: "ACTIVITY_TYPE_DELETE_USERS",
|
|
1832
|
+
};
|
|
1833
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1834
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1835
|
+
return {
|
|
1836
|
+
body: stringifiedBody,
|
|
1837
|
+
stamp: stamp,
|
|
1838
|
+
url: fullUrl,
|
|
1839
|
+
};
|
|
1840
|
+
};
|
|
1841
|
+
this.deleteWallets = async (input, stampWith) => {
|
|
1842
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1843
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1844
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1845
|
+
return this.command("/public/v1/submit/delete_wallets", {
|
|
1846
|
+
parameters: rest,
|
|
1847
|
+
organizationId: organizationId ??
|
|
1848
|
+
session?.organizationId ??
|
|
1849
|
+
this.config.organizationId,
|
|
1850
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1851
|
+
type: "ACTIVITY_TYPE_DELETE_WALLETS",
|
|
1852
|
+
}, "deleteWalletsResult", stampWith);
|
|
1853
|
+
};
|
|
1854
|
+
this.stampDeleteWallets = async (input, stampWith) => {
|
|
1855
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1856
|
+
if (!activeStamper) {
|
|
1857
|
+
return undefined;
|
|
1858
|
+
}
|
|
1859
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1860
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/delete_wallets";
|
|
1861
|
+
const bodyWithType = {
|
|
1862
|
+
parameters,
|
|
1863
|
+
organizationId,
|
|
1864
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1865
|
+
type: "ACTIVITY_TYPE_DELETE_WALLETS",
|
|
1866
|
+
};
|
|
1867
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1868
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1869
|
+
return {
|
|
1870
|
+
body: stringifiedBody,
|
|
1871
|
+
stamp: stamp,
|
|
1872
|
+
url: fullUrl,
|
|
1873
|
+
};
|
|
1874
|
+
};
|
|
1875
|
+
this.emailAuth = async (input, stampWith) => {
|
|
1876
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1877
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1878
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1879
|
+
return this.command("/public/v1/submit/email_auth", {
|
|
1880
|
+
parameters: rest,
|
|
1881
|
+
organizationId: organizationId ??
|
|
1882
|
+
session?.organizationId ??
|
|
1883
|
+
this.config.organizationId,
|
|
1884
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1885
|
+
type: "ACTIVITY_TYPE_EMAIL_AUTH_V2",
|
|
1886
|
+
}, "emailAuthResult", stampWith);
|
|
1887
|
+
};
|
|
1888
|
+
this.stampEmailAuth = async (input, stampWith) => {
|
|
1889
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1890
|
+
if (!activeStamper) {
|
|
1891
|
+
return undefined;
|
|
1892
|
+
}
|
|
1893
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1894
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/email_auth";
|
|
1895
|
+
const bodyWithType = {
|
|
1896
|
+
parameters,
|
|
1897
|
+
organizationId,
|
|
1898
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1899
|
+
type: "ACTIVITY_TYPE_EMAIL_AUTH_V2",
|
|
1900
|
+
};
|
|
1901
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1902
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1903
|
+
return {
|
|
1904
|
+
body: stringifiedBody,
|
|
1905
|
+
stamp: stamp,
|
|
1906
|
+
url: fullUrl,
|
|
1907
|
+
};
|
|
1908
|
+
};
|
|
1909
|
+
this.exportPrivateKey = async (input, stampWith) => {
|
|
1910
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1911
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1912
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1913
|
+
return this.command("/public/v1/submit/export_private_key", {
|
|
1914
|
+
parameters: rest,
|
|
1915
|
+
organizationId: organizationId ??
|
|
1916
|
+
session?.organizationId ??
|
|
1917
|
+
this.config.organizationId,
|
|
1918
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1919
|
+
type: "ACTIVITY_TYPE_EXPORT_PRIVATE_KEY",
|
|
1920
|
+
}, "exportPrivateKeyResult", stampWith);
|
|
1921
|
+
};
|
|
1922
|
+
this.stampExportPrivateKey = async (input, stampWith) => {
|
|
1923
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1924
|
+
if (!activeStamper) {
|
|
1925
|
+
return undefined;
|
|
1926
|
+
}
|
|
1927
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1928
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_private_key";
|
|
1929
|
+
const bodyWithType = {
|
|
1930
|
+
parameters,
|
|
1931
|
+
organizationId,
|
|
1932
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1933
|
+
type: "ACTIVITY_TYPE_EXPORT_PRIVATE_KEY",
|
|
1934
|
+
};
|
|
1935
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1936
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1937
|
+
return {
|
|
1938
|
+
body: stringifiedBody,
|
|
1939
|
+
stamp: stamp,
|
|
1940
|
+
url: fullUrl,
|
|
1941
|
+
};
|
|
1942
|
+
};
|
|
1943
|
+
this.exportWallet = async (input, stampWith) => {
|
|
1944
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1945
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1946
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1947
|
+
return this.command("/public/v1/submit/export_wallet", {
|
|
1948
|
+
parameters: rest,
|
|
1949
|
+
organizationId: organizationId ??
|
|
1950
|
+
session?.organizationId ??
|
|
1951
|
+
this.config.organizationId,
|
|
1952
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1953
|
+
type: "ACTIVITY_TYPE_EXPORT_WALLET",
|
|
1954
|
+
}, "exportWalletResult", stampWith);
|
|
1955
|
+
};
|
|
1956
|
+
this.stampExportWallet = async (input, stampWith) => {
|
|
1957
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1958
|
+
if (!activeStamper) {
|
|
1959
|
+
return undefined;
|
|
1960
|
+
}
|
|
1961
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1962
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_wallet";
|
|
1963
|
+
const bodyWithType = {
|
|
1964
|
+
parameters,
|
|
1965
|
+
organizationId,
|
|
1966
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1967
|
+
type: "ACTIVITY_TYPE_EXPORT_WALLET",
|
|
1968
|
+
};
|
|
1969
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
1970
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
1971
|
+
return {
|
|
1972
|
+
body: stringifiedBody,
|
|
1973
|
+
stamp: stamp,
|
|
1974
|
+
url: fullUrl,
|
|
1975
|
+
};
|
|
1976
|
+
};
|
|
1977
|
+
this.exportWalletAccount = async (input, stampWith) => {
|
|
1978
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
1979
|
+
let session = await this.storageManager?.getActiveSession();
|
|
1980
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
1981
|
+
return this.command("/public/v1/submit/export_wallet_account", {
|
|
1982
|
+
parameters: rest,
|
|
1983
|
+
organizationId: organizationId ??
|
|
1984
|
+
session?.organizationId ??
|
|
1985
|
+
this.config.organizationId,
|
|
1986
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
1987
|
+
type: "ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT",
|
|
1988
|
+
}, "exportWalletAccountResult", stampWith);
|
|
1989
|
+
};
|
|
1990
|
+
this.stampExportWalletAccount = async (input, stampWith) => {
|
|
1991
|
+
const activeStamper = this.getStamper(stampWith);
|
|
1992
|
+
if (!activeStamper) {
|
|
1993
|
+
return undefined;
|
|
1994
|
+
}
|
|
1995
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
1996
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/export_wallet_account";
|
|
1997
|
+
const bodyWithType = {
|
|
1998
|
+
parameters,
|
|
1999
|
+
organizationId,
|
|
2000
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2001
|
+
type: "ACTIVITY_TYPE_EXPORT_WALLET_ACCOUNT",
|
|
2002
|
+
};
|
|
2003
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2004
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2005
|
+
return {
|
|
2006
|
+
body: stringifiedBody,
|
|
2007
|
+
stamp: stamp,
|
|
2008
|
+
url: fullUrl,
|
|
2009
|
+
};
|
|
2010
|
+
};
|
|
2011
|
+
this.importPrivateKey = async (input, stampWith) => {
|
|
2012
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2013
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2014
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2015
|
+
return this.command("/public/v1/submit/import_private_key", {
|
|
2016
|
+
parameters: rest,
|
|
2017
|
+
organizationId: organizationId ??
|
|
2018
|
+
session?.organizationId ??
|
|
2019
|
+
this.config.organizationId,
|
|
2020
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2021
|
+
type: "ACTIVITY_TYPE_IMPORT_PRIVATE_KEY",
|
|
2022
|
+
}, "importPrivateKeyResult", stampWith);
|
|
2023
|
+
};
|
|
2024
|
+
this.stampImportPrivateKey = async (input, stampWith) => {
|
|
2025
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2026
|
+
if (!activeStamper) {
|
|
2027
|
+
return undefined;
|
|
2028
|
+
}
|
|
2029
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2030
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/import_private_key";
|
|
2031
|
+
const bodyWithType = {
|
|
2032
|
+
parameters,
|
|
2033
|
+
organizationId,
|
|
2034
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2035
|
+
type: "ACTIVITY_TYPE_IMPORT_PRIVATE_KEY",
|
|
2036
|
+
};
|
|
2037
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2038
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2039
|
+
return {
|
|
2040
|
+
body: stringifiedBody,
|
|
2041
|
+
stamp: stamp,
|
|
2042
|
+
url: fullUrl,
|
|
2043
|
+
};
|
|
2044
|
+
};
|
|
2045
|
+
this.importWallet = async (input, stampWith) => {
|
|
2046
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2047
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2048
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2049
|
+
return this.command("/public/v1/submit/import_wallet", {
|
|
2050
|
+
parameters: rest,
|
|
2051
|
+
organizationId: organizationId ??
|
|
2052
|
+
session?.organizationId ??
|
|
2053
|
+
this.config.organizationId,
|
|
2054
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2055
|
+
type: "ACTIVITY_TYPE_IMPORT_WALLET",
|
|
2056
|
+
}, "importWalletResult", stampWith);
|
|
2057
|
+
};
|
|
2058
|
+
this.stampImportWallet = async (input, stampWith) => {
|
|
2059
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2060
|
+
if (!activeStamper) {
|
|
2061
|
+
return undefined;
|
|
2062
|
+
}
|
|
2063
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2064
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/import_wallet";
|
|
2065
|
+
const bodyWithType = {
|
|
2066
|
+
parameters,
|
|
2067
|
+
organizationId,
|
|
2068
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2069
|
+
type: "ACTIVITY_TYPE_IMPORT_WALLET",
|
|
2070
|
+
};
|
|
2071
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2072
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2073
|
+
return {
|
|
2074
|
+
body: stringifiedBody,
|
|
2075
|
+
stamp: stamp,
|
|
2076
|
+
url: fullUrl,
|
|
2077
|
+
};
|
|
2078
|
+
};
|
|
2079
|
+
this.initFiatOnRamp = async (input, stampWith) => {
|
|
2080
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2081
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2082
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2083
|
+
return this.command("/public/v1/submit/init_fiat_on_ramp", {
|
|
2084
|
+
parameters: rest,
|
|
2085
|
+
organizationId: organizationId ??
|
|
2086
|
+
session?.organizationId ??
|
|
2087
|
+
this.config.organizationId,
|
|
2088
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2089
|
+
type: "ACTIVITY_TYPE_INIT_FIAT_ON_RAMP",
|
|
2090
|
+
}, "initFiatOnRampResult", stampWith);
|
|
2091
|
+
};
|
|
2092
|
+
this.stampInitFiatOnRamp = async (input, stampWith) => {
|
|
2093
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2094
|
+
if (!activeStamper) {
|
|
2095
|
+
return undefined;
|
|
2096
|
+
}
|
|
2097
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2098
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_fiat_on_ramp";
|
|
2099
|
+
const bodyWithType = {
|
|
2100
|
+
parameters,
|
|
2101
|
+
organizationId,
|
|
2102
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2103
|
+
type: "ACTIVITY_TYPE_INIT_FIAT_ON_RAMP",
|
|
2104
|
+
};
|
|
2105
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2106
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2107
|
+
return {
|
|
2108
|
+
body: stringifiedBody,
|
|
2109
|
+
stamp: stamp,
|
|
2110
|
+
url: fullUrl,
|
|
2111
|
+
};
|
|
2112
|
+
};
|
|
2113
|
+
this.initImportPrivateKey = async (input, stampWith) => {
|
|
2114
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2115
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2116
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2117
|
+
return this.command("/public/v1/submit/init_import_private_key", {
|
|
2118
|
+
parameters: rest,
|
|
2119
|
+
organizationId: organizationId ??
|
|
2120
|
+
session?.organizationId ??
|
|
2121
|
+
this.config.organizationId,
|
|
2122
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2123
|
+
type: "ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY",
|
|
2124
|
+
}, "initImportPrivateKeyResult", stampWith);
|
|
2125
|
+
};
|
|
2126
|
+
this.stampInitImportPrivateKey = async (input, stampWith) => {
|
|
2127
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2128
|
+
if (!activeStamper) {
|
|
2129
|
+
return undefined;
|
|
2130
|
+
}
|
|
2131
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2132
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_import_private_key";
|
|
2133
|
+
const bodyWithType = {
|
|
2134
|
+
parameters,
|
|
2135
|
+
organizationId,
|
|
2136
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2137
|
+
type: "ACTIVITY_TYPE_INIT_IMPORT_PRIVATE_KEY",
|
|
2138
|
+
};
|
|
2139
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2140
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2141
|
+
return {
|
|
2142
|
+
body: stringifiedBody,
|
|
2143
|
+
stamp: stamp,
|
|
2144
|
+
url: fullUrl,
|
|
2145
|
+
};
|
|
2146
|
+
};
|
|
2147
|
+
this.initImportWallet = async (input, stampWith) => {
|
|
2148
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2149
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2150
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2151
|
+
return this.command("/public/v1/submit/init_import_wallet", {
|
|
2152
|
+
parameters: rest,
|
|
2153
|
+
organizationId: organizationId ??
|
|
2154
|
+
session?.organizationId ??
|
|
2155
|
+
this.config.organizationId,
|
|
2156
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2157
|
+
type: "ACTIVITY_TYPE_INIT_IMPORT_WALLET",
|
|
2158
|
+
}, "initImportWalletResult", stampWith);
|
|
2159
|
+
};
|
|
2160
|
+
this.stampInitImportWallet = async (input, stampWith) => {
|
|
2161
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2162
|
+
if (!activeStamper) {
|
|
2163
|
+
return undefined;
|
|
2164
|
+
}
|
|
2165
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2166
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_import_wallet";
|
|
2167
|
+
const bodyWithType = {
|
|
2168
|
+
parameters,
|
|
2169
|
+
organizationId,
|
|
2170
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2171
|
+
type: "ACTIVITY_TYPE_INIT_IMPORT_WALLET",
|
|
2172
|
+
};
|
|
2173
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2174
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2175
|
+
return {
|
|
2176
|
+
body: stringifiedBody,
|
|
2177
|
+
stamp: stamp,
|
|
2178
|
+
url: fullUrl,
|
|
2179
|
+
};
|
|
2180
|
+
};
|
|
2181
|
+
this.initOtp = async (input, stampWith) => {
|
|
2182
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2183
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2184
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2185
|
+
return this.command("/public/v1/submit/init_otp", {
|
|
2186
|
+
parameters: rest,
|
|
2187
|
+
organizationId: organizationId ??
|
|
2188
|
+
session?.organizationId ??
|
|
2189
|
+
this.config.organizationId,
|
|
2190
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2191
|
+
type: "ACTIVITY_TYPE_INIT_OTP",
|
|
2192
|
+
}, "initOtpResult", stampWith);
|
|
2193
|
+
};
|
|
2194
|
+
this.stampInitOtp = async (input, stampWith) => {
|
|
2195
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2196
|
+
if (!activeStamper) {
|
|
2197
|
+
return undefined;
|
|
2198
|
+
}
|
|
2199
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2200
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_otp";
|
|
2201
|
+
const bodyWithType = {
|
|
2202
|
+
parameters,
|
|
2203
|
+
organizationId,
|
|
2204
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2205
|
+
type: "ACTIVITY_TYPE_INIT_OTP",
|
|
2206
|
+
};
|
|
2207
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2208
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2209
|
+
return {
|
|
2210
|
+
body: stringifiedBody,
|
|
2211
|
+
stamp: stamp,
|
|
2212
|
+
url: fullUrl,
|
|
2213
|
+
};
|
|
2214
|
+
};
|
|
2215
|
+
this.initOtpAuth = async (input, stampWith) => {
|
|
2216
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2217
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2218
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2219
|
+
return this.command("/public/v1/submit/init_otp_auth", {
|
|
2220
|
+
parameters: rest,
|
|
2221
|
+
organizationId: organizationId ??
|
|
2222
|
+
session?.organizationId ??
|
|
2223
|
+
this.config.organizationId,
|
|
2224
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2225
|
+
type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V2",
|
|
2226
|
+
}, "initOtpAuthResultV2", stampWith);
|
|
2227
|
+
};
|
|
2228
|
+
this.stampInitOtpAuth = async (input, stampWith) => {
|
|
2229
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2230
|
+
if (!activeStamper) {
|
|
2231
|
+
return undefined;
|
|
2232
|
+
}
|
|
2233
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2234
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_otp_auth";
|
|
2235
|
+
const bodyWithType = {
|
|
2236
|
+
parameters,
|
|
2237
|
+
organizationId,
|
|
2238
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2239
|
+
type: "ACTIVITY_TYPE_INIT_OTP_AUTH_V2",
|
|
2240
|
+
};
|
|
2241
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2242
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2243
|
+
return {
|
|
2244
|
+
body: stringifiedBody,
|
|
2245
|
+
stamp: stamp,
|
|
2246
|
+
url: fullUrl,
|
|
2247
|
+
};
|
|
2248
|
+
};
|
|
2249
|
+
this.initUserEmailRecovery = async (input, stampWith) => {
|
|
2250
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2251
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2252
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2253
|
+
return this.command("/public/v1/submit/init_user_email_recovery", {
|
|
2254
|
+
parameters: rest,
|
|
2255
|
+
organizationId: organizationId ??
|
|
2256
|
+
session?.organizationId ??
|
|
2257
|
+
this.config.organizationId,
|
|
2258
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2259
|
+
type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY",
|
|
2260
|
+
}, "initUserEmailRecoveryResult", stampWith);
|
|
2261
|
+
};
|
|
2262
|
+
this.stampInitUserEmailRecovery = async (input, stampWith) => {
|
|
2263
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2264
|
+
if (!activeStamper) {
|
|
2265
|
+
return undefined;
|
|
2266
|
+
}
|
|
2267
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2268
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/init_user_email_recovery";
|
|
2269
|
+
const bodyWithType = {
|
|
2270
|
+
parameters,
|
|
2271
|
+
organizationId,
|
|
2272
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2273
|
+
type: "ACTIVITY_TYPE_INIT_USER_EMAIL_RECOVERY",
|
|
2274
|
+
};
|
|
2275
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2276
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2277
|
+
return {
|
|
2278
|
+
body: stringifiedBody,
|
|
2279
|
+
stamp: stamp,
|
|
2280
|
+
url: fullUrl,
|
|
2281
|
+
};
|
|
2282
|
+
};
|
|
2283
|
+
this.oauth = async (input, stampWith) => {
|
|
2284
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2285
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2286
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2287
|
+
return this.command("/public/v1/submit/oauth", {
|
|
2288
|
+
parameters: rest,
|
|
2289
|
+
organizationId: organizationId ??
|
|
2290
|
+
session?.organizationId ??
|
|
2291
|
+
this.config.organizationId,
|
|
2292
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2293
|
+
type: "ACTIVITY_TYPE_OAUTH",
|
|
2294
|
+
}, "oauthResult", stampWith);
|
|
2295
|
+
};
|
|
2296
|
+
this.stampOauth = async (input, stampWith) => {
|
|
2297
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2298
|
+
if (!activeStamper) {
|
|
2299
|
+
return undefined;
|
|
2300
|
+
}
|
|
2301
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2302
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth";
|
|
2303
|
+
const bodyWithType = {
|
|
2304
|
+
parameters,
|
|
2305
|
+
organizationId,
|
|
2306
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2307
|
+
type: "ACTIVITY_TYPE_OAUTH",
|
|
2308
|
+
};
|
|
2309
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2310
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2311
|
+
return {
|
|
2312
|
+
body: stringifiedBody,
|
|
2313
|
+
stamp: stamp,
|
|
2314
|
+
url: fullUrl,
|
|
2315
|
+
};
|
|
2316
|
+
};
|
|
2317
|
+
this.oauthLogin = async (input, stampWith) => {
|
|
2318
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2319
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2320
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2321
|
+
return this.command("/public/v1/submit/oauth_login", {
|
|
2322
|
+
parameters: rest,
|
|
2323
|
+
organizationId: organizationId ??
|
|
2324
|
+
session?.organizationId ??
|
|
2325
|
+
this.config.organizationId,
|
|
2326
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2327
|
+
type: "ACTIVITY_TYPE_OAUTH_LOGIN",
|
|
2328
|
+
}, "oauthLoginResult", stampWith);
|
|
2329
|
+
};
|
|
2330
|
+
this.stampOauthLogin = async (input, stampWith) => {
|
|
2331
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2332
|
+
if (!activeStamper) {
|
|
2333
|
+
return undefined;
|
|
2334
|
+
}
|
|
2335
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2336
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/oauth_login";
|
|
2337
|
+
const bodyWithType = {
|
|
2338
|
+
parameters,
|
|
2339
|
+
organizationId,
|
|
2340
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2341
|
+
type: "ACTIVITY_TYPE_OAUTH_LOGIN",
|
|
2342
|
+
};
|
|
2343
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2344
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2345
|
+
return {
|
|
2346
|
+
body: stringifiedBody,
|
|
2347
|
+
stamp: stamp,
|
|
2348
|
+
url: fullUrl,
|
|
2349
|
+
};
|
|
2350
|
+
};
|
|
2351
|
+
this.otpAuth = async (input, stampWith) => {
|
|
2352
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2353
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2354
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2355
|
+
return this.command("/public/v1/submit/otp_auth", {
|
|
2356
|
+
parameters: rest,
|
|
2357
|
+
organizationId: organizationId ??
|
|
2358
|
+
session?.organizationId ??
|
|
2359
|
+
this.config.organizationId,
|
|
2360
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2361
|
+
type: "ACTIVITY_TYPE_OTP_AUTH",
|
|
2362
|
+
}, "otpAuthResult", stampWith);
|
|
2363
|
+
};
|
|
2364
|
+
this.stampOtpAuth = async (input, stampWith) => {
|
|
2365
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2366
|
+
if (!activeStamper) {
|
|
2367
|
+
return undefined;
|
|
2368
|
+
}
|
|
2369
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2370
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/otp_auth";
|
|
2371
|
+
const bodyWithType = {
|
|
2372
|
+
parameters,
|
|
2373
|
+
organizationId,
|
|
2374
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2375
|
+
type: "ACTIVITY_TYPE_OTP_AUTH",
|
|
2376
|
+
};
|
|
2377
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2378
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2379
|
+
return {
|
|
2380
|
+
body: stringifiedBody,
|
|
2381
|
+
stamp: stamp,
|
|
2382
|
+
url: fullUrl,
|
|
2383
|
+
};
|
|
2384
|
+
};
|
|
2385
|
+
this.otpLogin = async (input, stampWith) => {
|
|
2386
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2387
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2388
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2389
|
+
return this.command("/public/v1/submit/otp_login", {
|
|
2390
|
+
parameters: rest,
|
|
2391
|
+
organizationId: organizationId ??
|
|
2392
|
+
session?.organizationId ??
|
|
2393
|
+
this.config.organizationId,
|
|
2394
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2395
|
+
type: "ACTIVITY_TYPE_OTP_LOGIN",
|
|
2396
|
+
}, "otpLoginResult", stampWith);
|
|
2397
|
+
};
|
|
2398
|
+
this.stampOtpLogin = async (input, stampWith) => {
|
|
2399
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2400
|
+
if (!activeStamper) {
|
|
2401
|
+
return undefined;
|
|
2402
|
+
}
|
|
2403
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2404
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/otp_login";
|
|
2405
|
+
const bodyWithType = {
|
|
2406
|
+
parameters,
|
|
2407
|
+
organizationId,
|
|
2408
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2409
|
+
type: "ACTIVITY_TYPE_OTP_LOGIN",
|
|
2410
|
+
};
|
|
2411
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2412
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2413
|
+
return {
|
|
2414
|
+
body: stringifiedBody,
|
|
2415
|
+
stamp: stamp,
|
|
2416
|
+
url: fullUrl,
|
|
2417
|
+
};
|
|
2418
|
+
};
|
|
2419
|
+
this.recoverUser = async (input, stampWith) => {
|
|
2420
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2421
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2422
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2423
|
+
return this.command("/public/v1/submit/recover_user", {
|
|
2424
|
+
parameters: rest,
|
|
2425
|
+
organizationId: organizationId ??
|
|
2426
|
+
session?.organizationId ??
|
|
2427
|
+
this.config.organizationId,
|
|
2428
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2429
|
+
type: "ACTIVITY_TYPE_RECOVER_USER",
|
|
2430
|
+
}, "recoverUserResult", stampWith);
|
|
2431
|
+
};
|
|
2432
|
+
this.stampRecoverUser = async (input, stampWith) => {
|
|
2433
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2434
|
+
if (!activeStamper) {
|
|
2435
|
+
return undefined;
|
|
2436
|
+
}
|
|
2437
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2438
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/recover_user";
|
|
2439
|
+
const bodyWithType = {
|
|
2440
|
+
parameters,
|
|
2441
|
+
organizationId,
|
|
2442
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2443
|
+
type: "ACTIVITY_TYPE_RECOVER_USER",
|
|
2444
|
+
};
|
|
2445
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2446
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2447
|
+
return {
|
|
2448
|
+
body: stringifiedBody,
|
|
2449
|
+
stamp: stamp,
|
|
2450
|
+
url: fullUrl,
|
|
2451
|
+
};
|
|
2452
|
+
};
|
|
2453
|
+
this.rejectActivity = async (input, stampWith) => {
|
|
2454
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2455
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2456
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2457
|
+
return this.activityDecision("/public/v1/submit/reject_activity", {
|
|
2458
|
+
parameters: rest,
|
|
2459
|
+
organizationId: organizationId ??
|
|
2460
|
+
session?.organizationId ??
|
|
2461
|
+
this.config.organizationId,
|
|
2462
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2463
|
+
type: "ACTIVITY_TYPE_REJECT_ACTIVITY",
|
|
2464
|
+
}, stampWith);
|
|
2465
|
+
};
|
|
2466
|
+
this.stampRejectActivity = async (input, stampWith) => {
|
|
2467
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2468
|
+
if (!activeStamper) {
|
|
2469
|
+
return undefined;
|
|
2470
|
+
}
|
|
2471
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2472
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/reject_activity";
|
|
2473
|
+
const bodyWithType = {
|
|
2474
|
+
parameters,
|
|
2475
|
+
organizationId,
|
|
2476
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2477
|
+
type: "ACTIVITY_TYPE_REJECT_ACTIVITY",
|
|
2478
|
+
};
|
|
2479
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2480
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2481
|
+
return {
|
|
2482
|
+
body: stringifiedBody,
|
|
2483
|
+
stamp: stamp,
|
|
2484
|
+
url: fullUrl,
|
|
2485
|
+
};
|
|
2486
|
+
};
|
|
2487
|
+
this.removeOrganizationFeature = async (input, stampWith) => {
|
|
2488
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2489
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2490
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2491
|
+
return this.command("/public/v1/submit/remove_organization_feature", {
|
|
2492
|
+
parameters: rest,
|
|
2493
|
+
organizationId: organizationId ??
|
|
2494
|
+
session?.organizationId ??
|
|
2495
|
+
this.config.organizationId,
|
|
2496
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2497
|
+
type: "ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE",
|
|
2498
|
+
}, "removeOrganizationFeatureResult", stampWith);
|
|
2499
|
+
};
|
|
2500
|
+
this.stampRemoveOrganizationFeature = async (input, stampWith) => {
|
|
2501
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2502
|
+
if (!activeStamper) {
|
|
2503
|
+
return undefined;
|
|
2504
|
+
}
|
|
2505
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2506
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/remove_organization_feature";
|
|
2507
|
+
const bodyWithType = {
|
|
2508
|
+
parameters,
|
|
2509
|
+
organizationId,
|
|
2510
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2511
|
+
type: "ACTIVITY_TYPE_REMOVE_ORGANIZATION_FEATURE",
|
|
2512
|
+
};
|
|
2513
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2514
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2515
|
+
return {
|
|
2516
|
+
body: stringifiedBody,
|
|
2517
|
+
stamp: stamp,
|
|
2518
|
+
url: fullUrl,
|
|
2519
|
+
};
|
|
2520
|
+
};
|
|
2521
|
+
this.setOrganizationFeature = async (input, stampWith) => {
|
|
2522
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2523
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2524
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2525
|
+
return this.command("/public/v1/submit/set_organization_feature", {
|
|
2526
|
+
parameters: rest,
|
|
2527
|
+
organizationId: organizationId ??
|
|
2528
|
+
session?.organizationId ??
|
|
2529
|
+
this.config.organizationId,
|
|
2530
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2531
|
+
type: "ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE",
|
|
2532
|
+
}, "setOrganizationFeatureResult", stampWith);
|
|
2533
|
+
};
|
|
2534
|
+
this.stampSetOrganizationFeature = async (input, stampWith) => {
|
|
2535
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2536
|
+
if (!activeStamper) {
|
|
2537
|
+
return undefined;
|
|
2538
|
+
}
|
|
2539
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2540
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/set_organization_feature";
|
|
2541
|
+
const bodyWithType = {
|
|
2542
|
+
parameters,
|
|
2543
|
+
organizationId,
|
|
2544
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2545
|
+
type: "ACTIVITY_TYPE_SET_ORGANIZATION_FEATURE",
|
|
2546
|
+
};
|
|
2547
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2548
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2549
|
+
return {
|
|
2550
|
+
body: stringifiedBody,
|
|
2551
|
+
stamp: stamp,
|
|
2552
|
+
url: fullUrl,
|
|
2553
|
+
};
|
|
2554
|
+
};
|
|
2555
|
+
this.signRawPayload = async (input, stampWith) => {
|
|
2556
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2557
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2558
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2559
|
+
return this.command("/public/v1/submit/sign_raw_payload", {
|
|
2560
|
+
parameters: rest,
|
|
2561
|
+
organizationId: organizationId ??
|
|
2562
|
+
session?.organizationId ??
|
|
2563
|
+
this.config.organizationId,
|
|
2564
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2565
|
+
type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",
|
|
2566
|
+
}, "signRawPayloadResult", stampWith);
|
|
2567
|
+
};
|
|
2568
|
+
this.stampSignRawPayload = async (input, stampWith) => {
|
|
2569
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2570
|
+
if (!activeStamper) {
|
|
2571
|
+
return undefined;
|
|
2572
|
+
}
|
|
2573
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2574
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_raw_payload";
|
|
2575
|
+
const bodyWithType = {
|
|
2576
|
+
parameters,
|
|
2577
|
+
organizationId,
|
|
2578
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2579
|
+
type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOAD_V2",
|
|
2580
|
+
};
|
|
2581
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2582
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2583
|
+
return {
|
|
2584
|
+
body: stringifiedBody,
|
|
2585
|
+
stamp: stamp,
|
|
2586
|
+
url: fullUrl,
|
|
2587
|
+
};
|
|
2588
|
+
};
|
|
2589
|
+
this.signRawPayloads = async (input, stampWith) => {
|
|
2590
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2591
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2592
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2593
|
+
return this.command("/public/v1/submit/sign_raw_payloads", {
|
|
2594
|
+
parameters: rest,
|
|
2595
|
+
organizationId: organizationId ??
|
|
2596
|
+
session?.organizationId ??
|
|
2597
|
+
this.config.organizationId,
|
|
2598
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2599
|
+
type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOADS",
|
|
2600
|
+
}, "signRawPayloadsResult", stampWith);
|
|
2601
|
+
};
|
|
2602
|
+
this.stampSignRawPayloads = async (input, stampWith) => {
|
|
2603
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2604
|
+
if (!activeStamper) {
|
|
2605
|
+
return undefined;
|
|
2606
|
+
}
|
|
2607
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2608
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_raw_payloads";
|
|
2609
|
+
const bodyWithType = {
|
|
2610
|
+
parameters,
|
|
2611
|
+
organizationId,
|
|
2612
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2613
|
+
type: "ACTIVITY_TYPE_SIGN_RAW_PAYLOADS",
|
|
2614
|
+
};
|
|
2615
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2616
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2617
|
+
return {
|
|
2618
|
+
body: stringifiedBody,
|
|
2619
|
+
stamp: stamp,
|
|
2620
|
+
url: fullUrl,
|
|
2621
|
+
};
|
|
2622
|
+
};
|
|
2623
|
+
this.signTransaction = async (input, stampWith) => {
|
|
2624
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2625
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2626
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2627
|
+
return this.command("/public/v1/submit/sign_transaction", {
|
|
2628
|
+
parameters: rest,
|
|
2629
|
+
organizationId: organizationId ??
|
|
2630
|
+
session?.organizationId ??
|
|
2631
|
+
this.config.organizationId,
|
|
2632
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2633
|
+
type: "ACTIVITY_TYPE_SIGN_TRANSACTION_V2",
|
|
2634
|
+
}, "signTransactionResult", stampWith);
|
|
2635
|
+
};
|
|
2636
|
+
this.stampSignTransaction = async (input, stampWith) => {
|
|
2637
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2638
|
+
if (!activeStamper) {
|
|
2639
|
+
return undefined;
|
|
2640
|
+
}
|
|
2641
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2642
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/sign_transaction";
|
|
2643
|
+
const bodyWithType = {
|
|
2644
|
+
parameters,
|
|
2645
|
+
organizationId,
|
|
2646
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2647
|
+
type: "ACTIVITY_TYPE_SIGN_TRANSACTION_V2",
|
|
2648
|
+
};
|
|
2649
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2650
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2651
|
+
return {
|
|
2652
|
+
body: stringifiedBody,
|
|
2653
|
+
stamp: stamp,
|
|
2654
|
+
url: fullUrl,
|
|
2655
|
+
};
|
|
2656
|
+
};
|
|
2657
|
+
this.stampLogin = async (input, stampWith) => {
|
|
2658
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2659
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2660
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2661
|
+
return this.command("/public/v1/submit/stamp_login", {
|
|
2662
|
+
parameters: rest,
|
|
2663
|
+
organizationId: organizationId ??
|
|
2664
|
+
session?.organizationId ??
|
|
2665
|
+
this.config.organizationId,
|
|
2666
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2667
|
+
type: "ACTIVITY_TYPE_STAMP_LOGIN",
|
|
2668
|
+
}, "stampLoginResult", stampWith);
|
|
2669
|
+
};
|
|
2670
|
+
this.stampStampLogin = async (input, stampWith) => {
|
|
2671
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2672
|
+
if (!activeStamper) {
|
|
2673
|
+
return undefined;
|
|
2674
|
+
}
|
|
2675
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2676
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/stamp_login";
|
|
2677
|
+
const bodyWithType = {
|
|
2678
|
+
parameters,
|
|
2679
|
+
organizationId,
|
|
2680
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2681
|
+
type: "ACTIVITY_TYPE_STAMP_LOGIN",
|
|
2682
|
+
};
|
|
2683
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2684
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2685
|
+
return {
|
|
2686
|
+
body: stringifiedBody,
|
|
2687
|
+
stamp: stamp,
|
|
2688
|
+
url: fullUrl,
|
|
2689
|
+
};
|
|
2690
|
+
};
|
|
2691
|
+
this.updatePolicy = async (input, stampWith) => {
|
|
2692
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2693
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2694
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2695
|
+
return this.command("/public/v1/submit/update_policy", {
|
|
2696
|
+
parameters: rest,
|
|
2697
|
+
organizationId: organizationId ??
|
|
2698
|
+
session?.organizationId ??
|
|
2699
|
+
this.config.organizationId,
|
|
2700
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2701
|
+
type: "ACTIVITY_TYPE_UPDATE_POLICY_V2",
|
|
2702
|
+
}, "updatePolicyResultV2", stampWith);
|
|
2703
|
+
};
|
|
2704
|
+
this.stampUpdatePolicy = async (input, stampWith) => {
|
|
2705
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2706
|
+
if (!activeStamper) {
|
|
2707
|
+
return undefined;
|
|
2708
|
+
}
|
|
2709
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2710
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_policy";
|
|
2711
|
+
const bodyWithType = {
|
|
2712
|
+
parameters,
|
|
2713
|
+
organizationId,
|
|
2714
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2715
|
+
type: "ACTIVITY_TYPE_UPDATE_POLICY_V2",
|
|
2716
|
+
};
|
|
2717
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2718
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2719
|
+
return {
|
|
2720
|
+
body: stringifiedBody,
|
|
2721
|
+
stamp: stamp,
|
|
2722
|
+
url: fullUrl,
|
|
2723
|
+
};
|
|
2724
|
+
};
|
|
2725
|
+
this.updatePrivateKeyTag = async (input, stampWith) => {
|
|
2726
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2727
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2728
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2729
|
+
return this.command("/public/v1/submit/update_private_key_tag", {
|
|
2730
|
+
parameters: rest,
|
|
2731
|
+
organizationId: organizationId ??
|
|
2732
|
+
session?.organizationId ??
|
|
2733
|
+
this.config.organizationId,
|
|
2734
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2735
|
+
type: "ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG",
|
|
2736
|
+
}, "updatePrivateKeyTagResult", stampWith);
|
|
2737
|
+
};
|
|
2738
|
+
this.stampUpdatePrivateKeyTag = async (input, stampWith) => {
|
|
2739
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2740
|
+
if (!activeStamper) {
|
|
2741
|
+
return undefined;
|
|
2742
|
+
}
|
|
2743
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2744
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_private_key_tag";
|
|
2745
|
+
const bodyWithType = {
|
|
2746
|
+
parameters,
|
|
2747
|
+
organizationId,
|
|
2748
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2749
|
+
type: "ACTIVITY_TYPE_UPDATE_PRIVATE_KEY_TAG",
|
|
2750
|
+
};
|
|
2751
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2752
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2753
|
+
return {
|
|
2754
|
+
body: stringifiedBody,
|
|
2755
|
+
stamp: stamp,
|
|
2756
|
+
url: fullUrl,
|
|
2757
|
+
};
|
|
2758
|
+
};
|
|
2759
|
+
this.updateRootQuorum = async (input, stampWith) => {
|
|
2760
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2761
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2762
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2763
|
+
return this.command("/public/v1/submit/update_root_quorum", {
|
|
2764
|
+
parameters: rest,
|
|
2765
|
+
organizationId: organizationId ??
|
|
2766
|
+
session?.organizationId ??
|
|
2767
|
+
this.config.organizationId,
|
|
2768
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2769
|
+
type: "ACTIVITY_TYPE_UPDATE_ROOT_QUORUM",
|
|
2770
|
+
}, "updateRootQuorumResult", stampWith);
|
|
2771
|
+
};
|
|
2772
|
+
this.stampUpdateRootQuorum = async (input, stampWith) => {
|
|
2773
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2774
|
+
if (!activeStamper) {
|
|
2775
|
+
return undefined;
|
|
2776
|
+
}
|
|
2777
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2778
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_root_quorum";
|
|
2779
|
+
const bodyWithType = {
|
|
2780
|
+
parameters,
|
|
2781
|
+
organizationId,
|
|
2782
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2783
|
+
type: "ACTIVITY_TYPE_UPDATE_ROOT_QUORUM",
|
|
2784
|
+
};
|
|
2785
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2786
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2787
|
+
return {
|
|
2788
|
+
body: stringifiedBody,
|
|
2789
|
+
stamp: stamp,
|
|
2790
|
+
url: fullUrl,
|
|
2791
|
+
};
|
|
2792
|
+
};
|
|
2793
|
+
this.updateUser = async (input, stampWith) => {
|
|
2794
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2795
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2796
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2797
|
+
return this.command("/public/v1/submit/update_user", {
|
|
2798
|
+
parameters: rest,
|
|
2799
|
+
organizationId: organizationId ??
|
|
2800
|
+
session?.organizationId ??
|
|
2801
|
+
this.config.organizationId,
|
|
2802
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2803
|
+
type: "ACTIVITY_TYPE_UPDATE_USER",
|
|
2804
|
+
}, "updateUserResult", stampWith);
|
|
2805
|
+
};
|
|
2806
|
+
this.stampUpdateUser = async (input, stampWith) => {
|
|
2807
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2808
|
+
if (!activeStamper) {
|
|
2809
|
+
return undefined;
|
|
2810
|
+
}
|
|
2811
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2812
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user";
|
|
2813
|
+
const bodyWithType = {
|
|
2814
|
+
parameters,
|
|
2815
|
+
organizationId,
|
|
2816
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2817
|
+
type: "ACTIVITY_TYPE_UPDATE_USER",
|
|
2818
|
+
};
|
|
2819
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2820
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2821
|
+
return {
|
|
2822
|
+
body: stringifiedBody,
|
|
2823
|
+
stamp: stamp,
|
|
2824
|
+
url: fullUrl,
|
|
2825
|
+
};
|
|
2826
|
+
};
|
|
2827
|
+
this.updateUserEmail = async (input, stampWith) => {
|
|
2828
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2829
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2830
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2831
|
+
return this.command("/public/v1/submit/update_user_email", {
|
|
2832
|
+
parameters: rest,
|
|
2833
|
+
organizationId: organizationId ??
|
|
2834
|
+
session?.organizationId ??
|
|
2835
|
+
this.config.organizationId,
|
|
2836
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2837
|
+
type: "ACTIVITY_TYPE_UPDATE_USER_EMAIL",
|
|
2838
|
+
}, "updateUserEmailResult", stampWith);
|
|
2839
|
+
};
|
|
2840
|
+
this.stampUpdateUserEmail = async (input, stampWith) => {
|
|
2841
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2842
|
+
if (!activeStamper) {
|
|
2843
|
+
return undefined;
|
|
2844
|
+
}
|
|
2845
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2846
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_email";
|
|
2847
|
+
const bodyWithType = {
|
|
2848
|
+
parameters,
|
|
2849
|
+
organizationId,
|
|
2850
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2851
|
+
type: "ACTIVITY_TYPE_UPDATE_USER_EMAIL",
|
|
2852
|
+
};
|
|
2853
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2854
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2855
|
+
return {
|
|
2856
|
+
body: stringifiedBody,
|
|
2857
|
+
stamp: stamp,
|
|
2858
|
+
url: fullUrl,
|
|
2859
|
+
};
|
|
2860
|
+
};
|
|
2861
|
+
this.updateUserName = async (input, stampWith) => {
|
|
2862
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2863
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2864
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2865
|
+
return this.command("/public/v1/submit/update_user_name", {
|
|
2866
|
+
parameters: rest,
|
|
2867
|
+
organizationId: organizationId ??
|
|
2868
|
+
session?.organizationId ??
|
|
2869
|
+
this.config.organizationId,
|
|
2870
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2871
|
+
type: "ACTIVITY_TYPE_UPDATE_USER_NAME",
|
|
2872
|
+
}, "updateUserNameResult", stampWith);
|
|
2873
|
+
};
|
|
2874
|
+
this.stampUpdateUserName = async (input, stampWith) => {
|
|
2875
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2876
|
+
if (!activeStamper) {
|
|
2877
|
+
return undefined;
|
|
2878
|
+
}
|
|
2879
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2880
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_name";
|
|
2881
|
+
const bodyWithType = {
|
|
2882
|
+
parameters,
|
|
2883
|
+
organizationId,
|
|
2884
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2885
|
+
type: "ACTIVITY_TYPE_UPDATE_USER_NAME",
|
|
2886
|
+
};
|
|
2887
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2888
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2889
|
+
return {
|
|
2890
|
+
body: stringifiedBody,
|
|
2891
|
+
stamp: stamp,
|
|
2892
|
+
url: fullUrl,
|
|
2893
|
+
};
|
|
2894
|
+
};
|
|
2895
|
+
this.updateUserPhoneNumber = async (input, stampWith) => {
|
|
2896
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2897
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2898
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2899
|
+
return this.command("/public/v1/submit/update_user_phone_number", {
|
|
2900
|
+
parameters: rest,
|
|
2901
|
+
organizationId: organizationId ??
|
|
2902
|
+
session?.organizationId ??
|
|
2903
|
+
this.config.organizationId,
|
|
2904
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2905
|
+
type: "ACTIVITY_TYPE_UPDATE_USER_PHONE_NUMBER",
|
|
2906
|
+
}, "updateUserPhoneNumberResult", stampWith);
|
|
2907
|
+
};
|
|
2908
|
+
this.stampUpdateUserPhoneNumber = async (input, stampWith) => {
|
|
2909
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2910
|
+
if (!activeStamper) {
|
|
2911
|
+
return undefined;
|
|
2912
|
+
}
|
|
2913
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2914
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_phone_number";
|
|
2915
|
+
const bodyWithType = {
|
|
2916
|
+
parameters,
|
|
2917
|
+
organizationId,
|
|
2918
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2919
|
+
type: "ACTIVITY_TYPE_UPDATE_USER_PHONE_NUMBER",
|
|
2920
|
+
};
|
|
2921
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2922
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2923
|
+
return {
|
|
2924
|
+
body: stringifiedBody,
|
|
2925
|
+
stamp: stamp,
|
|
2926
|
+
url: fullUrl,
|
|
2927
|
+
};
|
|
2928
|
+
};
|
|
2929
|
+
this.updateUserTag = async (input, stampWith) => {
|
|
2930
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2931
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2932
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2933
|
+
return this.command("/public/v1/submit/update_user_tag", {
|
|
2934
|
+
parameters: rest,
|
|
2935
|
+
organizationId: organizationId ??
|
|
2936
|
+
session?.organizationId ??
|
|
2937
|
+
this.config.organizationId,
|
|
2938
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2939
|
+
type: "ACTIVITY_TYPE_UPDATE_USER_TAG",
|
|
2940
|
+
}, "updateUserTagResult", stampWith);
|
|
2941
|
+
};
|
|
2942
|
+
this.stampUpdateUserTag = async (input, stampWith) => {
|
|
2943
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2944
|
+
if (!activeStamper) {
|
|
2945
|
+
return undefined;
|
|
2946
|
+
}
|
|
2947
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2948
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_user_tag";
|
|
2949
|
+
const bodyWithType = {
|
|
2950
|
+
parameters,
|
|
2951
|
+
organizationId,
|
|
2952
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2953
|
+
type: "ACTIVITY_TYPE_UPDATE_USER_TAG",
|
|
2954
|
+
};
|
|
2955
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2956
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2957
|
+
return {
|
|
2958
|
+
body: stringifiedBody,
|
|
2959
|
+
stamp: stamp,
|
|
2960
|
+
url: fullUrl,
|
|
2961
|
+
};
|
|
2962
|
+
};
|
|
2963
|
+
this.updateWallet = async (input, stampWith) => {
|
|
2964
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2965
|
+
let session = await this.storageManager?.getActiveSession();
|
|
2966
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
2967
|
+
return this.command("/public/v1/submit/update_wallet", {
|
|
2968
|
+
parameters: rest,
|
|
2969
|
+
organizationId: organizationId ??
|
|
2970
|
+
session?.organizationId ??
|
|
2971
|
+
this.config.organizationId,
|
|
2972
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2973
|
+
type: "ACTIVITY_TYPE_UPDATE_WALLET",
|
|
2974
|
+
}, "updateWalletResult", stampWith);
|
|
2975
|
+
};
|
|
2976
|
+
this.stampUpdateWallet = async (input, stampWith) => {
|
|
2977
|
+
const activeStamper = this.getStamper(stampWith);
|
|
2978
|
+
if (!activeStamper) {
|
|
2979
|
+
return undefined;
|
|
2980
|
+
}
|
|
2981
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
2982
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/update_wallet";
|
|
2983
|
+
const bodyWithType = {
|
|
2984
|
+
parameters,
|
|
2985
|
+
organizationId,
|
|
2986
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
2987
|
+
type: "ACTIVITY_TYPE_UPDATE_WALLET",
|
|
2988
|
+
};
|
|
2989
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
2990
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
2991
|
+
return {
|
|
2992
|
+
body: stringifiedBody,
|
|
2993
|
+
stamp: stamp,
|
|
2994
|
+
url: fullUrl,
|
|
2995
|
+
};
|
|
2996
|
+
};
|
|
2997
|
+
this.verifyOtp = async (input, stampWith) => {
|
|
2998
|
+
const { organizationId, timestampMs, ...rest } = input;
|
|
2999
|
+
let session = await this.storageManager?.getActiveSession();
|
|
3000
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
3001
|
+
return this.command("/public/v1/submit/verify_otp", {
|
|
3002
|
+
parameters: rest,
|
|
3003
|
+
organizationId: organizationId ??
|
|
3004
|
+
session?.organizationId ??
|
|
3005
|
+
this.config.organizationId,
|
|
3006
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
3007
|
+
type: "ACTIVITY_TYPE_VERIFY_OTP",
|
|
3008
|
+
}, "verifyOtpResult", stampWith);
|
|
3009
|
+
};
|
|
3010
|
+
this.stampVerifyOtp = async (input, stampWith) => {
|
|
3011
|
+
const activeStamper = this.getStamper(stampWith);
|
|
3012
|
+
if (!activeStamper) {
|
|
3013
|
+
return undefined;
|
|
3014
|
+
}
|
|
3015
|
+
const { organizationId, timestampMs, ...parameters } = input;
|
|
3016
|
+
const fullUrl = this.config.apiBaseUrl + "/public/v1/submit/verify_otp";
|
|
3017
|
+
const bodyWithType = {
|
|
3018
|
+
parameters,
|
|
3019
|
+
organizationId,
|
|
3020
|
+
timestampMs: timestampMs ?? String(Date.now()),
|
|
3021
|
+
type: "ACTIVITY_TYPE_VERIFY_OTP",
|
|
3022
|
+
};
|
|
3023
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
3024
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
3025
|
+
return {
|
|
3026
|
+
body: stringifiedBody,
|
|
3027
|
+
stamp: stamp,
|
|
3028
|
+
url: fullUrl,
|
|
3029
|
+
};
|
|
3030
|
+
};
|
|
3031
|
+
this.testRateLimits = async (input, stampWith) => {
|
|
3032
|
+
let session = await this.storageManager?.getActiveSession();
|
|
3033
|
+
session = utils.parseSession(session); // TODO (Amir): We may not need this anymore since we want to store the full session object in storage
|
|
3034
|
+
return this.request("/tkhq/api/v1/test_rate_limits", {
|
|
3035
|
+
...input,
|
|
3036
|
+
organizationId: input.organizationId ??
|
|
3037
|
+
session?.organizationId ??
|
|
3038
|
+
this.config.organizationId,
|
|
3039
|
+
}, stampWith);
|
|
3040
|
+
};
|
|
3041
|
+
this.stampTestRateLimits = async (input, stampWith) => {
|
|
3042
|
+
const activeStamper = this.getStamper(stampWith);
|
|
3043
|
+
if (!activeStamper) {
|
|
3044
|
+
return undefined;
|
|
3045
|
+
}
|
|
3046
|
+
const { organizationId, ...parameters } = input;
|
|
3047
|
+
const fullUrl = this.config.apiBaseUrl + "/tkhq/api/v1/test_rate_limits";
|
|
3048
|
+
const bodyWithType = {
|
|
3049
|
+
parameters,
|
|
3050
|
+
organizationId,
|
|
3051
|
+
type: "ACTIVITY_TYPE_TEST_RATE_LIMITS",
|
|
3052
|
+
};
|
|
3053
|
+
const stringifiedBody = JSON.stringify(bodyWithType);
|
|
3054
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
3055
|
+
return {
|
|
3056
|
+
body: stringifiedBody,
|
|
3057
|
+
stamp: stamp,
|
|
3058
|
+
url: fullUrl,
|
|
3059
|
+
};
|
|
3060
|
+
};
|
|
3061
|
+
this.proxyGetAccount = async (input) => {
|
|
3062
|
+
return this.authProxyRequest("/v1/account", input);
|
|
3063
|
+
};
|
|
3064
|
+
this.proxyOAuthLogin = async (input) => {
|
|
3065
|
+
return this.authProxyRequest("/v1/oauth_login", input);
|
|
3066
|
+
};
|
|
3067
|
+
this.proxyInitOtp = async (input) => {
|
|
3068
|
+
return this.authProxyRequest("/v1/otp_init", input);
|
|
3069
|
+
};
|
|
3070
|
+
this.proxyOtpLogin = async (input) => {
|
|
3071
|
+
return this.authProxyRequest("/v1/otp_login", input);
|
|
3072
|
+
};
|
|
3073
|
+
this.proxyVerifyOtp = async (input) => {
|
|
3074
|
+
return this.authProxyRequest("/v1/otp_verify", input);
|
|
3075
|
+
};
|
|
3076
|
+
this.proxySignup = async (input) => {
|
|
3077
|
+
return this.authProxyRequest("/v1/signup", input);
|
|
3078
|
+
};
|
|
3079
|
+
this.proxyGetWalletKitConfig = async (input) => {
|
|
3080
|
+
return this.authProxyRequest("/v1/wallet_kit_config", input);
|
|
3081
|
+
};
|
|
3082
|
+
this.config = config;
|
|
3083
|
+
if (config.apiKeyStamper) {
|
|
3084
|
+
this.apiKeyStamper = config.apiKeyStamper;
|
|
3085
|
+
}
|
|
3086
|
+
if (config.passkeyStamper) {
|
|
3087
|
+
this.passkeyStamper = config.passkeyStamper;
|
|
3088
|
+
}
|
|
3089
|
+
if (config.walletStamper) {
|
|
3090
|
+
this.walletStamper = config.walletStamper;
|
|
3091
|
+
}
|
|
3092
|
+
if (config.storageManager) {
|
|
3093
|
+
this.storageManager = config.storageManager;
|
|
3094
|
+
}
|
|
3095
|
+
}
|
|
3096
|
+
getStamper(stampWith) {
|
|
3097
|
+
if (!stampWith)
|
|
3098
|
+
return this.apiKeyStamper || this.passkeyStamper || this.walletStamper;
|
|
3099
|
+
switch (stampWith) {
|
|
3100
|
+
case base.StamperType.ApiKey:
|
|
3101
|
+
return this.apiKeyStamper;
|
|
3102
|
+
case base.StamperType.Passkey:
|
|
3103
|
+
return this.passkeyStamper;
|
|
3104
|
+
case base.StamperType.Wallet:
|
|
3105
|
+
return this.walletStamper;
|
|
3106
|
+
default:
|
|
3107
|
+
return this.apiKeyStamper;
|
|
3108
|
+
}
|
|
3109
|
+
}
|
|
3110
|
+
async request(url, body, stampWith) {
|
|
3111
|
+
const fullUrl = this.config.apiBaseUrl + url;
|
|
3112
|
+
const stringifiedBody = JSON.stringify(body);
|
|
3113
|
+
var headers = {
|
|
3114
|
+
"X-Client-Version": version.VERSION,
|
|
3115
|
+
};
|
|
3116
|
+
// Use the specified stamper for this request
|
|
3117
|
+
const activeStamper = this.getStamper(stampWith);
|
|
3118
|
+
if (activeStamper) {
|
|
3119
|
+
const stamp = await activeStamper.stamp(stringifiedBody);
|
|
3120
|
+
headers[stamp.stampHeaderName] = stamp.stampHeaderValue;
|
|
3121
|
+
}
|
|
3122
|
+
if (this.config.readOnlySession) {
|
|
3123
|
+
headers["X-Session"] = this.config.readOnlySession;
|
|
3124
|
+
}
|
|
3125
|
+
const response = await fetch(fullUrl, {
|
|
3126
|
+
method: "POST",
|
|
3127
|
+
headers: headers,
|
|
3128
|
+
body: stringifiedBody,
|
|
3129
|
+
redirect: "follow",
|
|
3130
|
+
});
|
|
3131
|
+
if (!response.ok) {
|
|
3132
|
+
let res;
|
|
3133
|
+
try {
|
|
3134
|
+
res = await response.json();
|
|
3135
|
+
}
|
|
3136
|
+
catch (_) {
|
|
3137
|
+
throw new Error(`${response.status} ${response.statusText}`);
|
|
3138
|
+
}
|
|
3139
|
+
throw new base.TurnkeyRequestError(res);
|
|
3140
|
+
}
|
|
3141
|
+
const data = await response.json();
|
|
3142
|
+
return data;
|
|
3143
|
+
}
|
|
3144
|
+
async command(url, body, resultKey, stampWith) {
|
|
3145
|
+
const pollingDuration = this.config.activityPoller?.intervalMs ?? 1000;
|
|
3146
|
+
const maxRetries = this.config.activityPoller?.numRetries ?? 3;
|
|
3147
|
+
const sleep = (ms) => new Promise((resolve) => setTimeout(resolve, ms));
|
|
3148
|
+
const handleResponse = (activityData) => {
|
|
3149
|
+
const { result, status } = activityData.activity;
|
|
3150
|
+
if (status === "ACTIVITY_STATUS_COMPLETED") {
|
|
3151
|
+
return {
|
|
3152
|
+
...result[`${resultKey}`],
|
|
3153
|
+
...activityData,
|
|
3154
|
+
};
|
|
3155
|
+
}
|
|
3156
|
+
return activityData;
|
|
3157
|
+
};
|
|
3158
|
+
let attempts = 0;
|
|
3159
|
+
const pollStatus = async (activityId) => {
|
|
3160
|
+
const pollBody = { activityId };
|
|
3161
|
+
// Pass the stampWith parameter to getActivity
|
|
3162
|
+
const pollData = (await this.getActivity(pollBody, stampWith));
|
|
3163
|
+
if (attempts > maxRetries) {
|
|
3164
|
+
return handleResponse(pollData);
|
|
3165
|
+
}
|
|
3166
|
+
attempts += 1;
|
|
3167
|
+
if (!http.TERMINAL_ACTIVITY_STATUSES.includes(pollData.activity.status)) {
|
|
3168
|
+
await sleep(pollingDuration);
|
|
3169
|
+
return pollStatus(activityId);
|
|
3170
|
+
}
|
|
3171
|
+
return handleResponse(pollData);
|
|
3172
|
+
};
|
|
3173
|
+
// Use the specified stamper for the initial request
|
|
3174
|
+
const responseData = (await this.request(url, body, stampWith));
|
|
3175
|
+
if (!http.TERMINAL_ACTIVITY_STATUSES.includes(responseData.activity.status)) {
|
|
3176
|
+
return pollStatus(responseData.activity.id);
|
|
3177
|
+
}
|
|
3178
|
+
return handleResponse(responseData);
|
|
3179
|
+
}
|
|
3180
|
+
async activityDecision(url, body, stampWith) {
|
|
3181
|
+
// Use the specified stamper for this request
|
|
3182
|
+
const activityData = (await this.request(url, body, stampWith));
|
|
3183
|
+
return {
|
|
3184
|
+
...activityData["activity"]["result"],
|
|
3185
|
+
...activityData,
|
|
3186
|
+
};
|
|
3187
|
+
}
|
|
3188
|
+
async authProxyRequest(url, body) {
|
|
3189
|
+
if (!this.config.authProxyUrl || !this.config.authProxyConfigId) {
|
|
3190
|
+
throw new sdkTypes.TurnkeyError("Auth Proxy URL or ID is not configured.", sdkTypes.TurnkeyErrorCodes.INVALID_CONFIGURATION);
|
|
3191
|
+
}
|
|
3192
|
+
const fullUrl = this.config.authProxyUrl + url;
|
|
3193
|
+
const stringifiedBody = JSON.stringify(body);
|
|
3194
|
+
var headers = {
|
|
3195
|
+
"Content-Type": "application/json",
|
|
3196
|
+
"X-Auth-Proxy-Config-ID": this.config.authProxyConfigId,
|
|
3197
|
+
};
|
|
3198
|
+
const response = await fetch(fullUrl, {
|
|
3199
|
+
method: "POST",
|
|
3200
|
+
headers: headers,
|
|
3201
|
+
body: stringifiedBody,
|
|
3202
|
+
});
|
|
3203
|
+
if (!response.ok) {
|
|
3204
|
+
let res;
|
|
3205
|
+
try {
|
|
3206
|
+
res = await response.json();
|
|
3207
|
+
}
|
|
3208
|
+
catch (_) {
|
|
3209
|
+
throw new Error(`${response.status} ${response.statusText}`);
|
|
3210
|
+
}
|
|
3211
|
+
throw new base.TurnkeyRequestError(res);
|
|
3212
|
+
}
|
|
3213
|
+
const data = await response.json();
|
|
3214
|
+
return data;
|
|
3215
|
+
}
|
|
3216
|
+
}
|
|
3217
|
+
|
|
3218
|
+
exports.TurnkeySDKClientBase = TurnkeySDKClientBase;
|
|
3219
|
+
//# sourceMappingURL=sdk-client-base.js.map
|