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