@openfort/openfort-js 0.7.0 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -3,8 +3,7 @@
3
3
  Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var hash = require('@ethersproject/hash');
6
- var openapiClients = require('@openfort/openapi-clients');
7
- require('axios');
6
+ var globalAxios = require('axios');
8
7
  var jose = require('jose');
9
8
  var secp256k1 = require('@noble/curves/secp256k1');
10
9
  var signingKey = require('@ethersproject/signing-key');
@@ -44,18 +43,2922 @@ exports.ThirdPartyOAuthProvider = void 0;
44
43
  ThirdPartyOAuthProvider["CUSTOM"] = "custom";
45
44
  ThirdPartyOAuthProvider["OIDC"] = "oidc";
46
45
  })(exports.ThirdPartyOAuthProvider || (exports.ThirdPartyOAuthProvider = {}));
46
+ exports.BasicAuthProvider = void 0;
47
+ (function (BasicAuthProvider) {
48
+ BasicAuthProvider["EMAIL"] = "email";
49
+ BasicAuthProvider["WALLET"] = "wallet";
50
+ })(exports.BasicAuthProvider || (exports.BasicAuthProvider = {}));
47
51
  exports.OAuthProvider = void 0;
48
52
  (function (OAuthProvider) {
49
- OAuthProvider["ACCELBYTE"] = "accelbyte";
50
- OAuthProvider["FIREBASE"] = "firebase";
51
53
  OAuthProvider["GOOGLE"] = "google";
52
- OAuthProvider["LOOTLOCKER"] = "lootlocker";
53
- OAuthProvider["PLAYFAB"] = "playfab";
54
- OAuthProvider["CUSTOM"] = "custom";
55
- OAuthProvider["OIDC"] = "oidc";
56
- OAuthProvider["SUPABASE"] = "supabase";
54
+ OAuthProvider["TWITTER"] = "twitter";
57
55
  })(exports.OAuthProvider || (exports.OAuthProvider = {}));
58
56
 
57
+ /* tslint:disable */
58
+ /* eslint-disable */
59
+ /**
60
+ * Openfort API
61
+ * Complete Openfort API references and guides can be found at: https://openfort.xyz/docs
62
+ *
63
+ * The version of the OpenAPI document: 1.0.0
64
+ * Contact: founders@openfort.xyz
65
+ *
66
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
67
+ * https://openapi-generator.tech
68
+ * Do not edit the class manually.
69
+ */
70
+ const BASE_PATH = "https://api.openfort.xyz".replace(/\/+$/, "");
71
+ /**
72
+ *
73
+ * @export
74
+ * @class BaseAPI
75
+ */
76
+ class BaseAPI {
77
+ basePath;
78
+ axios;
79
+ configuration;
80
+ constructor(configuration, basePath = BASE_PATH, axios = globalAxios) {
81
+ this.basePath = basePath;
82
+ this.axios = axios;
83
+ if (configuration) {
84
+ this.configuration = configuration;
85
+ this.basePath = configuration.basePath || this.basePath;
86
+ }
87
+ }
88
+ }
89
+ /**
90
+ *
91
+ * @export
92
+ * @class RequiredError
93
+ * @extends {Error}
94
+ */
95
+ class RequiredError extends Error {
96
+ field;
97
+ constructor(field, msg) {
98
+ super(msg);
99
+ this.field = field;
100
+ this.name = "RequiredError";
101
+ }
102
+ }
103
+
104
+ /* tslint:disable */
105
+ /* eslint-disable */
106
+ /**
107
+ * Openfort API
108
+ * Complete Openfort API references and guides can be found at: https://openfort.xyz/docs
109
+ *
110
+ * The version of the OpenAPI document: 1.0.0
111
+ * Contact: founders@openfort.xyz
112
+ *
113
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
114
+ * https://openapi-generator.tech
115
+ * Do not edit the class manually.
116
+ */
117
+ /**
118
+ *
119
+ * @export
120
+ */
121
+ const DUMMY_BASE_URL = 'https://example.com';
122
+ /**
123
+ *
124
+ * @throws {RequiredError}
125
+ * @export
126
+ */
127
+ const assertParamExists = function (functionName, paramName, paramValue) {
128
+ if (paramValue === null || paramValue === undefined) {
129
+ throw new RequiredError(paramName, `Required parameter ${paramName} was null or undefined when calling ${functionName}.`);
130
+ }
131
+ };
132
+ /**
133
+ *
134
+ * @export
135
+ */
136
+ const setBearerAuthToObject = async function (object, configuration) {
137
+ if (configuration && configuration.accessToken) {
138
+ const accessToken = typeof configuration.accessToken === 'function'
139
+ ? await configuration.accessToken()
140
+ : await configuration.accessToken;
141
+ object["Authorization"] = "Bearer " + accessToken;
142
+ }
143
+ };
144
+ function setFlattenedQueryParams(urlSearchParams, parameter, key = "") {
145
+ if (parameter == null)
146
+ return;
147
+ if (typeof parameter === "object") {
148
+ if (Array.isArray(parameter)) {
149
+ parameter.forEach(item => setFlattenedQueryParams(urlSearchParams, item, key));
150
+ }
151
+ else {
152
+ Object.keys(parameter).forEach(currentKey => setFlattenedQueryParams(urlSearchParams, parameter[currentKey], `${key}${key !== '' ? '.' : ''}${currentKey}`));
153
+ }
154
+ }
155
+ else {
156
+ if (urlSearchParams.has(key)) {
157
+ urlSearchParams.append(key, parameter);
158
+ }
159
+ else {
160
+ urlSearchParams.set(key, parameter);
161
+ }
162
+ }
163
+ }
164
+ /**
165
+ *
166
+ * @export
167
+ */
168
+ const setSearchParams = function (url, ...objects) {
169
+ const searchParams = new URLSearchParams(url.search);
170
+ setFlattenedQueryParams(searchParams, objects);
171
+ url.search = searchParams.toString();
172
+ };
173
+ /**
174
+ *
175
+ * @export
176
+ */
177
+ const serializeDataIfNeeded = function (value, requestOptions, configuration) {
178
+ const nonString = typeof value !== 'string';
179
+ const needsSerialization = nonString && configuration && configuration.isJsonMime
180
+ ? configuration.isJsonMime(requestOptions.headers['Content-Type'])
181
+ : nonString;
182
+ return needsSerialization
183
+ ? JSON.stringify(value !== undefined ? value : {})
184
+ : (value || "");
185
+ };
186
+ /**
187
+ *
188
+ * @export
189
+ */
190
+ const toPathString = function (url) {
191
+ return url.pathname + url.search + url.hash;
192
+ };
193
+ /**
194
+ *
195
+ * @export
196
+ */
197
+ const createRequestFunction = function (axiosArgs, globalAxios, BASE_PATH, configuration) {
198
+ return (axios = globalAxios, basePath = BASE_PATH) => {
199
+ const axiosRequestArgs = { ...axiosArgs.options, url: (configuration?.basePath || axios.defaults.baseURL || basePath) + axiosArgs.url };
200
+ return axios.request(axiosRequestArgs);
201
+ };
202
+ };
203
+
204
+ /* tslint:disable */
205
+ /* eslint-disable */
206
+ /**
207
+ * Openfort API
208
+ * Complete Openfort API references and guides can be found at: https://openfort.xyz/docs
209
+ *
210
+ * The version of the OpenAPI document: 1.0.0
211
+ * Contact: founders@openfort.xyz
212
+ *
213
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
214
+ * https://openapi-generator.tech
215
+ * Do not edit the class manually.
216
+ */
217
+ /**
218
+ * AccountsApi - axios parameter creator
219
+ * @export
220
+ */
221
+ const AccountsApiAxiosParamCreator = function (configuration) {
222
+ return {
223
+ /**
224
+ * Cancel a pending transfer of ownership.
225
+ * @summary Cancel request to transfer ownership of an account.
226
+ * @param {string} id Specifies the unique account ID (starts with acc_).
227
+ * @param {CancelTransferOwnershipRequest} cancelTransferOwnershipRequest
228
+ * @param {*} [options] Override http request option.
229
+ * @throws {RequiredError}
230
+ */
231
+ cancelTransferOwnership: async (id, cancelTransferOwnershipRequest, options = {}) => {
232
+ // verify required parameter 'id' is not null or undefined
233
+ assertParamExists('cancelTransferOwnership', 'id', id);
234
+ // verify required parameter 'cancelTransferOwnershipRequest' is not null or undefined
235
+ assertParamExists('cancelTransferOwnership', 'cancelTransferOwnershipRequest', cancelTransferOwnershipRequest);
236
+ const localVarPath = `/v1/accounts/{id}/cancel_transfer_ownership`
237
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
238
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
239
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
240
+ let baseOptions;
241
+ if (configuration) {
242
+ baseOptions = configuration.baseOptions;
243
+ }
244
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
245
+ const localVarHeaderParameter = {};
246
+ const localVarQueryParameter = {};
247
+ // authentication sk required
248
+ // http bearer authentication required
249
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
250
+ localVarHeaderParameter['Content-Type'] = 'application/json';
251
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
252
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
253
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
254
+ localVarRequestOptions.data = serializeDataIfNeeded(cancelTransferOwnershipRequest, localVarRequestOptions, configuration);
255
+ return {
256
+ url: toPathString(localVarUrlObj),
257
+ options: localVarRequestOptions,
258
+ };
259
+ },
260
+ /**
261
+ *
262
+ * @summary Complete a recovery process of a recoverable account.
263
+ * @param {string} id Specifies the unique account ID (starts with acc_).
264
+ * @param {CompleteRecoveryRequest} completeRecoveryRequest
265
+ * @param {*} [options] Override http request option.
266
+ * @throws {RequiredError}
267
+ */
268
+ completeRecovery: async (id, completeRecoveryRequest, options = {}) => {
269
+ // verify required parameter 'id' is not null or undefined
270
+ assertParamExists('completeRecovery', 'id', id);
271
+ // verify required parameter 'completeRecoveryRequest' is not null or undefined
272
+ assertParamExists('completeRecovery', 'completeRecoveryRequest', completeRecoveryRequest);
273
+ const localVarPath = `/v1/accounts/{id}/complete_recovery`
274
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
275
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
276
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
277
+ let baseOptions;
278
+ if (configuration) {
279
+ baseOptions = configuration.baseOptions;
280
+ }
281
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
282
+ const localVarHeaderParameter = {};
283
+ const localVarQueryParameter = {};
284
+ // authentication sk required
285
+ // http bearer authentication required
286
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
287
+ localVarHeaderParameter['Content-Type'] = 'application/json';
288
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
289
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
290
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
291
+ localVarRequestOptions.data = serializeDataIfNeeded(completeRecoveryRequest, localVarRequestOptions, configuration);
292
+ return {
293
+ url: toPathString(localVarUrlObj),
294
+ options: localVarRequestOptions,
295
+ };
296
+ },
297
+ /**
298
+ * Creates a new blockchain account for the provided player. If not player is provided, a new one will be created. Account creation does not consume any gas. All accounts of a player will use the same address across blockchains. Each player can only have one account per chain.
299
+ * @summary Create an account object.
300
+ * @param {CreateAccountRequest} createAccountRequest
301
+ * @param {*} [options] Override http request option.
302
+ * @throws {RequiredError}
303
+ */
304
+ createAccount: async (createAccountRequest, options = {}) => {
305
+ // verify required parameter 'createAccountRequest' is not null or undefined
306
+ assertParamExists('createAccount', 'createAccountRequest', createAccountRequest);
307
+ const localVarPath = `/v1/accounts`;
308
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
309
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
310
+ let baseOptions;
311
+ if (configuration) {
312
+ baseOptions = configuration.baseOptions;
313
+ }
314
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
315
+ const localVarHeaderParameter = {};
316
+ const localVarQueryParameter = {};
317
+ // authentication sk required
318
+ // http bearer authentication required
319
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
320
+ localVarHeaderParameter['Content-Type'] = 'application/json';
321
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
322
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
323
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
324
+ localVarRequestOptions.data = serializeDataIfNeeded(createAccountRequest, localVarRequestOptions, configuration);
325
+ return {
326
+ url: toPathString(localVarUrlObj),
327
+ options: localVarRequestOptions,
328
+ };
329
+ },
330
+ /**
331
+ * This endpoint can be used to deploy a smart contract account that was counterfactually generated.
332
+ * @summary Deploy an account.
333
+ * @param {string} id Specifies the unique account ID (starts with acc_).
334
+ * @param {DeployRequest} deployRequest
335
+ * @param {*} [options] Override http request option.
336
+ * @throws {RequiredError}
337
+ */
338
+ deployAccount: async (id, deployRequest, options = {}) => {
339
+ // verify required parameter 'id' is not null or undefined
340
+ assertParamExists('deployAccount', 'id', id);
341
+ // verify required parameter 'deployRequest' is not null or undefined
342
+ assertParamExists('deployAccount', 'deployRequest', deployRequest);
343
+ const localVarPath = `/v1/accounts/{id}/deploy`
344
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
345
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
346
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
347
+ let baseOptions;
348
+ if (configuration) {
349
+ baseOptions = configuration.baseOptions;
350
+ }
351
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
352
+ const localVarHeaderParameter = {};
353
+ const localVarQueryParameter = {};
354
+ // authentication sk required
355
+ // http bearer authentication required
356
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
357
+ localVarHeaderParameter['Content-Type'] = 'application/json';
358
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
359
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
360
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
361
+ localVarRequestOptions.data = serializeDataIfNeeded(deployRequest, localVarRequestOptions, configuration);
362
+ return {
363
+ url: toPathString(localVarUrlObj),
364
+ options: localVarRequestOptions,
365
+ };
366
+ },
367
+ /**
368
+ * Retrieves the details of an existing account. Supply the unique account ID from either a account creation request or the account list, and Openfort will return the corresponding account information. Returns the latest 10 transaction intents created by this account.
369
+ * @summary Get existing account.
370
+ * @param {string} id Specifies the unique account ID (starts with acc_).
371
+ * @param {Array<AccountResponseExpandable>} [expand]
372
+ * @param {*} [options] Override http request option.
373
+ * @throws {RequiredError}
374
+ */
375
+ getAccount: async (id, expand, options = {}) => {
376
+ // verify required parameter 'id' is not null or undefined
377
+ assertParamExists('getAccount', 'id', id);
378
+ const localVarPath = `/v1/accounts/{id}`
379
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
380
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
381
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
382
+ let baseOptions;
383
+ if (configuration) {
384
+ baseOptions = configuration.baseOptions;
385
+ }
386
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
387
+ const localVarHeaderParameter = {};
388
+ const localVarQueryParameter = {};
389
+ // authentication sk required
390
+ // http bearer authentication required
391
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
392
+ if (expand) {
393
+ localVarQueryParameter['expand'] = expand;
394
+ }
395
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
396
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
397
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
398
+ return {
399
+ url: toPathString(localVarUrlObj),
400
+ options: localVarRequestOptions,
401
+ };
402
+ },
403
+ /**
404
+ * Returns a list of accounts for the given player. This object represents a player\'s account, which is a blockchain smart account that can be used to interact with the blockchain. The accounts are returned sorted by creation date, with the most recently created accounts appearing first. Returns the latest 10 transaction intents for each account. By default, a maximum of 10 accounts are shown per page.
405
+ * @summary List accounts of a player.
406
+ * @param {string} player Specifies the unique player ID (starts with pla_)
407
+ * @param {number} [limit] Specifies the maximum number of records to return.
408
+ * @param {number} [skip] Specifies the offset for the first records to return.
409
+ * @param {SortOrder} [order] Specifies the order in which to sort the results.
410
+ * @param {Array<AccountResponseExpandable>} [expand] Specifies the fields to expand in the response.
411
+ * @param {*} [options] Override http request option.
412
+ * @throws {RequiredError}
413
+ */
414
+ getAccounts: async (player, limit, skip, order, expand, options = {}) => {
415
+ // verify required parameter 'player' is not null or undefined
416
+ assertParamExists('getAccounts', 'player', player);
417
+ const localVarPath = `/v1/accounts`;
418
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
419
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
420
+ let baseOptions;
421
+ if (configuration) {
422
+ baseOptions = configuration.baseOptions;
423
+ }
424
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
425
+ const localVarHeaderParameter = {};
426
+ const localVarQueryParameter = {};
427
+ // authentication sk required
428
+ // http bearer authentication required
429
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
430
+ if (limit !== undefined) {
431
+ localVarQueryParameter['limit'] = limit;
432
+ }
433
+ if (skip !== undefined) {
434
+ localVarQueryParameter['skip'] = skip;
435
+ }
436
+ if (order !== undefined) {
437
+ localVarQueryParameter['order'] = order;
438
+ }
439
+ if (expand) {
440
+ localVarQueryParameter['expand'] = expand;
441
+ }
442
+ if (player !== undefined) {
443
+ localVarQueryParameter['player'] = player;
444
+ }
445
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
446
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
447
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
448
+ return {
449
+ url: toPathString(localVarUrlObj),
450
+ options: localVarRequestOptions,
451
+ };
452
+ },
453
+ /**
454
+ * Perform a request to change the owner of an account. To perform an update on the owner of an account, first you must provide a new owner address. Once requested, the owner must accept to take ownership by calling `acceptOwnership()` in the smart contract account.
455
+ * @summary Request transfer ownership of account.
456
+ * @param {string} id Specifies the unique account ID (starts with acc_).
457
+ * @param {TransferOwnershipRequest} transferOwnershipRequest
458
+ * @param {*} [options] Override http request option.
459
+ * @throws {RequiredError}
460
+ */
461
+ requestTransferOwnership: async (id, transferOwnershipRequest, options = {}) => {
462
+ // verify required parameter 'id' is not null or undefined
463
+ assertParamExists('requestTransferOwnership', 'id', id);
464
+ // verify required parameter 'transferOwnershipRequest' is not null or undefined
465
+ assertParamExists('requestTransferOwnership', 'transferOwnershipRequest', transferOwnershipRequest);
466
+ const localVarPath = `/v1/accounts/{id}/request_transfer_ownership`
467
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
468
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
469
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
470
+ let baseOptions;
471
+ if (configuration) {
472
+ baseOptions = configuration.baseOptions;
473
+ }
474
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
475
+ const localVarHeaderParameter = {};
476
+ const localVarQueryParameter = {};
477
+ // authentication sk required
478
+ // http bearer authentication required
479
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
480
+ localVarHeaderParameter['Content-Type'] = 'application/json';
481
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
482
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
483
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
484
+ localVarRequestOptions.data = serializeDataIfNeeded(transferOwnershipRequest, localVarRequestOptions, configuration);
485
+ return {
486
+ url: toPathString(localVarUrlObj),
487
+ options: localVarRequestOptions,
488
+ };
489
+ },
490
+ /**
491
+ * **Custodial Accounts only** - Signs the typed data value with types data structure for domain using the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) specification.
492
+ * @summary Sign a given payload
493
+ * @param {string} id Specifies the unique account ID (starts with acc_).
494
+ * @param {SignPayloadRequest} signPayloadRequest
495
+ * @param {*} [options] Override http request option.
496
+ * @throws {RequiredError}
497
+ */
498
+ signPayload: async (id, signPayloadRequest, options = {}) => {
499
+ // verify required parameter 'id' is not null or undefined
500
+ assertParamExists('signPayload', 'id', id);
501
+ // verify required parameter 'signPayloadRequest' is not null or undefined
502
+ assertParamExists('signPayload', 'signPayloadRequest', signPayloadRequest);
503
+ const localVarPath = `/v1/accounts/{id}/sign_payload`
504
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
505
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
506
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
507
+ let baseOptions;
508
+ if (configuration) {
509
+ baseOptions = configuration.baseOptions;
510
+ }
511
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
512
+ const localVarHeaderParameter = {};
513
+ const localVarQueryParameter = {};
514
+ // authentication sk required
515
+ // http bearer authentication required
516
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
517
+ localVarHeaderParameter['Content-Type'] = 'application/json';
518
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
519
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
520
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
521
+ localVarRequestOptions.data = serializeDataIfNeeded(signPayloadRequest, localVarRequestOptions, configuration);
522
+ return {
523
+ url: toPathString(localVarUrlObj),
524
+ options: localVarRequestOptions,
525
+ };
526
+ },
527
+ /**
528
+ *
529
+ * @summary Start a recovery process of a recoverable account.
530
+ * @param {string} id Specifies the unique account ID (starts with acc_).
531
+ * @param {StartRecoveryRequest} startRecoveryRequest
532
+ * @param {*} [options] Override http request option.
533
+ * @throws {RequiredError}
534
+ */
535
+ startRecovery: async (id, startRecoveryRequest, options = {}) => {
536
+ // verify required parameter 'id' is not null or undefined
537
+ assertParamExists('startRecovery', 'id', id);
538
+ // verify required parameter 'startRecoveryRequest' is not null or undefined
539
+ assertParamExists('startRecovery', 'startRecoveryRequest', startRecoveryRequest);
540
+ const localVarPath = `/v1/accounts/{id}/start_recovery`
541
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
542
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
543
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
544
+ let baseOptions;
545
+ if (configuration) {
546
+ baseOptions = configuration.baseOptions;
547
+ }
548
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
549
+ const localVarHeaderParameter = {};
550
+ const localVarQueryParameter = {};
551
+ // authentication sk required
552
+ // http bearer authentication required
553
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
554
+ localVarHeaderParameter['Content-Type'] = 'application/json';
555
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
556
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
557
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
558
+ localVarRequestOptions.data = serializeDataIfNeeded(startRecoveryRequest, localVarRequestOptions, configuration);
559
+ return {
560
+ url: toPathString(localVarUrlObj),
561
+ options: localVarRequestOptions,
562
+ };
563
+ },
564
+ /**
565
+ * Synchronize the account state with the blockchain. Specifically, it updates the account owner and whether its deployed or not.
566
+ * @summary Sync account state with the blockchain
567
+ * @param {string} id Specifies the unique account ID (starts with acc_).
568
+ * @param {*} [options] Override http request option.
569
+ * @throws {RequiredError}
570
+ */
571
+ syncAccount: async (id, options = {}) => {
572
+ // verify required parameter 'id' is not null or undefined
573
+ assertParamExists('syncAccount', 'id', id);
574
+ const localVarPath = `/v1/accounts/{id}/sync`
575
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
576
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
577
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
578
+ let baseOptions;
579
+ if (configuration) {
580
+ baseOptions = configuration.baseOptions;
581
+ }
582
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
583
+ const localVarHeaderParameter = {};
584
+ const localVarQueryParameter = {};
585
+ // authentication sk required
586
+ // http bearer authentication required
587
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
588
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
589
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
590
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
591
+ return {
592
+ url: toPathString(localVarUrlObj),
593
+ options: localVarRequestOptions,
594
+ };
595
+ },
596
+ };
597
+ };
598
+ /**
599
+ * AccountsApi - functional programming interface
600
+ * @export
601
+ */
602
+ const AccountsApiFp = function (configuration) {
603
+ const localVarAxiosParamCreator = AccountsApiAxiosParamCreator(configuration);
604
+ return {
605
+ /**
606
+ * Cancel a pending transfer of ownership.
607
+ * @summary Cancel request to transfer ownership of an account.
608
+ * @param {string} id Specifies the unique account ID (starts with acc_).
609
+ * @param {CancelTransferOwnershipRequest} cancelTransferOwnershipRequest
610
+ * @param {*} [options] Override http request option.
611
+ * @throws {RequiredError}
612
+ */
613
+ async cancelTransferOwnership(id, cancelTransferOwnershipRequest, options) {
614
+ const localVarAxiosArgs = await localVarAxiosParamCreator.cancelTransferOwnership(id, cancelTransferOwnershipRequest, options);
615
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
616
+ },
617
+ /**
618
+ *
619
+ * @summary Complete a recovery process of a recoverable account.
620
+ * @param {string} id Specifies the unique account ID (starts with acc_).
621
+ * @param {CompleteRecoveryRequest} completeRecoveryRequest
622
+ * @param {*} [options] Override http request option.
623
+ * @throws {RequiredError}
624
+ */
625
+ async completeRecovery(id, completeRecoveryRequest, options) {
626
+ const localVarAxiosArgs = await localVarAxiosParamCreator.completeRecovery(id, completeRecoveryRequest, options);
627
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
628
+ },
629
+ /**
630
+ * Creates a new blockchain account for the provided player. If not player is provided, a new one will be created. Account creation does not consume any gas. All accounts of a player will use the same address across blockchains. Each player can only have one account per chain.
631
+ * @summary Create an account object.
632
+ * @param {CreateAccountRequest} createAccountRequest
633
+ * @param {*} [options] Override http request option.
634
+ * @throws {RequiredError}
635
+ */
636
+ async createAccount(createAccountRequest, options) {
637
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createAccount(createAccountRequest, options);
638
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
639
+ },
640
+ /**
641
+ * This endpoint can be used to deploy a smart contract account that was counterfactually generated.
642
+ * @summary Deploy an account.
643
+ * @param {string} id Specifies the unique account ID (starts with acc_).
644
+ * @param {DeployRequest} deployRequest
645
+ * @param {*} [options] Override http request option.
646
+ * @throws {RequiredError}
647
+ */
648
+ async deployAccount(id, deployRequest, options) {
649
+ const localVarAxiosArgs = await localVarAxiosParamCreator.deployAccount(id, deployRequest, options);
650
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
651
+ },
652
+ /**
653
+ * Retrieves the details of an existing account. Supply the unique account ID from either a account creation request or the account list, and Openfort will return the corresponding account information. Returns the latest 10 transaction intents created by this account.
654
+ * @summary Get existing account.
655
+ * @param {string} id Specifies the unique account ID (starts with acc_).
656
+ * @param {Array<AccountResponseExpandable>} [expand]
657
+ * @param {*} [options] Override http request option.
658
+ * @throws {RequiredError}
659
+ */
660
+ async getAccount(id, expand, options) {
661
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getAccount(id, expand, options);
662
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
663
+ },
664
+ /**
665
+ * Returns a list of accounts for the given player. This object represents a player\'s account, which is a blockchain smart account that can be used to interact with the blockchain. The accounts are returned sorted by creation date, with the most recently created accounts appearing first. Returns the latest 10 transaction intents for each account. By default, a maximum of 10 accounts are shown per page.
666
+ * @summary List accounts of a player.
667
+ * @param {string} player Specifies the unique player ID (starts with pla_)
668
+ * @param {number} [limit] Specifies the maximum number of records to return.
669
+ * @param {number} [skip] Specifies the offset for the first records to return.
670
+ * @param {SortOrder} [order] Specifies the order in which to sort the results.
671
+ * @param {Array<AccountResponseExpandable>} [expand] Specifies the fields to expand in the response.
672
+ * @param {*} [options] Override http request option.
673
+ * @throws {RequiredError}
674
+ */
675
+ async getAccounts(player, limit, skip, order, expand, options) {
676
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getAccounts(player, limit, skip, order, expand, options);
677
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
678
+ },
679
+ /**
680
+ * Perform a request to change the owner of an account. To perform an update on the owner of an account, first you must provide a new owner address. Once requested, the owner must accept to take ownership by calling `acceptOwnership()` in the smart contract account.
681
+ * @summary Request transfer ownership of account.
682
+ * @param {string} id Specifies the unique account ID (starts with acc_).
683
+ * @param {TransferOwnershipRequest} transferOwnershipRequest
684
+ * @param {*} [options] Override http request option.
685
+ * @throws {RequiredError}
686
+ */
687
+ async requestTransferOwnership(id, transferOwnershipRequest, options) {
688
+ const localVarAxiosArgs = await localVarAxiosParamCreator.requestTransferOwnership(id, transferOwnershipRequest, options);
689
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
690
+ },
691
+ /**
692
+ * **Custodial Accounts only** - Signs the typed data value with types data structure for domain using the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) specification.
693
+ * @summary Sign a given payload
694
+ * @param {string} id Specifies the unique account ID (starts with acc_).
695
+ * @param {SignPayloadRequest} signPayloadRequest
696
+ * @param {*} [options] Override http request option.
697
+ * @throws {RequiredError}
698
+ */
699
+ async signPayload(id, signPayloadRequest, options) {
700
+ const localVarAxiosArgs = await localVarAxiosParamCreator.signPayload(id, signPayloadRequest, options);
701
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
702
+ },
703
+ /**
704
+ *
705
+ * @summary Start a recovery process of a recoverable account.
706
+ * @param {string} id Specifies the unique account ID (starts with acc_).
707
+ * @param {StartRecoveryRequest} startRecoveryRequest
708
+ * @param {*} [options] Override http request option.
709
+ * @throws {RequiredError}
710
+ */
711
+ async startRecovery(id, startRecoveryRequest, options) {
712
+ const localVarAxiosArgs = await localVarAxiosParamCreator.startRecovery(id, startRecoveryRequest, options);
713
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
714
+ },
715
+ /**
716
+ * Synchronize the account state with the blockchain. Specifically, it updates the account owner and whether its deployed or not.
717
+ * @summary Sync account state with the blockchain
718
+ * @param {string} id Specifies the unique account ID (starts with acc_).
719
+ * @param {*} [options] Override http request option.
720
+ * @throws {RequiredError}
721
+ */
722
+ async syncAccount(id, options) {
723
+ const localVarAxiosArgs = await localVarAxiosParamCreator.syncAccount(id, options);
724
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
725
+ },
726
+ };
727
+ };
728
+ /**
729
+ * AccountsApi - object-oriented interface
730
+ * @export
731
+ * @class AccountsApi
732
+ * @extends {BaseAPI}
733
+ */
734
+ class AccountsApi extends BaseAPI {
735
+ /**
736
+ * Cancel a pending transfer of ownership.
737
+ * @summary Cancel request to transfer ownership of an account.
738
+ * @param {AccountsApiCancelTransferOwnershipRequest} requestParameters Request parameters.
739
+ * @param {*} [options] Override http request option.
740
+ * @throws {RequiredError}
741
+ * @memberof AccountsApi
742
+ */
743
+ cancelTransferOwnership(requestParameters, options) {
744
+ return AccountsApiFp(this.configuration).cancelTransferOwnership(requestParameters.id, requestParameters.cancelTransferOwnershipRequest, options).then((request) => request(this.axios, this.basePath));
745
+ }
746
+ /**
747
+ *
748
+ * @summary Complete a recovery process of a recoverable account.
749
+ * @param {AccountsApiCompleteRecoveryRequest} requestParameters Request parameters.
750
+ * @param {*} [options] Override http request option.
751
+ * @throws {RequiredError}
752
+ * @memberof AccountsApi
753
+ */
754
+ completeRecovery(requestParameters, options) {
755
+ return AccountsApiFp(this.configuration).completeRecovery(requestParameters.id, requestParameters.completeRecoveryRequest, options).then((request) => request(this.axios, this.basePath));
756
+ }
757
+ /**
758
+ * Creates a new blockchain account for the provided player. If not player is provided, a new one will be created. Account creation does not consume any gas. All accounts of a player will use the same address across blockchains. Each player can only have one account per chain.
759
+ * @summary Create an account object.
760
+ * @param {AccountsApiCreateAccountRequest} requestParameters Request parameters.
761
+ * @param {*} [options] Override http request option.
762
+ * @throws {RequiredError}
763
+ * @memberof AccountsApi
764
+ */
765
+ createAccount(requestParameters, options) {
766
+ return AccountsApiFp(this.configuration).createAccount(requestParameters.createAccountRequest, options).then((request) => request(this.axios, this.basePath));
767
+ }
768
+ /**
769
+ * This endpoint can be used to deploy a smart contract account that was counterfactually generated.
770
+ * @summary Deploy an account.
771
+ * @param {AccountsApiDeployAccountRequest} requestParameters Request parameters.
772
+ * @param {*} [options] Override http request option.
773
+ * @throws {RequiredError}
774
+ * @memberof AccountsApi
775
+ */
776
+ deployAccount(requestParameters, options) {
777
+ return AccountsApiFp(this.configuration).deployAccount(requestParameters.id, requestParameters.deployRequest, options).then((request) => request(this.axios, this.basePath));
778
+ }
779
+ /**
780
+ * Retrieves the details of an existing account. Supply the unique account ID from either a account creation request or the account list, and Openfort will return the corresponding account information. Returns the latest 10 transaction intents created by this account.
781
+ * @summary Get existing account.
782
+ * @param {AccountsApiGetAccountRequest} requestParameters Request parameters.
783
+ * @param {*} [options] Override http request option.
784
+ * @throws {RequiredError}
785
+ * @memberof AccountsApi
786
+ */
787
+ getAccount(requestParameters, options) {
788
+ return AccountsApiFp(this.configuration).getAccount(requestParameters.id, requestParameters.expand, options).then((request) => request(this.axios, this.basePath));
789
+ }
790
+ /**
791
+ * Returns a list of accounts for the given player. This object represents a player\'s account, which is a blockchain smart account that can be used to interact with the blockchain. The accounts are returned sorted by creation date, with the most recently created accounts appearing first. Returns the latest 10 transaction intents for each account. By default, a maximum of 10 accounts are shown per page.
792
+ * @summary List accounts of a player.
793
+ * @param {AccountsApiGetAccountsRequest} requestParameters Request parameters.
794
+ * @param {*} [options] Override http request option.
795
+ * @throws {RequiredError}
796
+ * @memberof AccountsApi
797
+ */
798
+ getAccounts(requestParameters, options) {
799
+ return AccountsApiFp(this.configuration).getAccounts(requestParameters.player, requestParameters.limit, requestParameters.skip, requestParameters.order, requestParameters.expand, options).then((request) => request(this.axios, this.basePath));
800
+ }
801
+ /**
802
+ * Perform a request to change the owner of an account. To perform an update on the owner of an account, first you must provide a new owner address. Once requested, the owner must accept to take ownership by calling `acceptOwnership()` in the smart contract account.
803
+ * @summary Request transfer ownership of account.
804
+ * @param {AccountsApiRequestTransferOwnershipRequest} requestParameters Request parameters.
805
+ * @param {*} [options] Override http request option.
806
+ * @throws {RequiredError}
807
+ * @memberof AccountsApi
808
+ */
809
+ requestTransferOwnership(requestParameters, options) {
810
+ return AccountsApiFp(this.configuration).requestTransferOwnership(requestParameters.id, requestParameters.transferOwnershipRequest, options).then((request) => request(this.axios, this.basePath));
811
+ }
812
+ /**
813
+ * **Custodial Accounts only** - Signs the typed data value with types data structure for domain using the [EIP-712](https://eips.ethereum.org/EIPS/eip-712) specification.
814
+ * @summary Sign a given payload
815
+ * @param {AccountsApiSignPayloadRequest} requestParameters Request parameters.
816
+ * @param {*} [options] Override http request option.
817
+ * @throws {RequiredError}
818
+ * @memberof AccountsApi
819
+ */
820
+ signPayload(requestParameters, options) {
821
+ return AccountsApiFp(this.configuration).signPayload(requestParameters.id, requestParameters.signPayloadRequest, options).then((request) => request(this.axios, this.basePath));
822
+ }
823
+ /**
824
+ *
825
+ * @summary Start a recovery process of a recoverable account.
826
+ * @param {AccountsApiStartRecoveryRequest} requestParameters Request parameters.
827
+ * @param {*} [options] Override http request option.
828
+ * @throws {RequiredError}
829
+ * @memberof AccountsApi
830
+ */
831
+ startRecovery(requestParameters, options) {
832
+ return AccountsApiFp(this.configuration).startRecovery(requestParameters.id, requestParameters.startRecoveryRequest, options).then((request) => request(this.axios, this.basePath));
833
+ }
834
+ /**
835
+ * Synchronize the account state with the blockchain. Specifically, it updates the account owner and whether its deployed or not.
836
+ * @summary Sync account state with the blockchain
837
+ * @param {AccountsApiSyncAccountRequest} requestParameters Request parameters.
838
+ * @param {*} [options] Override http request option.
839
+ * @throws {RequiredError}
840
+ * @memberof AccountsApi
841
+ */
842
+ syncAccount(requestParameters, options) {
843
+ return AccountsApiFp(this.configuration).syncAccount(requestParameters.id, options).then((request) => request(this.axios, this.basePath));
844
+ }
845
+ }
846
+
847
+ /* tslint:disable */
848
+ /* eslint-disable */
849
+ /**
850
+ * Openfort API
851
+ * Complete Openfort API references and guides can be found at: https://openfort.xyz/docs
852
+ *
853
+ * The version of the OpenAPI document: 1.0.0
854
+ * Contact: founders@openfort.xyz
855
+ *
856
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
857
+ * https://openapi-generator.tech
858
+ * Do not edit the class manually.
859
+ */
860
+ /**
861
+ * AuthenticationApi - axios parameter creator
862
+ * @export
863
+ */
864
+ const AuthenticationApiAxiosParamCreator = function (configuration) {
865
+ return {
866
+ /**
867
+ * Deprecated
868
+ * @summary Authenticate player with oauth token.
869
+ * @param {AuthenticateOAuthRequest} authenticateOAuthRequest
870
+ * @param {*} [options] Override http request option.
871
+ * @throws {RequiredError}
872
+ */
873
+ authenticateOAuth: async (authenticateOAuthRequest, options = {}) => {
874
+ // verify required parameter 'authenticateOAuthRequest' is not null or undefined
875
+ assertParamExists('authenticateOAuth', 'authenticateOAuthRequest', authenticateOAuthRequest);
876
+ const localVarPath = `/iam/v1/oauth/authenticate`;
877
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
878
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
879
+ let baseOptions;
880
+ if (configuration) {
881
+ baseOptions = configuration.baseOptions;
882
+ }
883
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
884
+ const localVarHeaderParameter = {};
885
+ const localVarQueryParameter = {};
886
+ // authentication pk required
887
+ // http bearer authentication required
888
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
889
+ localVarHeaderParameter['Content-Type'] = 'application/json';
890
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
891
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
892
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
893
+ localVarRequestOptions.data = serializeDataIfNeeded(authenticateOAuthRequest, localVarRequestOptions, configuration);
894
+ return {
895
+ url: toPathString(localVarUrlObj),
896
+ options: localVarRequestOptions,
897
+ };
898
+ },
899
+ /**
900
+ *
901
+ * @summary Authenticate player with SIWE
902
+ * @param {SIWEAuthenticateRequest} sIWEAuthenticateRequest
903
+ * @param {*} [options] Override http request option.
904
+ * @throws {RequiredError}
905
+ */
906
+ authenticateSIWE: async (sIWEAuthenticateRequest, options = {}) => {
907
+ // verify required parameter 'sIWEAuthenticateRequest' is not null or undefined
908
+ assertParamExists('authenticateSIWE', 'sIWEAuthenticateRequest', sIWEAuthenticateRequest);
909
+ const localVarPath = `/iam/v1/siwe/authenticate`;
910
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
911
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
912
+ let baseOptions;
913
+ if (configuration) {
914
+ baseOptions = configuration.baseOptions;
915
+ }
916
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
917
+ const localVarHeaderParameter = {};
918
+ const localVarQueryParameter = {};
919
+ // authentication pk required
920
+ // http bearer authentication required
921
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
922
+ localVarHeaderParameter['Content-Type'] = 'application/json';
923
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
924
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
925
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
926
+ localVarRequestOptions.data = serializeDataIfNeeded(sIWEAuthenticateRequest, localVarRequestOptions, configuration);
927
+ return {
928
+ url: toPathString(localVarUrlObj),
929
+ options: localVarRequestOptions,
930
+ };
931
+ },
932
+ /**
933
+ * The endpoint verifies the token generated by OAuth provider, creates or retrieves a player based on his email, and returns the jwt token for the player together with the player id.
934
+ * @summary Authorize player with token.
935
+ * @param {AuthProvider} provider OAuth provider
936
+ * @param {OAuthRequest} oAuthRequest
937
+ * @param {*} [options] Override http request option.
938
+ * @deprecated
939
+ * @throws {RequiredError}
940
+ */
941
+ authorizeWithOAuthToken: async (provider, oAuthRequest, options = {}) => {
942
+ // verify required parameter 'provider' is not null or undefined
943
+ assertParamExists('authorizeWithOAuthToken', 'provider', provider);
944
+ // verify required parameter 'oAuthRequest' is not null or undefined
945
+ assertParamExists('authorizeWithOAuthToken', 'oAuthRequest', oAuthRequest);
946
+ const localVarPath = `/iam/v1/oauth/{provider}/authorize`
947
+ .replace(`{${"provider"}}`, encodeURIComponent(String(provider)));
948
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
949
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
950
+ let baseOptions;
951
+ if (configuration) {
952
+ baseOptions = configuration.baseOptions;
953
+ }
954
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
955
+ const localVarHeaderParameter = {};
956
+ const localVarQueryParameter = {};
957
+ // authentication sk required
958
+ // http bearer authentication required
959
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
960
+ // authentication pk required
961
+ // http bearer authentication required
962
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
963
+ localVarHeaderParameter['Content-Type'] = 'application/json';
964
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
965
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
966
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
967
+ localVarRequestOptions.data = serializeDataIfNeeded(oAuthRequest, localVarRequestOptions, configuration);
968
+ return {
969
+ url: toPathString(localVarUrlObj),
970
+ options: localVarRequestOptions,
971
+ };
972
+ },
973
+ /**
974
+ * Get the jwks.json file. You can use the jwks.json file to verify the signature of a JWT token issued by Openfort Auth.
975
+ * @summary Get the jwks.json file.
976
+ * @param {string} publishableKey Specifies the project publishable key (starts with pk_).
977
+ * @param {*} [options] Override http request option.
978
+ * @throws {RequiredError}
979
+ */
980
+ getJwks: async (publishableKey, options = {}) => {
981
+ // verify required parameter 'publishableKey' is not null or undefined
982
+ assertParamExists('getJwks', 'publishableKey', publishableKey);
983
+ const localVarPath = `/iam/v1/{publishable_key}/jwks.json`
984
+ .replace(`{${"publishable_key"}}`, encodeURIComponent(String(publishableKey)));
985
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
986
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
987
+ let baseOptions;
988
+ if (configuration) {
989
+ baseOptions = configuration.baseOptions;
990
+ }
991
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
992
+ const localVarHeaderParameter = {};
993
+ const localVarQueryParameter = {};
994
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
995
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
996
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
997
+ return {
998
+ url: toPathString(localVarUrlObj),
999
+ options: localVarRequestOptions,
1000
+ };
1001
+ },
1002
+ /**
1003
+ *
1004
+ * @summary Initialize Link OAuth.
1005
+ * @param {OAuthInitRequest} oAuthInitRequest
1006
+ * @param {*} [options] Override http request option.
1007
+ * @throws {RequiredError}
1008
+ */
1009
+ initLinkOAuth: async (oAuthInitRequest, options = {}) => {
1010
+ // verify required parameter 'oAuthInitRequest' is not null or undefined
1011
+ assertParamExists('initLinkOAuth', 'oAuthInitRequest', oAuthInitRequest);
1012
+ const localVarPath = `/iam/v1/oauth/init_link`;
1013
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1014
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1015
+ let baseOptions;
1016
+ if (configuration) {
1017
+ baseOptions = configuration.baseOptions;
1018
+ }
1019
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1020
+ const localVarHeaderParameter = {};
1021
+ const localVarQueryParameter = {};
1022
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1023
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1024
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1025
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1026
+ localVarRequestOptions.data = serializeDataIfNeeded(oAuthInitRequest, localVarRequestOptions, configuration);
1027
+ return {
1028
+ url: toPathString(localVarUrlObj),
1029
+ options: localVarRequestOptions,
1030
+ };
1031
+ },
1032
+ /**
1033
+ *
1034
+ * @summary Initialize OAuth.
1035
+ * @param {OAuthInitRequest} oAuthInitRequest
1036
+ * @param {*} [options] Override http request option.
1037
+ * @throws {RequiredError}
1038
+ */
1039
+ initOAuth: async (oAuthInitRequest, options = {}) => {
1040
+ // verify required parameter 'oAuthInitRequest' is not null or undefined
1041
+ assertParamExists('initOAuth', 'oAuthInitRequest', oAuthInitRequest);
1042
+ const localVarPath = `/iam/v1/oauth/init`;
1043
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1044
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1045
+ let baseOptions;
1046
+ if (configuration) {
1047
+ baseOptions = configuration.baseOptions;
1048
+ }
1049
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1050
+ const localVarHeaderParameter = {};
1051
+ const localVarQueryParameter = {};
1052
+ // authentication pk required
1053
+ // http bearer authentication required
1054
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1055
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1056
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1057
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1058
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1059
+ localVarRequestOptions.data = serializeDataIfNeeded(oAuthInitRequest, localVarRequestOptions, configuration);
1060
+ return {
1061
+ url: toPathString(localVarUrlObj),
1062
+ options: localVarRequestOptions,
1063
+ };
1064
+ },
1065
+ /**
1066
+ * Create a challenge to link external wallet to the player.
1067
+ * @summary Initialize SIWE.
1068
+ * @param {SIWERequest} sIWERequest
1069
+ * @param {*} [options] Override http request option.
1070
+ * @throws {RequiredError}
1071
+ */
1072
+ initSIWE: async (sIWERequest, options = {}) => {
1073
+ // verify required parameter 'sIWERequest' is not null or undefined
1074
+ assertParamExists('initSIWE', 'sIWERequest', sIWERequest);
1075
+ const localVarPath = `/iam/v1/siwe/init`;
1076
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1077
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1078
+ let baseOptions;
1079
+ if (configuration) {
1080
+ baseOptions = configuration.baseOptions;
1081
+ }
1082
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1083
+ const localVarHeaderParameter = {};
1084
+ const localVarQueryParameter = {};
1085
+ // authentication pk required
1086
+ // http bearer authentication required
1087
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1088
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1089
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1090
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1091
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1092
+ localVarRequestOptions.data = serializeDataIfNeeded(sIWERequest, localVarRequestOptions, configuration);
1093
+ return {
1094
+ url: toPathString(localVarUrlObj),
1095
+ options: localVarRequestOptions,
1096
+ };
1097
+ },
1098
+ /**
1099
+ *
1100
+ * @summary Link external wallet.
1101
+ * @param {SIWEAuthenticateRequest} sIWEAuthenticateRequest
1102
+ * @param {*} [options] Override http request option.
1103
+ * @throws {RequiredError}
1104
+ */
1105
+ linkSIWE: async (sIWEAuthenticateRequest, options = {}) => {
1106
+ // verify required parameter 'sIWEAuthenticateRequest' is not null or undefined
1107
+ assertParamExists('linkSIWE', 'sIWEAuthenticateRequest', sIWEAuthenticateRequest);
1108
+ const localVarPath = `/iam/v1/siwe/link`;
1109
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1110
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1111
+ let baseOptions;
1112
+ if (configuration) {
1113
+ baseOptions = configuration.baseOptions;
1114
+ }
1115
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1116
+ const localVarHeaderParameter = {};
1117
+ const localVarQueryParameter = {};
1118
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1119
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1120
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1121
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1122
+ localVarRequestOptions.data = serializeDataIfNeeded(sIWEAuthenticateRequest, localVarRequestOptions, configuration);
1123
+ return {
1124
+ url: toPathString(localVarUrlObj),
1125
+ options: localVarRequestOptions,
1126
+ };
1127
+ },
1128
+ /**
1129
+ * Authenticate a player based on email and password.
1130
+ * @summary Email and password login.
1131
+ * @param {LoginRequest} loginRequest
1132
+ * @param {*} [options] Override http request option.
1133
+ * @throws {RequiredError}
1134
+ */
1135
+ loginEmailPassword: async (loginRequest, options = {}) => {
1136
+ // verify required parameter 'loginRequest' is not null or undefined
1137
+ assertParamExists('loginEmailPassword', 'loginRequest', loginRequest);
1138
+ const localVarPath = `/iam/v1/password/login`;
1139
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1140
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1141
+ let baseOptions;
1142
+ if (configuration) {
1143
+ baseOptions = configuration.baseOptions;
1144
+ }
1145
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1146
+ const localVarHeaderParameter = {};
1147
+ const localVarQueryParameter = {};
1148
+ // authentication pk required
1149
+ // http bearer authentication required
1150
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1151
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1152
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1153
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1154
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1155
+ localVarRequestOptions.data = serializeDataIfNeeded(loginRequest, localVarRequestOptions, configuration);
1156
+ return {
1157
+ url: toPathString(localVarUrlObj),
1158
+ options: localVarRequestOptions,
1159
+ };
1160
+ },
1161
+ /**
1162
+ * When using Openfort Auth, the endpoint logs out the player.
1163
+ * @summary Log out a player.
1164
+ * @param {LogoutRequest} logoutRequest
1165
+ * @param {*} [options] Override http request option.
1166
+ * @throws {RequiredError}
1167
+ */
1168
+ logout: async (logoutRequest, options = {}) => {
1169
+ // verify required parameter 'logoutRequest' is not null or undefined
1170
+ assertParamExists('logout', 'logoutRequest', logoutRequest);
1171
+ const localVarPath = `/iam/v1/sessions/logout`;
1172
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1173
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1174
+ let baseOptions;
1175
+ if (configuration) {
1176
+ baseOptions = configuration.baseOptions;
1177
+ }
1178
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1179
+ const localVarHeaderParameter = {};
1180
+ const localVarQueryParameter = {};
1181
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1182
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1183
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1184
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1185
+ localVarRequestOptions.data = serializeDataIfNeeded(logoutRequest, localVarRequestOptions, configuration);
1186
+ return {
1187
+ url: toPathString(localVarUrlObj),
1188
+ options: localVarRequestOptions,
1189
+ };
1190
+ },
1191
+ /**
1192
+ *
1193
+ * @param {*} [options] Override http request option.
1194
+ * @throws {RequiredError}
1195
+ */
1196
+ me: async (options = {}) => {
1197
+ const localVarPath = `/iam/v1/me`;
1198
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1199
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1200
+ let baseOptions;
1201
+ if (configuration) {
1202
+ baseOptions = configuration.baseOptions;
1203
+ }
1204
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
1205
+ const localVarHeaderParameter = {};
1206
+ const localVarQueryParameter = {};
1207
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1208
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1209
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1210
+ return {
1211
+ url: toPathString(localVarUrlObj),
1212
+ options: localVarRequestOptions,
1213
+ };
1214
+ },
1215
+ /**
1216
+ *
1217
+ * @summary Initialize OAuth.
1218
+ * @param {string} key
1219
+ * @param {*} [options] Override http request option.
1220
+ * @throws {RequiredError}
1221
+ */
1222
+ poolOAuth: async (key, options = {}) => {
1223
+ // verify required parameter 'key' is not null or undefined
1224
+ assertParamExists('poolOAuth', 'key', key);
1225
+ const localVarPath = `/iam/v1/oauth/pool`;
1226
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1227
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1228
+ let baseOptions;
1229
+ if (configuration) {
1230
+ baseOptions = configuration.baseOptions;
1231
+ }
1232
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1233
+ const localVarHeaderParameter = {};
1234
+ const localVarQueryParameter = {};
1235
+ // authentication pk required
1236
+ // http bearer authentication required
1237
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1238
+ if (key !== undefined) {
1239
+ localVarQueryParameter['key'] = key;
1240
+ }
1241
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1242
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1243
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1244
+ return {
1245
+ url: toPathString(localVarUrlObj),
1246
+ options: localVarRequestOptions,
1247
+ };
1248
+ },
1249
+ /**
1250
+ * Get or create a new session for the player based on the refresh token.
1251
+ * @summary Refresh or create auth session.
1252
+ * @param {RefreshTokenRequest} refreshTokenRequest
1253
+ * @param {*} [options] Override http request option.
1254
+ * @throws {RequiredError}
1255
+ */
1256
+ refresh: async (refreshTokenRequest, options = {}) => {
1257
+ // verify required parameter 'refreshTokenRequest' is not null or undefined
1258
+ assertParamExists('refresh', 'refreshTokenRequest', refreshTokenRequest);
1259
+ const localVarPath = `/iam/v1/sessions`;
1260
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1261
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1262
+ let baseOptions;
1263
+ if (configuration) {
1264
+ baseOptions = configuration.baseOptions;
1265
+ }
1266
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1267
+ const localVarHeaderParameter = {};
1268
+ const localVarQueryParameter = {};
1269
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1270
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1271
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1272
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1273
+ localVarRequestOptions.data = serializeDataIfNeeded(refreshTokenRequest, localVarRequestOptions, configuration);
1274
+ return {
1275
+ url: toPathString(localVarUrlObj),
1276
+ options: localVarRequestOptions,
1277
+ };
1278
+ },
1279
+ /**
1280
+ * Start the Email Verification process for a player.
1281
+ * @summary Request an Email Verification.
1282
+ * @param {RequestResetPasswordRequest} requestResetPasswordRequest
1283
+ * @param {*} [options] Override http request option.
1284
+ * @throws {RequiredError}
1285
+ */
1286
+ requestEmailVerification: async (requestResetPasswordRequest, options = {}) => {
1287
+ // verify required parameter 'requestResetPasswordRequest' is not null or undefined
1288
+ assertParamExists('requestEmailVerification', 'requestResetPasswordRequest', requestResetPasswordRequest);
1289
+ const localVarPath = `/iam/v1/password/email/request_verification`;
1290
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1291
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1292
+ let baseOptions;
1293
+ if (configuration) {
1294
+ baseOptions = configuration.baseOptions;
1295
+ }
1296
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1297
+ const localVarHeaderParameter = {};
1298
+ const localVarQueryParameter = {};
1299
+ // authentication pk required
1300
+ // http bearer authentication required
1301
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1302
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1303
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1304
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1305
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1306
+ localVarRequestOptions.data = serializeDataIfNeeded(requestResetPasswordRequest, localVarRequestOptions, configuration);
1307
+ return {
1308
+ url: toPathString(localVarUrlObj),
1309
+ options: localVarRequestOptions,
1310
+ };
1311
+ },
1312
+ /**
1313
+ * Start the Reset process for a player\'s password.
1314
+ * @summary Request a Reset password.
1315
+ * @param {RequestResetPasswordRequest} requestResetPasswordRequest
1316
+ * @param {*} [options] Override http request option.
1317
+ * @throws {RequiredError}
1318
+ */
1319
+ requestResetPassword: async (requestResetPasswordRequest, options = {}) => {
1320
+ // verify required parameter 'requestResetPasswordRequest' is not null or undefined
1321
+ assertParamExists('requestResetPassword', 'requestResetPasswordRequest', requestResetPasswordRequest);
1322
+ const localVarPath = `/iam/v1/password/password/request_reset`;
1323
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1324
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1325
+ let baseOptions;
1326
+ if (configuration) {
1327
+ baseOptions = configuration.baseOptions;
1328
+ }
1329
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1330
+ const localVarHeaderParameter = {};
1331
+ const localVarQueryParameter = {};
1332
+ // authentication pk required
1333
+ // http bearer authentication required
1334
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1335
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1336
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1337
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1338
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1339
+ localVarRequestOptions.data = serializeDataIfNeeded(requestResetPasswordRequest, localVarRequestOptions, configuration);
1340
+ return {
1341
+ url: toPathString(localVarUrlObj),
1342
+ options: localVarRequestOptions,
1343
+ };
1344
+ },
1345
+ /**
1346
+ * Reset a player\'s password.
1347
+ * @summary Reset a password.
1348
+ * @param {ResetPasswordRequest} resetPasswordRequest
1349
+ * @param {*} [options] Override http request option.
1350
+ * @throws {RequiredError}
1351
+ */
1352
+ resetPassword: async (resetPasswordRequest, options = {}) => {
1353
+ // verify required parameter 'resetPasswordRequest' is not null or undefined
1354
+ assertParamExists('resetPassword', 'resetPasswordRequest', resetPasswordRequest);
1355
+ const localVarPath = `/iam/v1/password/password/reset`;
1356
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1357
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1358
+ let baseOptions;
1359
+ if (configuration) {
1360
+ baseOptions = configuration.baseOptions;
1361
+ }
1362
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1363
+ const localVarHeaderParameter = {};
1364
+ const localVarQueryParameter = {};
1365
+ // authentication pk required
1366
+ // http bearer authentication required
1367
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1368
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1369
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1370
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1371
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1372
+ localVarRequestOptions.data = serializeDataIfNeeded(resetPasswordRequest, localVarRequestOptions, configuration);
1373
+ return {
1374
+ url: toPathString(localVarUrlObj),
1375
+ options: localVarRequestOptions,
1376
+ };
1377
+ },
1378
+ /**
1379
+ * Create and authenticate a player based on email and password.
1380
+ * @summary Email and password signup.
1381
+ * @param {SignupRequest} signupRequest
1382
+ * @param {*} [options] Override http request option.
1383
+ * @throws {RequiredError}
1384
+ */
1385
+ signupEmailPassword: async (signupRequest, options = {}) => {
1386
+ // verify required parameter 'signupRequest' is not null or undefined
1387
+ assertParamExists('signupEmailPassword', 'signupRequest', signupRequest);
1388
+ const localVarPath = `/iam/v1/password/signup`;
1389
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1390
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1391
+ let baseOptions;
1392
+ if (configuration) {
1393
+ baseOptions = configuration.baseOptions;
1394
+ }
1395
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1396
+ const localVarHeaderParameter = {};
1397
+ const localVarQueryParameter = {};
1398
+ // authentication pk required
1399
+ // http bearer authentication required
1400
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1401
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1402
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1403
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1404
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1405
+ localVarRequestOptions.data = serializeDataIfNeeded(signupRequest, localVarRequestOptions, configuration);
1406
+ return {
1407
+ url: toPathString(localVarUrlObj),
1408
+ options: localVarRequestOptions,
1409
+ };
1410
+ },
1411
+ /**
1412
+ *
1413
+ * @summary Verify oauth token of a third party auth provider.
1414
+ * @param {ThirdPartyOAuthRequest} thirdPartyOAuthRequest
1415
+ * @param {*} [options] Override http request option.
1416
+ * @throws {RequiredError}
1417
+ */
1418
+ thirdParty: async (thirdPartyOAuthRequest, options = {}) => {
1419
+ // verify required parameter 'thirdPartyOAuthRequest' is not null or undefined
1420
+ assertParamExists('thirdParty', 'thirdPartyOAuthRequest', thirdPartyOAuthRequest);
1421
+ const localVarPath = `/iam/v1/oauth/third_party`;
1422
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1423
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1424
+ let baseOptions;
1425
+ if (configuration) {
1426
+ baseOptions = configuration.baseOptions;
1427
+ }
1428
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1429
+ const localVarHeaderParameter = {};
1430
+ const localVarQueryParameter = {};
1431
+ // authentication pk required
1432
+ // http bearer authentication required
1433
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1434
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1435
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1436
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1437
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1438
+ localVarRequestOptions.data = serializeDataIfNeeded(thirdPartyOAuthRequest, localVarRequestOptions, configuration);
1439
+ return {
1440
+ url: toPathString(localVarUrlObj),
1441
+ options: localVarRequestOptions,
1442
+ };
1443
+ },
1444
+ /**
1445
+ *
1446
+ * @summary Unlink OAuth account
1447
+ * @param {UnlinkRequest} unlinkRequest
1448
+ * @param {*} [options] Override http request option.
1449
+ * @throws {RequiredError}
1450
+ */
1451
+ unlinkOAuth: async (unlinkRequest, options = {}) => {
1452
+ // verify required parameter 'unlinkRequest' is not null or undefined
1453
+ assertParamExists('unlinkOAuth', 'unlinkRequest', unlinkRequest);
1454
+ const localVarPath = `/iam/v1/oauth/unlink`;
1455
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1456
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1457
+ let baseOptions;
1458
+ if (configuration) {
1459
+ baseOptions = configuration.baseOptions;
1460
+ }
1461
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1462
+ const localVarHeaderParameter = {};
1463
+ const localVarQueryParameter = {};
1464
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1465
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1466
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1467
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1468
+ localVarRequestOptions.data = serializeDataIfNeeded(unlinkRequest, localVarRequestOptions, configuration);
1469
+ return {
1470
+ url: toPathString(localVarUrlObj),
1471
+ options: localVarRequestOptions,
1472
+ };
1473
+ },
1474
+ /**
1475
+ *
1476
+ * @summary Unlink external wallet.
1477
+ * @param {SIWERequest} sIWERequest
1478
+ * @param {*} [options] Override http request option.
1479
+ * @throws {RequiredError}
1480
+ */
1481
+ unlinkSIWE: async (sIWERequest, options = {}) => {
1482
+ // verify required parameter 'sIWERequest' is not null or undefined
1483
+ assertParamExists('unlinkSIWE', 'sIWERequest', sIWERequest);
1484
+ const localVarPath = `/iam/v1/siwe/unlink`;
1485
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1486
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1487
+ let baseOptions;
1488
+ if (configuration) {
1489
+ baseOptions = configuration.baseOptions;
1490
+ }
1491
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1492
+ const localVarHeaderParameter = {};
1493
+ const localVarQueryParameter = {};
1494
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1495
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1496
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1497
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1498
+ localVarRequestOptions.data = serializeDataIfNeeded(sIWERequest, localVarRequestOptions, configuration);
1499
+ return {
1500
+ url: toPathString(localVarUrlObj),
1501
+ options: localVarRequestOptions,
1502
+ };
1503
+ },
1504
+ /**
1505
+ * Verify a player\'s email address.
1506
+ * @summary Verify an email.
1507
+ * @param {ResetPasswordRequest} resetPasswordRequest
1508
+ * @param {*} [options] Override http request option.
1509
+ * @throws {RequiredError}
1510
+ */
1511
+ verifyEmail: async (resetPasswordRequest, options = {}) => {
1512
+ // verify required parameter 'resetPasswordRequest' is not null or undefined
1513
+ assertParamExists('verifyEmail', 'resetPasswordRequest', resetPasswordRequest);
1514
+ const localVarPath = `/iam/v1/password/email/verify`;
1515
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1516
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1517
+ let baseOptions;
1518
+ if (configuration) {
1519
+ baseOptions = configuration.baseOptions;
1520
+ }
1521
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1522
+ const localVarHeaderParameter = {};
1523
+ const localVarQueryParameter = {};
1524
+ // authentication pk required
1525
+ // http bearer authentication required
1526
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1527
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1528
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1529
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1530
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1531
+ localVarRequestOptions.data = serializeDataIfNeeded(resetPasswordRequest, localVarRequestOptions, configuration);
1532
+ return {
1533
+ url: toPathString(localVarUrlObj),
1534
+ options: localVarRequestOptions,
1535
+ };
1536
+ },
1537
+ /**
1538
+ * The endpoint verifies the token generated by OAuth provider and retrieves a corresponding player. Returns the latest 10 transaction intents for the player.
1539
+ * @summary Retrieve player by token.
1540
+ * @param {AuthProvider} provider OAuth provider
1541
+ * @param {OAuthRequest} oAuthRequest
1542
+ * @param {*} [options] Override http request option.
1543
+ * @deprecated
1544
+ * @throws {RequiredError}
1545
+ */
1546
+ verifyOAuth: async (provider, oAuthRequest, options = {}) => {
1547
+ // verify required parameter 'provider' is not null or undefined
1548
+ assertParamExists('verifyOAuth', 'provider', provider);
1549
+ // verify required parameter 'oAuthRequest' is not null or undefined
1550
+ assertParamExists('verifyOAuth', 'oAuthRequest', oAuthRequest);
1551
+ const localVarPath = `/iam/v1/oauth/{provider}/verify`
1552
+ .replace(`{${"provider"}}`, encodeURIComponent(String(provider)));
1553
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1554
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1555
+ let baseOptions;
1556
+ if (configuration) {
1557
+ baseOptions = configuration.baseOptions;
1558
+ }
1559
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1560
+ const localVarHeaderParameter = {};
1561
+ const localVarQueryParameter = {};
1562
+ // authentication sk required
1563
+ // http bearer authentication required
1564
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1565
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1566
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1567
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1568
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1569
+ localVarRequestOptions.data = serializeDataIfNeeded(oAuthRequest, localVarRequestOptions, configuration);
1570
+ return {
1571
+ url: toPathString(localVarUrlObj),
1572
+ options: localVarRequestOptions,
1573
+ };
1574
+ },
1575
+ /**
1576
+ * The endpoint verifies the token generated by OAuth provider and retrieves a corresponding player. Returns the latest 10 transaction intents for the player.
1577
+ * @summary Retrieve player by oauth token.
1578
+ * @param {AuthenticateOAuthRequest} authenticateOAuthRequest
1579
+ * @param {*} [options] Override http request option.
1580
+ * @throws {RequiredError}
1581
+ */
1582
+ verifyOAuthToken: async (authenticateOAuthRequest, options = {}) => {
1583
+ // verify required parameter 'authenticateOAuthRequest' is not null or undefined
1584
+ assertParamExists('verifyOAuthToken', 'authenticateOAuthRequest', authenticateOAuthRequest);
1585
+ const localVarPath = `/iam/v1/oauth/verify`;
1586
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1587
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1588
+ let baseOptions;
1589
+ if (configuration) {
1590
+ baseOptions = configuration.baseOptions;
1591
+ }
1592
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1593
+ const localVarHeaderParameter = {};
1594
+ const localVarQueryParameter = {};
1595
+ // authentication sk required
1596
+ // http bearer authentication required
1597
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1598
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1599
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1600
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1601
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1602
+ localVarRequestOptions.data = serializeDataIfNeeded(authenticateOAuthRequest, localVarRequestOptions, configuration);
1603
+ return {
1604
+ url: toPathString(localVarUrlObj),
1605
+ options: localVarRequestOptions,
1606
+ };
1607
+ },
1608
+ };
1609
+ };
1610
+ /**
1611
+ * AuthenticationApi - functional programming interface
1612
+ * @export
1613
+ */
1614
+ const AuthenticationApiFp = function (configuration) {
1615
+ const localVarAxiosParamCreator = AuthenticationApiAxiosParamCreator(configuration);
1616
+ return {
1617
+ /**
1618
+ * Deprecated
1619
+ * @summary Authenticate player with oauth token.
1620
+ * @param {AuthenticateOAuthRequest} authenticateOAuthRequest
1621
+ * @param {*} [options] Override http request option.
1622
+ * @throws {RequiredError}
1623
+ */
1624
+ async authenticateOAuth(authenticateOAuthRequest, options) {
1625
+ const localVarAxiosArgs = await localVarAxiosParamCreator.authenticateOAuth(authenticateOAuthRequest, options);
1626
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1627
+ },
1628
+ /**
1629
+ *
1630
+ * @summary Authenticate player with SIWE
1631
+ * @param {SIWEAuthenticateRequest} sIWEAuthenticateRequest
1632
+ * @param {*} [options] Override http request option.
1633
+ * @throws {RequiredError}
1634
+ */
1635
+ async authenticateSIWE(sIWEAuthenticateRequest, options) {
1636
+ const localVarAxiosArgs = await localVarAxiosParamCreator.authenticateSIWE(sIWEAuthenticateRequest, options);
1637
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1638
+ },
1639
+ /**
1640
+ * The endpoint verifies the token generated by OAuth provider, creates or retrieves a player based on his email, and returns the jwt token for the player together with the player id.
1641
+ * @summary Authorize player with token.
1642
+ * @param {AuthProvider} provider OAuth provider
1643
+ * @param {OAuthRequest} oAuthRequest
1644
+ * @param {*} [options] Override http request option.
1645
+ * @deprecated
1646
+ * @throws {RequiredError}
1647
+ */
1648
+ async authorizeWithOAuthToken(provider, oAuthRequest, options) {
1649
+ const localVarAxiosArgs = await localVarAxiosParamCreator.authorizeWithOAuthToken(provider, oAuthRequest, options);
1650
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1651
+ },
1652
+ /**
1653
+ * Get the jwks.json file. You can use the jwks.json file to verify the signature of a JWT token issued by Openfort Auth.
1654
+ * @summary Get the jwks.json file.
1655
+ * @param {string} publishableKey Specifies the project publishable key (starts with pk_).
1656
+ * @param {*} [options] Override http request option.
1657
+ * @throws {RequiredError}
1658
+ */
1659
+ async getJwks(publishableKey, options) {
1660
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getJwks(publishableKey, options);
1661
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1662
+ },
1663
+ /**
1664
+ *
1665
+ * @summary Initialize Link OAuth.
1666
+ * @param {OAuthInitRequest} oAuthInitRequest
1667
+ * @param {*} [options] Override http request option.
1668
+ * @throws {RequiredError}
1669
+ */
1670
+ async initLinkOAuth(oAuthInitRequest, options) {
1671
+ const localVarAxiosArgs = await localVarAxiosParamCreator.initLinkOAuth(oAuthInitRequest, options);
1672
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1673
+ },
1674
+ /**
1675
+ *
1676
+ * @summary Initialize OAuth.
1677
+ * @param {OAuthInitRequest} oAuthInitRequest
1678
+ * @param {*} [options] Override http request option.
1679
+ * @throws {RequiredError}
1680
+ */
1681
+ async initOAuth(oAuthInitRequest, options) {
1682
+ const localVarAxiosArgs = await localVarAxiosParamCreator.initOAuth(oAuthInitRequest, options);
1683
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1684
+ },
1685
+ /**
1686
+ * Create a challenge to link external wallet to the player.
1687
+ * @summary Initialize SIWE.
1688
+ * @param {SIWERequest} sIWERequest
1689
+ * @param {*} [options] Override http request option.
1690
+ * @throws {RequiredError}
1691
+ */
1692
+ async initSIWE(sIWERequest, options) {
1693
+ const localVarAxiosArgs = await localVarAxiosParamCreator.initSIWE(sIWERequest, options);
1694
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1695
+ },
1696
+ /**
1697
+ *
1698
+ * @summary Link external wallet.
1699
+ * @param {SIWEAuthenticateRequest} sIWEAuthenticateRequest
1700
+ * @param {*} [options] Override http request option.
1701
+ * @throws {RequiredError}
1702
+ */
1703
+ async linkSIWE(sIWEAuthenticateRequest, options) {
1704
+ const localVarAxiosArgs = await localVarAxiosParamCreator.linkSIWE(sIWEAuthenticateRequest, options);
1705
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1706
+ },
1707
+ /**
1708
+ * Authenticate a player based on email and password.
1709
+ * @summary Email and password login.
1710
+ * @param {LoginRequest} loginRequest
1711
+ * @param {*} [options] Override http request option.
1712
+ * @throws {RequiredError}
1713
+ */
1714
+ async loginEmailPassword(loginRequest, options) {
1715
+ const localVarAxiosArgs = await localVarAxiosParamCreator.loginEmailPassword(loginRequest, options);
1716
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1717
+ },
1718
+ /**
1719
+ * When using Openfort Auth, the endpoint logs out the player.
1720
+ * @summary Log out a player.
1721
+ * @param {LogoutRequest} logoutRequest
1722
+ * @param {*} [options] Override http request option.
1723
+ * @throws {RequiredError}
1724
+ */
1725
+ async logout(logoutRequest, options) {
1726
+ const localVarAxiosArgs = await localVarAxiosParamCreator.logout(logoutRequest, options);
1727
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1728
+ },
1729
+ /**
1730
+ *
1731
+ * @param {*} [options] Override http request option.
1732
+ * @throws {RequiredError}
1733
+ */
1734
+ async me(options) {
1735
+ const localVarAxiosArgs = await localVarAxiosParamCreator.me(options);
1736
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1737
+ },
1738
+ /**
1739
+ *
1740
+ * @summary Initialize OAuth.
1741
+ * @param {string} key
1742
+ * @param {*} [options] Override http request option.
1743
+ * @throws {RequiredError}
1744
+ */
1745
+ async poolOAuth(key, options) {
1746
+ const localVarAxiosArgs = await localVarAxiosParamCreator.poolOAuth(key, options);
1747
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1748
+ },
1749
+ /**
1750
+ * Get or create a new session for the player based on the refresh token.
1751
+ * @summary Refresh or create auth session.
1752
+ * @param {RefreshTokenRequest} refreshTokenRequest
1753
+ * @param {*} [options] Override http request option.
1754
+ * @throws {RequiredError}
1755
+ */
1756
+ async refresh(refreshTokenRequest, options) {
1757
+ const localVarAxiosArgs = await localVarAxiosParamCreator.refresh(refreshTokenRequest, options);
1758
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1759
+ },
1760
+ /**
1761
+ * Start the Email Verification process for a player.
1762
+ * @summary Request an Email Verification.
1763
+ * @param {RequestResetPasswordRequest} requestResetPasswordRequest
1764
+ * @param {*} [options] Override http request option.
1765
+ * @throws {RequiredError}
1766
+ */
1767
+ async requestEmailVerification(requestResetPasswordRequest, options) {
1768
+ const localVarAxiosArgs = await localVarAxiosParamCreator.requestEmailVerification(requestResetPasswordRequest, options);
1769
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1770
+ },
1771
+ /**
1772
+ * Start the Reset process for a player\'s password.
1773
+ * @summary Request a Reset password.
1774
+ * @param {RequestResetPasswordRequest} requestResetPasswordRequest
1775
+ * @param {*} [options] Override http request option.
1776
+ * @throws {RequiredError}
1777
+ */
1778
+ async requestResetPassword(requestResetPasswordRequest, options) {
1779
+ const localVarAxiosArgs = await localVarAxiosParamCreator.requestResetPassword(requestResetPasswordRequest, options);
1780
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1781
+ },
1782
+ /**
1783
+ * Reset a player\'s password.
1784
+ * @summary Reset a password.
1785
+ * @param {ResetPasswordRequest} resetPasswordRequest
1786
+ * @param {*} [options] Override http request option.
1787
+ * @throws {RequiredError}
1788
+ */
1789
+ async resetPassword(resetPasswordRequest, options) {
1790
+ const localVarAxiosArgs = await localVarAxiosParamCreator.resetPassword(resetPasswordRequest, options);
1791
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1792
+ },
1793
+ /**
1794
+ * Create and authenticate a player based on email and password.
1795
+ * @summary Email and password signup.
1796
+ * @param {SignupRequest} signupRequest
1797
+ * @param {*} [options] Override http request option.
1798
+ * @throws {RequiredError}
1799
+ */
1800
+ async signupEmailPassword(signupRequest, options) {
1801
+ const localVarAxiosArgs = await localVarAxiosParamCreator.signupEmailPassword(signupRequest, options);
1802
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1803
+ },
1804
+ /**
1805
+ *
1806
+ * @summary Verify oauth token of a third party auth provider.
1807
+ * @param {ThirdPartyOAuthRequest} thirdPartyOAuthRequest
1808
+ * @param {*} [options] Override http request option.
1809
+ * @throws {RequiredError}
1810
+ */
1811
+ async thirdParty(thirdPartyOAuthRequest, options) {
1812
+ const localVarAxiosArgs = await localVarAxiosParamCreator.thirdParty(thirdPartyOAuthRequest, options);
1813
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1814
+ },
1815
+ /**
1816
+ *
1817
+ * @summary Unlink OAuth account
1818
+ * @param {UnlinkRequest} unlinkRequest
1819
+ * @param {*} [options] Override http request option.
1820
+ * @throws {RequiredError}
1821
+ */
1822
+ async unlinkOAuth(unlinkRequest, options) {
1823
+ const localVarAxiosArgs = await localVarAxiosParamCreator.unlinkOAuth(unlinkRequest, options);
1824
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1825
+ },
1826
+ /**
1827
+ *
1828
+ * @summary Unlink external wallet.
1829
+ * @param {SIWERequest} sIWERequest
1830
+ * @param {*} [options] Override http request option.
1831
+ * @throws {RequiredError}
1832
+ */
1833
+ async unlinkSIWE(sIWERequest, options) {
1834
+ const localVarAxiosArgs = await localVarAxiosParamCreator.unlinkSIWE(sIWERequest, options);
1835
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1836
+ },
1837
+ /**
1838
+ * Verify a player\'s email address.
1839
+ * @summary Verify an email.
1840
+ * @param {ResetPasswordRequest} resetPasswordRequest
1841
+ * @param {*} [options] Override http request option.
1842
+ * @throws {RequiredError}
1843
+ */
1844
+ async verifyEmail(resetPasswordRequest, options) {
1845
+ const localVarAxiosArgs = await localVarAxiosParamCreator.verifyEmail(resetPasswordRequest, options);
1846
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1847
+ },
1848
+ /**
1849
+ * The endpoint verifies the token generated by OAuth provider and retrieves a corresponding player. Returns the latest 10 transaction intents for the player.
1850
+ * @summary Retrieve player by token.
1851
+ * @param {AuthProvider} provider OAuth provider
1852
+ * @param {OAuthRequest} oAuthRequest
1853
+ * @param {*} [options] Override http request option.
1854
+ * @deprecated
1855
+ * @throws {RequiredError}
1856
+ */
1857
+ async verifyOAuth(provider, oAuthRequest, options) {
1858
+ const localVarAxiosArgs = await localVarAxiosParamCreator.verifyOAuth(provider, oAuthRequest, options);
1859
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1860
+ },
1861
+ /**
1862
+ * The endpoint verifies the token generated by OAuth provider and retrieves a corresponding player. Returns the latest 10 transaction intents for the player.
1863
+ * @summary Retrieve player by oauth token.
1864
+ * @param {AuthenticateOAuthRequest} authenticateOAuthRequest
1865
+ * @param {*} [options] Override http request option.
1866
+ * @throws {RequiredError}
1867
+ */
1868
+ async verifyOAuthToken(authenticateOAuthRequest, options) {
1869
+ const localVarAxiosArgs = await localVarAxiosParamCreator.verifyOAuthToken(authenticateOAuthRequest, options);
1870
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1871
+ },
1872
+ };
1873
+ };
1874
+ /**
1875
+ * AuthenticationApi - object-oriented interface
1876
+ * @export
1877
+ * @class AuthenticationApi
1878
+ * @extends {BaseAPI}
1879
+ */
1880
+ class AuthenticationApi extends BaseAPI {
1881
+ /**
1882
+ * Deprecated
1883
+ * @summary Authenticate player with oauth token.
1884
+ * @param {AuthenticationApiAuthenticateOAuthRequest} requestParameters Request parameters.
1885
+ * @param {*} [options] Override http request option.
1886
+ * @throws {RequiredError}
1887
+ * @memberof AuthenticationApi
1888
+ */
1889
+ authenticateOAuth(requestParameters, options) {
1890
+ return AuthenticationApiFp(this.configuration).authenticateOAuth(requestParameters.authenticateOAuthRequest, options).then((request) => request(this.axios, this.basePath));
1891
+ }
1892
+ /**
1893
+ *
1894
+ * @summary Authenticate player with SIWE
1895
+ * @param {AuthenticationApiAuthenticateSIWERequest} requestParameters Request parameters.
1896
+ * @param {*} [options] Override http request option.
1897
+ * @throws {RequiredError}
1898
+ * @memberof AuthenticationApi
1899
+ */
1900
+ authenticateSIWE(requestParameters, options) {
1901
+ return AuthenticationApiFp(this.configuration).authenticateSIWE(requestParameters.sIWEAuthenticateRequest, options).then((request) => request(this.axios, this.basePath));
1902
+ }
1903
+ /**
1904
+ * The endpoint verifies the token generated by OAuth provider, creates or retrieves a player based on his email, and returns the jwt token for the player together with the player id.
1905
+ * @summary Authorize player with token.
1906
+ * @param {AuthenticationApiAuthorizeWithOAuthTokenRequest} requestParameters Request parameters.
1907
+ * @param {*} [options] Override http request option.
1908
+ * @deprecated
1909
+ * @throws {RequiredError}
1910
+ * @memberof AuthenticationApi
1911
+ */
1912
+ authorizeWithOAuthToken(requestParameters, options) {
1913
+ return AuthenticationApiFp(this.configuration).authorizeWithOAuthToken(requestParameters.provider, requestParameters.oAuthRequest, options).then((request) => request(this.axios, this.basePath));
1914
+ }
1915
+ /**
1916
+ * Get the jwks.json file. You can use the jwks.json file to verify the signature of a JWT token issued by Openfort Auth.
1917
+ * @summary Get the jwks.json file.
1918
+ * @param {AuthenticationApiGetJwksRequest} requestParameters Request parameters.
1919
+ * @param {*} [options] Override http request option.
1920
+ * @throws {RequiredError}
1921
+ * @memberof AuthenticationApi
1922
+ */
1923
+ getJwks(requestParameters, options) {
1924
+ return AuthenticationApiFp(this.configuration).getJwks(requestParameters.publishableKey, options).then((request) => request(this.axios, this.basePath));
1925
+ }
1926
+ /**
1927
+ *
1928
+ * @summary Initialize Link OAuth.
1929
+ * @param {AuthenticationApiInitLinkOAuthRequest} requestParameters Request parameters.
1930
+ * @param {*} [options] Override http request option.
1931
+ * @throws {RequiredError}
1932
+ * @memberof AuthenticationApi
1933
+ */
1934
+ initLinkOAuth(requestParameters, options) {
1935
+ return AuthenticationApiFp(this.configuration).initLinkOAuth(requestParameters.oAuthInitRequest, options).then((request) => request(this.axios, this.basePath));
1936
+ }
1937
+ /**
1938
+ *
1939
+ * @summary Initialize OAuth.
1940
+ * @param {AuthenticationApiInitOAuthRequest} requestParameters Request parameters.
1941
+ * @param {*} [options] Override http request option.
1942
+ * @throws {RequiredError}
1943
+ * @memberof AuthenticationApi
1944
+ */
1945
+ initOAuth(requestParameters, options) {
1946
+ return AuthenticationApiFp(this.configuration).initOAuth(requestParameters.oAuthInitRequest, options).then((request) => request(this.axios, this.basePath));
1947
+ }
1948
+ /**
1949
+ * Create a challenge to link external wallet to the player.
1950
+ * @summary Initialize SIWE.
1951
+ * @param {AuthenticationApiInitSIWERequest} requestParameters Request parameters.
1952
+ * @param {*} [options] Override http request option.
1953
+ * @throws {RequiredError}
1954
+ * @memberof AuthenticationApi
1955
+ */
1956
+ initSIWE(requestParameters, options) {
1957
+ return AuthenticationApiFp(this.configuration).initSIWE(requestParameters.sIWERequest, options).then((request) => request(this.axios, this.basePath));
1958
+ }
1959
+ /**
1960
+ *
1961
+ * @summary Link external wallet.
1962
+ * @param {AuthenticationApiLinkSIWERequest} requestParameters Request parameters.
1963
+ * @param {*} [options] Override http request option.
1964
+ * @throws {RequiredError}
1965
+ * @memberof AuthenticationApi
1966
+ */
1967
+ linkSIWE(requestParameters, options) {
1968
+ return AuthenticationApiFp(this.configuration).linkSIWE(requestParameters.sIWEAuthenticateRequest, options).then((request) => request(this.axios, this.basePath));
1969
+ }
1970
+ /**
1971
+ * Authenticate a player based on email and password.
1972
+ * @summary Email and password login.
1973
+ * @param {AuthenticationApiLoginEmailPasswordRequest} requestParameters Request parameters.
1974
+ * @param {*} [options] Override http request option.
1975
+ * @throws {RequiredError}
1976
+ * @memberof AuthenticationApi
1977
+ */
1978
+ loginEmailPassword(requestParameters, options) {
1979
+ return AuthenticationApiFp(this.configuration).loginEmailPassword(requestParameters.loginRequest, options).then((request) => request(this.axios, this.basePath));
1980
+ }
1981
+ /**
1982
+ * When using Openfort Auth, the endpoint logs out the player.
1983
+ * @summary Log out a player.
1984
+ * @param {AuthenticationApiLogoutRequest} requestParameters Request parameters.
1985
+ * @param {*} [options] Override http request option.
1986
+ * @throws {RequiredError}
1987
+ * @memberof AuthenticationApi
1988
+ */
1989
+ logout(requestParameters, options) {
1990
+ return AuthenticationApiFp(this.configuration).logout(requestParameters.logoutRequest, options).then((request) => request(this.axios, this.basePath));
1991
+ }
1992
+ /**
1993
+ *
1994
+ * @param {*} [options] Override http request option.
1995
+ * @throws {RequiredError}
1996
+ * @memberof AuthenticationApi
1997
+ */
1998
+ me(options) {
1999
+ return AuthenticationApiFp(this.configuration).me(options).then((request) => request(this.axios, this.basePath));
2000
+ }
2001
+ /**
2002
+ *
2003
+ * @summary Initialize OAuth.
2004
+ * @param {AuthenticationApiPoolOAuthRequest} requestParameters Request parameters.
2005
+ * @param {*} [options] Override http request option.
2006
+ * @throws {RequiredError}
2007
+ * @memberof AuthenticationApi
2008
+ */
2009
+ poolOAuth(requestParameters, options) {
2010
+ return AuthenticationApiFp(this.configuration).poolOAuth(requestParameters.key, options).then((request) => request(this.axios, this.basePath));
2011
+ }
2012
+ /**
2013
+ * Get or create a new session for the player based on the refresh token.
2014
+ * @summary Refresh or create auth session.
2015
+ * @param {AuthenticationApiRefreshRequest} requestParameters Request parameters.
2016
+ * @param {*} [options] Override http request option.
2017
+ * @throws {RequiredError}
2018
+ * @memberof AuthenticationApi
2019
+ */
2020
+ refresh(requestParameters, options) {
2021
+ return AuthenticationApiFp(this.configuration).refresh(requestParameters.refreshTokenRequest, options).then((request) => request(this.axios, this.basePath));
2022
+ }
2023
+ /**
2024
+ * Start the Email Verification process for a player.
2025
+ * @summary Request an Email Verification.
2026
+ * @param {AuthenticationApiRequestEmailVerificationRequest} requestParameters Request parameters.
2027
+ * @param {*} [options] Override http request option.
2028
+ * @throws {RequiredError}
2029
+ * @memberof AuthenticationApi
2030
+ */
2031
+ requestEmailVerification(requestParameters, options) {
2032
+ return AuthenticationApiFp(this.configuration).requestEmailVerification(requestParameters.requestResetPasswordRequest, options).then((request) => request(this.axios, this.basePath));
2033
+ }
2034
+ /**
2035
+ * Start the Reset process for a player\'s password.
2036
+ * @summary Request a Reset password.
2037
+ * @param {AuthenticationApiRequestResetPasswordRequest} requestParameters Request parameters.
2038
+ * @param {*} [options] Override http request option.
2039
+ * @throws {RequiredError}
2040
+ * @memberof AuthenticationApi
2041
+ */
2042
+ requestResetPassword(requestParameters, options) {
2043
+ return AuthenticationApiFp(this.configuration).requestResetPassword(requestParameters.requestResetPasswordRequest, options).then((request) => request(this.axios, this.basePath));
2044
+ }
2045
+ /**
2046
+ * Reset a player\'s password.
2047
+ * @summary Reset a password.
2048
+ * @param {AuthenticationApiResetPasswordRequest} requestParameters Request parameters.
2049
+ * @param {*} [options] Override http request option.
2050
+ * @throws {RequiredError}
2051
+ * @memberof AuthenticationApi
2052
+ */
2053
+ resetPassword(requestParameters, options) {
2054
+ return AuthenticationApiFp(this.configuration).resetPassword(requestParameters.resetPasswordRequest, options).then((request) => request(this.axios, this.basePath));
2055
+ }
2056
+ /**
2057
+ * Create and authenticate a player based on email and password.
2058
+ * @summary Email and password signup.
2059
+ * @param {AuthenticationApiSignupEmailPasswordRequest} requestParameters Request parameters.
2060
+ * @param {*} [options] Override http request option.
2061
+ * @throws {RequiredError}
2062
+ * @memberof AuthenticationApi
2063
+ */
2064
+ signupEmailPassword(requestParameters, options) {
2065
+ return AuthenticationApiFp(this.configuration).signupEmailPassword(requestParameters.signupRequest, options).then((request) => request(this.axios, this.basePath));
2066
+ }
2067
+ /**
2068
+ *
2069
+ * @summary Verify oauth token of a third party auth provider.
2070
+ * @param {AuthenticationApiThirdPartyRequest} requestParameters Request parameters.
2071
+ * @param {*} [options] Override http request option.
2072
+ * @throws {RequiredError}
2073
+ * @memberof AuthenticationApi
2074
+ */
2075
+ thirdParty(requestParameters, options) {
2076
+ return AuthenticationApiFp(this.configuration).thirdParty(requestParameters.thirdPartyOAuthRequest, options).then((request) => request(this.axios, this.basePath));
2077
+ }
2078
+ /**
2079
+ *
2080
+ * @summary Unlink OAuth account
2081
+ * @param {AuthenticationApiUnlinkOAuthRequest} requestParameters Request parameters.
2082
+ * @param {*} [options] Override http request option.
2083
+ * @throws {RequiredError}
2084
+ * @memberof AuthenticationApi
2085
+ */
2086
+ unlinkOAuth(requestParameters, options) {
2087
+ return AuthenticationApiFp(this.configuration).unlinkOAuth(requestParameters.unlinkRequest, options).then((request) => request(this.axios, this.basePath));
2088
+ }
2089
+ /**
2090
+ *
2091
+ * @summary Unlink external wallet.
2092
+ * @param {AuthenticationApiUnlinkSIWERequest} requestParameters Request parameters.
2093
+ * @param {*} [options] Override http request option.
2094
+ * @throws {RequiredError}
2095
+ * @memberof AuthenticationApi
2096
+ */
2097
+ unlinkSIWE(requestParameters, options) {
2098
+ return AuthenticationApiFp(this.configuration).unlinkSIWE(requestParameters.sIWERequest, options).then((request) => request(this.axios, this.basePath));
2099
+ }
2100
+ /**
2101
+ * Verify a player\'s email address.
2102
+ * @summary Verify an email.
2103
+ * @param {AuthenticationApiVerifyEmailRequest} requestParameters Request parameters.
2104
+ * @param {*} [options] Override http request option.
2105
+ * @throws {RequiredError}
2106
+ * @memberof AuthenticationApi
2107
+ */
2108
+ verifyEmail(requestParameters, options) {
2109
+ return AuthenticationApiFp(this.configuration).verifyEmail(requestParameters.resetPasswordRequest, options).then((request) => request(this.axios, this.basePath));
2110
+ }
2111
+ /**
2112
+ * The endpoint verifies the token generated by OAuth provider and retrieves a corresponding player. Returns the latest 10 transaction intents for the player.
2113
+ * @summary Retrieve player by token.
2114
+ * @param {AuthenticationApiVerifyOAuthRequest} requestParameters Request parameters.
2115
+ * @param {*} [options] Override http request option.
2116
+ * @deprecated
2117
+ * @throws {RequiredError}
2118
+ * @memberof AuthenticationApi
2119
+ */
2120
+ verifyOAuth(requestParameters, options) {
2121
+ return AuthenticationApiFp(this.configuration).verifyOAuth(requestParameters.provider, requestParameters.oAuthRequest, options).then((request) => request(this.axios, this.basePath));
2122
+ }
2123
+ /**
2124
+ * The endpoint verifies the token generated by OAuth provider and retrieves a corresponding player. Returns the latest 10 transaction intents for the player.
2125
+ * @summary Retrieve player by oauth token.
2126
+ * @param {AuthenticationApiVerifyOAuthTokenRequest} requestParameters Request parameters.
2127
+ * @param {*} [options] Override http request option.
2128
+ * @throws {RequiredError}
2129
+ * @memberof AuthenticationApi
2130
+ */
2131
+ verifyOAuthToken(requestParameters, options) {
2132
+ return AuthenticationApiFp(this.configuration).verifyOAuthToken(requestParameters.authenticateOAuthRequest, options).then((request) => request(this.axios, this.basePath));
2133
+ }
2134
+ }
2135
+
2136
+ /* tslint:disable */
2137
+ /* eslint-disable */
2138
+ /**
2139
+ * Openfort API
2140
+ * Complete Openfort API references and guides can be found at: https://openfort.xyz/docs
2141
+ *
2142
+ * The version of the OpenAPI document: 1.0.0
2143
+ * Contact: founders@openfort.xyz
2144
+ *
2145
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2146
+ * https://openapi-generator.tech
2147
+ * Do not edit the class manually.
2148
+ */
2149
+ /**
2150
+ * SessionsApi - axios parameter creator
2151
+ * @export
2152
+ */
2153
+ const SessionsApiAxiosParamCreator = function (configuration) {
2154
+ return {
2155
+ /**
2156
+ * Creates a Session.
2157
+ * @summary Create a session key.
2158
+ * @param {CreateSessionRequest} createSessionRequest
2159
+ * @param {*} [options] Override http request option.
2160
+ * @throws {RequiredError}
2161
+ */
2162
+ createSession: async (createSessionRequest, options = {}) => {
2163
+ // verify required parameter 'createSessionRequest' is not null or undefined
2164
+ assertParamExists('createSession', 'createSessionRequest', createSessionRequest);
2165
+ const localVarPath = `/v1/sessions`;
2166
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
2167
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
2168
+ let baseOptions;
2169
+ if (configuration) {
2170
+ baseOptions = configuration.baseOptions;
2171
+ }
2172
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
2173
+ const localVarHeaderParameter = {};
2174
+ const localVarQueryParameter = {};
2175
+ // authentication sk required
2176
+ // http bearer authentication required
2177
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
2178
+ localVarHeaderParameter['Content-Type'] = 'application/json';
2179
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
2180
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2181
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
2182
+ localVarRequestOptions.data = serializeDataIfNeeded(createSessionRequest, localVarRequestOptions, configuration);
2183
+ return {
2184
+ url: toPathString(localVarUrlObj),
2185
+ options: localVarRequestOptions,
2186
+ };
2187
+ },
2188
+ /**
2189
+ * Returns a list of Sessions. Returns the latest 10 transaction intents for each session.
2190
+ * @summary List session keys of a player.
2191
+ * @param {string} player The player ID (starts with pla_)
2192
+ * @param {number} [limit] Specifies the maximum number of records to return.
2193
+ * @param {number} [skip] Specifies the offset for the first records to return.
2194
+ * @param {SortOrder} [order] Specifies the order in which to sort the results.
2195
+ * @param {Array<SessionResponseExpandable>} [expand] Specifies the fields to expand in the response.
2196
+ * @param {*} [options] Override http request option.
2197
+ * @throws {RequiredError}
2198
+ */
2199
+ getPlayerSessions: async (player, limit, skip, order, expand, options = {}) => {
2200
+ // verify required parameter 'player' is not null or undefined
2201
+ assertParamExists('getPlayerSessions', 'player', player);
2202
+ const localVarPath = `/v1/sessions`;
2203
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
2204
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
2205
+ let baseOptions;
2206
+ if (configuration) {
2207
+ baseOptions = configuration.baseOptions;
2208
+ }
2209
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
2210
+ const localVarHeaderParameter = {};
2211
+ const localVarQueryParameter = {};
2212
+ // authentication sk required
2213
+ // http bearer authentication required
2214
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
2215
+ if (limit !== undefined) {
2216
+ localVarQueryParameter['limit'] = limit;
2217
+ }
2218
+ if (skip !== undefined) {
2219
+ localVarQueryParameter['skip'] = skip;
2220
+ }
2221
+ if (order !== undefined) {
2222
+ localVarQueryParameter['order'] = order;
2223
+ }
2224
+ if (player !== undefined) {
2225
+ localVarQueryParameter['player'] = player;
2226
+ }
2227
+ if (expand) {
2228
+ localVarQueryParameter['expand'] = expand;
2229
+ }
2230
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
2231
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2232
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
2233
+ return {
2234
+ url: toPathString(localVarUrlObj),
2235
+ options: localVarRequestOptions,
2236
+ };
2237
+ },
2238
+ /**
2239
+ * Retrieves the details of a Session that has previously been created. Returns the latest 10 transaction intents that used this session.
2240
+ * @summary Returns a player session by session id
2241
+ * @param {string} id Specifies the unique session ID (starts with ses_).
2242
+ * @param {Array<SessionResponseExpandable>} [expand] Specifies the fields to expand.
2243
+ * @param {*} [options] Override http request option.
2244
+ * @throws {RequiredError}
2245
+ */
2246
+ getSession: async (id, expand, options = {}) => {
2247
+ // verify required parameter 'id' is not null or undefined
2248
+ assertParamExists('getSession', 'id', id);
2249
+ const localVarPath = `/v1/sessions/{id}`
2250
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
2251
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
2252
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
2253
+ let baseOptions;
2254
+ if (configuration) {
2255
+ baseOptions = configuration.baseOptions;
2256
+ }
2257
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
2258
+ const localVarHeaderParameter = {};
2259
+ const localVarQueryParameter = {};
2260
+ // authentication sk required
2261
+ // http bearer authentication required
2262
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
2263
+ if (expand) {
2264
+ localVarQueryParameter['expand'] = expand;
2265
+ }
2266
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
2267
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2268
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
2269
+ return {
2270
+ url: toPathString(localVarUrlObj),
2271
+ options: localVarRequestOptions,
2272
+ };
2273
+ },
2274
+ /**
2275
+ *
2276
+ * @summary Revoke the session session key.
2277
+ * @param {RevokeSessionRequest} revokeSessionRequest
2278
+ * @param {*} [options] Override http request option.
2279
+ * @throws {RequiredError}
2280
+ */
2281
+ revokeSession: async (revokeSessionRequest, options = {}) => {
2282
+ // verify required parameter 'revokeSessionRequest' is not null or undefined
2283
+ assertParamExists('revokeSession', 'revokeSessionRequest', revokeSessionRequest);
2284
+ const localVarPath = `/v1/sessions/revoke`;
2285
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
2286
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
2287
+ let baseOptions;
2288
+ if (configuration) {
2289
+ baseOptions = configuration.baseOptions;
2290
+ }
2291
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
2292
+ const localVarHeaderParameter = {};
2293
+ const localVarQueryParameter = {};
2294
+ // authentication sk required
2295
+ // http bearer authentication required
2296
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
2297
+ localVarHeaderParameter['Content-Type'] = 'application/json';
2298
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
2299
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2300
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
2301
+ localVarRequestOptions.data = serializeDataIfNeeded(revokeSessionRequest, localVarRequestOptions, configuration);
2302
+ return {
2303
+ url: toPathString(localVarUrlObj),
2304
+ options: localVarRequestOptions,
2305
+ };
2306
+ },
2307
+ /**
2308
+ *
2309
+ * @summary Send signed userOperationHash to create session.
2310
+ * @param {string} id Specifies the unique session ID (starts with ses_).
2311
+ * @param {SignatureRequest} signatureRequest
2312
+ * @param {*} [options] Override http request option.
2313
+ * @throws {RequiredError}
2314
+ */
2315
+ signatureSession: async (id, signatureRequest, options = {}) => {
2316
+ // verify required parameter 'id' is not null or undefined
2317
+ assertParamExists('signatureSession', 'id', id);
2318
+ // verify required parameter 'signatureRequest' is not null or undefined
2319
+ assertParamExists('signatureSession', 'signatureRequest', signatureRequest);
2320
+ const localVarPath = `/v1/sessions/{id}/signature`
2321
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
2322
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
2323
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
2324
+ let baseOptions;
2325
+ if (configuration) {
2326
+ baseOptions = configuration.baseOptions;
2327
+ }
2328
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
2329
+ const localVarHeaderParameter = {};
2330
+ const localVarQueryParameter = {};
2331
+ // authentication sk required
2332
+ // http bearer authentication required
2333
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
2334
+ // authentication pk required
2335
+ // http bearer authentication required
2336
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
2337
+ localVarHeaderParameter['Content-Type'] = 'application/json';
2338
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
2339
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2340
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
2341
+ localVarRequestOptions.data = serializeDataIfNeeded(signatureRequest, localVarRequestOptions, configuration);
2342
+ return {
2343
+ url: toPathString(localVarUrlObj),
2344
+ options: localVarRequestOptions,
2345
+ };
2346
+ },
2347
+ };
2348
+ };
2349
+ /**
2350
+ * SessionsApi - functional programming interface
2351
+ * @export
2352
+ */
2353
+ const SessionsApiFp = function (configuration) {
2354
+ const localVarAxiosParamCreator = SessionsApiAxiosParamCreator(configuration);
2355
+ return {
2356
+ /**
2357
+ * Creates a Session.
2358
+ * @summary Create a session key.
2359
+ * @param {CreateSessionRequest} createSessionRequest
2360
+ * @param {*} [options] Override http request option.
2361
+ * @throws {RequiredError}
2362
+ */
2363
+ async createSession(createSessionRequest, options) {
2364
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createSession(createSessionRequest, options);
2365
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2366
+ },
2367
+ /**
2368
+ * Returns a list of Sessions. Returns the latest 10 transaction intents for each session.
2369
+ * @summary List session keys of a player.
2370
+ * @param {string} player The player ID (starts with pla_)
2371
+ * @param {number} [limit] Specifies the maximum number of records to return.
2372
+ * @param {number} [skip] Specifies the offset for the first records to return.
2373
+ * @param {SortOrder} [order] Specifies the order in which to sort the results.
2374
+ * @param {Array<SessionResponseExpandable>} [expand] Specifies the fields to expand in the response.
2375
+ * @param {*} [options] Override http request option.
2376
+ * @throws {RequiredError}
2377
+ */
2378
+ async getPlayerSessions(player, limit, skip, order, expand, options) {
2379
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getPlayerSessions(player, limit, skip, order, expand, options);
2380
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2381
+ },
2382
+ /**
2383
+ * Retrieves the details of a Session that has previously been created. Returns the latest 10 transaction intents that used this session.
2384
+ * @summary Returns a player session by session id
2385
+ * @param {string} id Specifies the unique session ID (starts with ses_).
2386
+ * @param {Array<SessionResponseExpandable>} [expand] Specifies the fields to expand.
2387
+ * @param {*} [options] Override http request option.
2388
+ * @throws {RequiredError}
2389
+ */
2390
+ async getSession(id, expand, options) {
2391
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getSession(id, expand, options);
2392
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2393
+ },
2394
+ /**
2395
+ *
2396
+ * @summary Revoke the session session key.
2397
+ * @param {RevokeSessionRequest} revokeSessionRequest
2398
+ * @param {*} [options] Override http request option.
2399
+ * @throws {RequiredError}
2400
+ */
2401
+ async revokeSession(revokeSessionRequest, options) {
2402
+ const localVarAxiosArgs = await localVarAxiosParamCreator.revokeSession(revokeSessionRequest, options);
2403
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2404
+ },
2405
+ /**
2406
+ *
2407
+ * @summary Send signed userOperationHash to create session.
2408
+ * @param {string} id Specifies the unique session ID (starts with ses_).
2409
+ * @param {SignatureRequest} signatureRequest
2410
+ * @param {*} [options] Override http request option.
2411
+ * @throws {RequiredError}
2412
+ */
2413
+ async signatureSession(id, signatureRequest, options) {
2414
+ const localVarAxiosArgs = await localVarAxiosParamCreator.signatureSession(id, signatureRequest, options);
2415
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2416
+ },
2417
+ };
2418
+ };
2419
+ /**
2420
+ * SessionsApi - object-oriented interface
2421
+ * @export
2422
+ * @class SessionsApi
2423
+ * @extends {BaseAPI}
2424
+ */
2425
+ class SessionsApi extends BaseAPI {
2426
+ /**
2427
+ * Creates a Session.
2428
+ * @summary Create a session key.
2429
+ * @param {SessionsApiCreateSessionRequest} requestParameters Request parameters.
2430
+ * @param {*} [options] Override http request option.
2431
+ * @throws {RequiredError}
2432
+ * @memberof SessionsApi
2433
+ */
2434
+ createSession(requestParameters, options) {
2435
+ return SessionsApiFp(this.configuration).createSession(requestParameters.createSessionRequest, options).then((request) => request(this.axios, this.basePath));
2436
+ }
2437
+ /**
2438
+ * Returns a list of Sessions. Returns the latest 10 transaction intents for each session.
2439
+ * @summary List session keys of a player.
2440
+ * @param {SessionsApiGetPlayerSessionsRequest} requestParameters Request parameters.
2441
+ * @param {*} [options] Override http request option.
2442
+ * @throws {RequiredError}
2443
+ * @memberof SessionsApi
2444
+ */
2445
+ getPlayerSessions(requestParameters, options) {
2446
+ return SessionsApiFp(this.configuration).getPlayerSessions(requestParameters.player, requestParameters.limit, requestParameters.skip, requestParameters.order, requestParameters.expand, options).then((request) => request(this.axios, this.basePath));
2447
+ }
2448
+ /**
2449
+ * Retrieves the details of a Session that has previously been created. Returns the latest 10 transaction intents that used this session.
2450
+ * @summary Returns a player session by session id
2451
+ * @param {SessionsApiGetSessionRequest} requestParameters Request parameters.
2452
+ * @param {*} [options] Override http request option.
2453
+ * @throws {RequiredError}
2454
+ * @memberof SessionsApi
2455
+ */
2456
+ getSession(requestParameters, options) {
2457
+ return SessionsApiFp(this.configuration).getSession(requestParameters.id, requestParameters.expand, options).then((request) => request(this.axios, this.basePath));
2458
+ }
2459
+ /**
2460
+ *
2461
+ * @summary Revoke the session session key.
2462
+ * @param {SessionsApiRevokeSessionRequest} requestParameters Request parameters.
2463
+ * @param {*} [options] Override http request option.
2464
+ * @throws {RequiredError}
2465
+ * @memberof SessionsApi
2466
+ */
2467
+ revokeSession(requestParameters, options) {
2468
+ return SessionsApiFp(this.configuration).revokeSession(requestParameters.revokeSessionRequest, options).then((request) => request(this.axios, this.basePath));
2469
+ }
2470
+ /**
2471
+ *
2472
+ * @summary Send signed userOperationHash to create session.
2473
+ * @param {SessionsApiSignatureSessionRequest} requestParameters Request parameters.
2474
+ * @param {*} [options] Override http request option.
2475
+ * @throws {RequiredError}
2476
+ * @memberof SessionsApi
2477
+ */
2478
+ signatureSession(requestParameters, options) {
2479
+ return SessionsApiFp(this.configuration).signatureSession(requestParameters.id, requestParameters.signatureRequest, options).then((request) => request(this.axios, this.basePath));
2480
+ }
2481
+ }
2482
+
2483
+ /* tslint:disable */
2484
+ /* eslint-disable */
2485
+ /**
2486
+ * Openfort API
2487
+ * Complete Openfort API references and guides can be found at: https://openfort.xyz/docs
2488
+ *
2489
+ * The version of the OpenAPI document: 1.0.0
2490
+ * Contact: founders@openfort.xyz
2491
+ *
2492
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2493
+ * https://openapi-generator.tech
2494
+ * Do not edit the class manually.
2495
+ */
2496
+ /**
2497
+ * TransactionIntentsApi - axios parameter creator
2498
+ * @export
2499
+ */
2500
+ const TransactionIntentsApiAxiosParamCreator = function (configuration) {
2501
+ return {
2502
+ /**
2503
+ * Creates a TransactionIntent. A pending TransactionIntent has the `response` attribute as undefined. After the TransactionIntent is created and broadcasted to the blockchain, `response` will be populated with the transaction hash and a status (1 success, 0 fail). When using a non-custodial account, a `nextAction` attribute is returned with the `userOperationHash` that must be signed by the owner of the account.
2504
+ * @summary Create a transaction intent object.
2505
+ * @param {CreateTransactionIntentRequest} createTransactionIntentRequest
2506
+ * @param {*} [options] Override http request option.
2507
+ * @throws {RequiredError}
2508
+ */
2509
+ createTransactionIntent: async (createTransactionIntentRequest, options = {}) => {
2510
+ // verify required parameter 'createTransactionIntentRequest' is not null or undefined
2511
+ assertParamExists('createTransactionIntent', 'createTransactionIntentRequest', createTransactionIntentRequest);
2512
+ const localVarPath = `/v1/transaction_intents`;
2513
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
2514
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
2515
+ let baseOptions;
2516
+ if (configuration) {
2517
+ baseOptions = configuration.baseOptions;
2518
+ }
2519
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
2520
+ const localVarHeaderParameter = {};
2521
+ const localVarQueryParameter = {};
2522
+ // authentication sk required
2523
+ // http bearer authentication required
2524
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
2525
+ localVarHeaderParameter['Content-Type'] = 'application/json';
2526
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
2527
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2528
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
2529
+ localVarRequestOptions.data = serializeDataIfNeeded(createTransactionIntentRequest, localVarRequestOptions, configuration);
2530
+ return {
2531
+ url: toPathString(localVarUrlObj),
2532
+ options: localVarRequestOptions,
2533
+ };
2534
+ },
2535
+ /**
2536
+ * Estimate the gas cost of broadcasting a TransactionIntent. This is a simulation, it does not send the transaction on-chain. If a Policy ID is used that includes payment of gas in ERC-20 tokens, an extra field `estimatedTXGasFeeToken` is returned with the estimated amount of tokens that will be used.
2537
+ * @summary Estimate gas cost of creating a transaction
2538
+ * @param {CreateTransactionIntentRequest} createTransactionIntentRequest
2539
+ * @param {*} [options] Override http request option.
2540
+ * @throws {RequiredError}
2541
+ */
2542
+ estimateTransactionIntentCost: async (createTransactionIntentRequest, options = {}) => {
2543
+ // verify required parameter 'createTransactionIntentRequest' is not null or undefined
2544
+ assertParamExists('estimateTransactionIntentCost', 'createTransactionIntentRequest', createTransactionIntentRequest);
2545
+ const localVarPath = `/v1/transaction_intents/estimate_gas_cost`;
2546
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
2547
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
2548
+ let baseOptions;
2549
+ if (configuration) {
2550
+ baseOptions = configuration.baseOptions;
2551
+ }
2552
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
2553
+ const localVarHeaderParameter = {};
2554
+ const localVarQueryParameter = {};
2555
+ // authentication sk required
2556
+ // http bearer authentication required
2557
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
2558
+ localVarHeaderParameter['Content-Type'] = 'application/json';
2559
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
2560
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2561
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
2562
+ localVarRequestOptions.data = serializeDataIfNeeded(createTransactionIntentRequest, localVarRequestOptions, configuration);
2563
+ return {
2564
+ url: toPathString(localVarUrlObj),
2565
+ options: localVarRequestOptions,
2566
+ };
2567
+ },
2568
+ /**
2569
+ * Retrieves the details of a TransactionIntent that has previously been created.
2570
+ * @summary Get a transaction intent object.
2571
+ * @param {string} id Specifies the unique transaction intent ID (starts with tin_).
2572
+ * @param {Array<TransactionIntentResponseExpandable>} [expand] Specifies the expandable fields.
2573
+ * @param {*} [options] Override http request option.
2574
+ * @throws {RequiredError}
2575
+ */
2576
+ getTransactionIntent: async (id, expand, options = {}) => {
2577
+ // verify required parameter 'id' is not null or undefined
2578
+ assertParamExists('getTransactionIntent', 'id', id);
2579
+ const localVarPath = `/v1/transaction_intents/{id}`
2580
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
2581
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
2582
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
2583
+ let baseOptions;
2584
+ if (configuration) {
2585
+ baseOptions = configuration.baseOptions;
2586
+ }
2587
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
2588
+ const localVarHeaderParameter = {};
2589
+ const localVarQueryParameter = {};
2590
+ // authentication sk required
2591
+ // http bearer authentication required
2592
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
2593
+ if (expand) {
2594
+ localVarQueryParameter['expand'] = expand;
2595
+ }
2596
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
2597
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2598
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
2599
+ return {
2600
+ url: toPathString(localVarUrlObj),
2601
+ options: localVarRequestOptions,
2602
+ };
2603
+ },
2604
+ /**
2605
+ * Returns a list of TransactionIntents.
2606
+ * @summary List transaction intents.
2607
+ * @param {number} [limit] Specifies the maximum number of records to return.
2608
+ * @param {number} [skip] Specifies the offset for the first records to return.
2609
+ * @param {SortOrder} [order] Specifies the order in which to sort the results.
2610
+ * @param {Array<TransactionIntentResponseExpandable>} [expand] Specifies the fields to expand in the response.
2611
+ * @param {number} [chainId] The chain ID. Must be a [supported chain](/chains).
2612
+ * @param {Array<string>} [account] Filter by account ID or developer account (starts with acc_ or dac_ respectively).
2613
+ * @param {Array<string>} [player] Filter by player ID (starts with pla_).
2614
+ * @param {number} [status] Filter by successful (1) or failed (0) transaction intents.
2615
+ * @param {Array<string>} [policy] Filter by policy ID (starts with pol_).
2616
+ * @param {*} [options] Override http request option.
2617
+ * @throws {RequiredError}
2618
+ */
2619
+ getTransactionIntents: async (limit, skip, order, expand, chainId, account, player, status, policy, options = {}) => {
2620
+ const localVarPath = `/v1/transaction_intents`;
2621
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
2622
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
2623
+ let baseOptions;
2624
+ if (configuration) {
2625
+ baseOptions = configuration.baseOptions;
2626
+ }
2627
+ const localVarRequestOptions = { method: 'GET', ...baseOptions, ...options };
2628
+ const localVarHeaderParameter = {};
2629
+ const localVarQueryParameter = {};
2630
+ // authentication sk required
2631
+ // http bearer authentication required
2632
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
2633
+ if (limit !== undefined) {
2634
+ localVarQueryParameter['limit'] = limit;
2635
+ }
2636
+ if (skip !== undefined) {
2637
+ localVarQueryParameter['skip'] = skip;
2638
+ }
2639
+ if (order !== undefined) {
2640
+ localVarQueryParameter['order'] = order;
2641
+ }
2642
+ if (expand) {
2643
+ localVarQueryParameter['expand'] = expand;
2644
+ }
2645
+ if (chainId !== undefined) {
2646
+ localVarQueryParameter['chainId'] = chainId;
2647
+ }
2648
+ if (account) {
2649
+ localVarQueryParameter['account'] = account;
2650
+ }
2651
+ if (player) {
2652
+ localVarQueryParameter['player'] = player;
2653
+ }
2654
+ if (status !== undefined) {
2655
+ localVarQueryParameter['status'] = status;
2656
+ }
2657
+ if (policy) {
2658
+ localVarQueryParameter['policy'] = policy;
2659
+ }
2660
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
2661
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2662
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
2663
+ return {
2664
+ url: toPathString(localVarUrlObj),
2665
+ options: localVarRequestOptions,
2666
+ };
2667
+ },
2668
+ /**
2669
+ * Broadcasts a signed TransactionIntent to the blockchain. Use this endpoint to send the signed `userOperationHash`. Openfort will then put it on-chain.
2670
+ * @summary Send a signed transaction userOperationHash.
2671
+ * @param {string} id Specifies the unique transaction intent ID (starts with tin_).
2672
+ * @param {SignatureRequest} signatureRequest
2673
+ * @param {*} [options] Override http request option.
2674
+ * @throws {RequiredError}
2675
+ */
2676
+ signature: async (id, signatureRequest, options = {}) => {
2677
+ // verify required parameter 'id' is not null or undefined
2678
+ assertParamExists('signature', 'id', id);
2679
+ // verify required parameter 'signatureRequest' is not null or undefined
2680
+ assertParamExists('signature', 'signatureRequest', signatureRequest);
2681
+ const localVarPath = `/v1/transaction_intents/{id}/signature`
2682
+ .replace(`{${"id"}}`, encodeURIComponent(String(id)));
2683
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
2684
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
2685
+ let baseOptions;
2686
+ if (configuration) {
2687
+ baseOptions = configuration.baseOptions;
2688
+ }
2689
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
2690
+ const localVarHeaderParameter = {};
2691
+ const localVarQueryParameter = {};
2692
+ // authentication sk required
2693
+ // http bearer authentication required
2694
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
2695
+ // authentication pk required
2696
+ // http bearer authentication required
2697
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
2698
+ localVarHeaderParameter['Content-Type'] = 'application/json';
2699
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
2700
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
2701
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
2702
+ localVarRequestOptions.data = serializeDataIfNeeded(signatureRequest, localVarRequestOptions, configuration);
2703
+ return {
2704
+ url: toPathString(localVarUrlObj),
2705
+ options: localVarRequestOptions,
2706
+ };
2707
+ },
2708
+ };
2709
+ };
2710
+ /**
2711
+ * TransactionIntentsApi - functional programming interface
2712
+ * @export
2713
+ */
2714
+ const TransactionIntentsApiFp = function (configuration) {
2715
+ const localVarAxiosParamCreator = TransactionIntentsApiAxiosParamCreator(configuration);
2716
+ return {
2717
+ /**
2718
+ * Creates a TransactionIntent. A pending TransactionIntent has the `response` attribute as undefined. After the TransactionIntent is created and broadcasted to the blockchain, `response` will be populated with the transaction hash and a status (1 success, 0 fail). When using a non-custodial account, a `nextAction` attribute is returned with the `userOperationHash` that must be signed by the owner of the account.
2719
+ * @summary Create a transaction intent object.
2720
+ * @param {CreateTransactionIntentRequest} createTransactionIntentRequest
2721
+ * @param {*} [options] Override http request option.
2722
+ * @throws {RequiredError}
2723
+ */
2724
+ async createTransactionIntent(createTransactionIntentRequest, options) {
2725
+ const localVarAxiosArgs = await localVarAxiosParamCreator.createTransactionIntent(createTransactionIntentRequest, options);
2726
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2727
+ },
2728
+ /**
2729
+ * Estimate the gas cost of broadcasting a TransactionIntent. This is a simulation, it does not send the transaction on-chain. If a Policy ID is used that includes payment of gas in ERC-20 tokens, an extra field `estimatedTXGasFeeToken` is returned with the estimated amount of tokens that will be used.
2730
+ * @summary Estimate gas cost of creating a transaction
2731
+ * @param {CreateTransactionIntentRequest} createTransactionIntentRequest
2732
+ * @param {*} [options] Override http request option.
2733
+ * @throws {RequiredError}
2734
+ */
2735
+ async estimateTransactionIntentCost(createTransactionIntentRequest, options) {
2736
+ const localVarAxiosArgs = await localVarAxiosParamCreator.estimateTransactionIntentCost(createTransactionIntentRequest, options);
2737
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2738
+ },
2739
+ /**
2740
+ * Retrieves the details of a TransactionIntent that has previously been created.
2741
+ * @summary Get a transaction intent object.
2742
+ * @param {string} id Specifies the unique transaction intent ID (starts with tin_).
2743
+ * @param {Array<TransactionIntentResponseExpandable>} [expand] Specifies the expandable fields.
2744
+ * @param {*} [options] Override http request option.
2745
+ * @throws {RequiredError}
2746
+ */
2747
+ async getTransactionIntent(id, expand, options) {
2748
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getTransactionIntent(id, expand, options);
2749
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2750
+ },
2751
+ /**
2752
+ * Returns a list of TransactionIntents.
2753
+ * @summary List transaction intents.
2754
+ * @param {number} [limit] Specifies the maximum number of records to return.
2755
+ * @param {number} [skip] Specifies the offset for the first records to return.
2756
+ * @param {SortOrder} [order] Specifies the order in which to sort the results.
2757
+ * @param {Array<TransactionIntentResponseExpandable>} [expand] Specifies the fields to expand in the response.
2758
+ * @param {number} [chainId] The chain ID. Must be a [supported chain](/chains).
2759
+ * @param {Array<string>} [account] Filter by account ID or developer account (starts with acc_ or dac_ respectively).
2760
+ * @param {Array<string>} [player] Filter by player ID (starts with pla_).
2761
+ * @param {number} [status] Filter by successful (1) or failed (0) transaction intents.
2762
+ * @param {Array<string>} [policy] Filter by policy ID (starts with pol_).
2763
+ * @param {*} [options] Override http request option.
2764
+ * @throws {RequiredError}
2765
+ */
2766
+ async getTransactionIntents(limit, skip, order, expand, chainId, account, player, status, policy, options) {
2767
+ const localVarAxiosArgs = await localVarAxiosParamCreator.getTransactionIntents(limit, skip, order, expand, chainId, account, player, status, policy, options);
2768
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2769
+ },
2770
+ /**
2771
+ * Broadcasts a signed TransactionIntent to the blockchain. Use this endpoint to send the signed `userOperationHash`. Openfort will then put it on-chain.
2772
+ * @summary Send a signed transaction userOperationHash.
2773
+ * @param {string} id Specifies the unique transaction intent ID (starts with tin_).
2774
+ * @param {SignatureRequest} signatureRequest
2775
+ * @param {*} [options] Override http request option.
2776
+ * @throws {RequiredError}
2777
+ */
2778
+ async signature(id, signatureRequest, options) {
2779
+ const localVarAxiosArgs = await localVarAxiosParamCreator.signature(id, signatureRequest, options);
2780
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
2781
+ },
2782
+ };
2783
+ };
2784
+ /**
2785
+ * TransactionIntentsApi - object-oriented interface
2786
+ * @export
2787
+ * @class TransactionIntentsApi
2788
+ * @extends {BaseAPI}
2789
+ */
2790
+ class TransactionIntentsApi extends BaseAPI {
2791
+ /**
2792
+ * Creates a TransactionIntent. A pending TransactionIntent has the `response` attribute as undefined. After the TransactionIntent is created and broadcasted to the blockchain, `response` will be populated with the transaction hash and a status (1 success, 0 fail). When using a non-custodial account, a `nextAction` attribute is returned with the `userOperationHash` that must be signed by the owner of the account.
2793
+ * @summary Create a transaction intent object.
2794
+ * @param {TransactionIntentsApiCreateTransactionIntentRequest} requestParameters Request parameters.
2795
+ * @param {*} [options] Override http request option.
2796
+ * @throws {RequiredError}
2797
+ * @memberof TransactionIntentsApi
2798
+ */
2799
+ createTransactionIntent(requestParameters, options) {
2800
+ return TransactionIntentsApiFp(this.configuration).createTransactionIntent(requestParameters.createTransactionIntentRequest, options).then((request) => request(this.axios, this.basePath));
2801
+ }
2802
+ /**
2803
+ * Estimate the gas cost of broadcasting a TransactionIntent. This is a simulation, it does not send the transaction on-chain. If a Policy ID is used that includes payment of gas in ERC-20 tokens, an extra field `estimatedTXGasFeeToken` is returned with the estimated amount of tokens that will be used.
2804
+ * @summary Estimate gas cost of creating a transaction
2805
+ * @param {TransactionIntentsApiEstimateTransactionIntentCostRequest} requestParameters Request parameters.
2806
+ * @param {*} [options] Override http request option.
2807
+ * @throws {RequiredError}
2808
+ * @memberof TransactionIntentsApi
2809
+ */
2810
+ estimateTransactionIntentCost(requestParameters, options) {
2811
+ return TransactionIntentsApiFp(this.configuration).estimateTransactionIntentCost(requestParameters.createTransactionIntentRequest, options).then((request) => request(this.axios, this.basePath));
2812
+ }
2813
+ /**
2814
+ * Retrieves the details of a TransactionIntent that has previously been created.
2815
+ * @summary Get a transaction intent object.
2816
+ * @param {TransactionIntentsApiGetTransactionIntentRequest} requestParameters Request parameters.
2817
+ * @param {*} [options] Override http request option.
2818
+ * @throws {RequiredError}
2819
+ * @memberof TransactionIntentsApi
2820
+ */
2821
+ getTransactionIntent(requestParameters, options) {
2822
+ return TransactionIntentsApiFp(this.configuration).getTransactionIntent(requestParameters.id, requestParameters.expand, options).then((request) => request(this.axios, this.basePath));
2823
+ }
2824
+ /**
2825
+ * Returns a list of TransactionIntents.
2826
+ * @summary List transaction intents.
2827
+ * @param {TransactionIntentsApiGetTransactionIntentsRequest} requestParameters Request parameters.
2828
+ * @param {*} [options] Override http request option.
2829
+ * @throws {RequiredError}
2830
+ * @memberof TransactionIntentsApi
2831
+ */
2832
+ getTransactionIntents(requestParameters = {}, options) {
2833
+ return TransactionIntentsApiFp(this.configuration).getTransactionIntents(requestParameters.limit, requestParameters.skip, requestParameters.order, requestParameters.expand, requestParameters.chainId, requestParameters.account, requestParameters.player, requestParameters.status, requestParameters.policy, options).then((request) => request(this.axios, this.basePath));
2834
+ }
2835
+ /**
2836
+ * Broadcasts a signed TransactionIntent to the blockchain. Use this endpoint to send the signed `userOperationHash`. Openfort will then put it on-chain.
2837
+ * @summary Send a signed transaction userOperationHash.
2838
+ * @param {TransactionIntentsApiSignatureRequest} requestParameters Request parameters.
2839
+ * @param {*} [options] Override http request option.
2840
+ * @throws {RequiredError}
2841
+ * @memberof TransactionIntentsApi
2842
+ */
2843
+ signature(requestParameters, options) {
2844
+ return TransactionIntentsApiFp(this.configuration).signature(requestParameters.id, requestParameters.signatureRequest, options).then((request) => request(this.axios, this.basePath));
2845
+ }
2846
+ }
2847
+
2848
+ /* tslint:disable */
2849
+ /* eslint-disable */
2850
+ /**
2851
+ * Openfort API
2852
+ * Complete Openfort API references and guides can be found at: https://openfort.xyz/docs
2853
+ *
2854
+ * The version of the OpenAPI document: 1.0.0
2855
+ * Contact: founders@openfort.xyz
2856
+ *
2857
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2858
+ * https://openapi-generator.tech
2859
+ * Do not edit the class manually.
2860
+ */
2861
+ class Configuration {
2862
+ /**
2863
+ * parameter for apiKey security
2864
+ * @param name security name
2865
+ * @memberof Configuration
2866
+ */
2867
+ apiKey;
2868
+ /**
2869
+ * parameter for basic security
2870
+ *
2871
+ * @type {string}
2872
+ * @memberof Configuration
2873
+ */
2874
+ username;
2875
+ /**
2876
+ * parameter for basic security
2877
+ *
2878
+ * @type {string}
2879
+ * @memberof Configuration
2880
+ */
2881
+ password;
2882
+ /**
2883
+ * parameter for oauth2 security
2884
+ * @param name security name
2885
+ * @param scopes oauth2 scope
2886
+ * @memberof Configuration
2887
+ */
2888
+ accessToken;
2889
+ /**
2890
+ * override base path
2891
+ *
2892
+ * @type {string}
2893
+ * @memberof Configuration
2894
+ */
2895
+ basePath;
2896
+ /**
2897
+ * base options for axios calls
2898
+ *
2899
+ * @type {any}
2900
+ * @memberof Configuration
2901
+ */
2902
+ baseOptions;
2903
+ /**
2904
+ * The FormData constructor that will be used to create multipart form data
2905
+ * requests. You can inject this here so that execution environments that
2906
+ * do not support the FormData class can still run the generated client.
2907
+ *
2908
+ * @type {new () => FormData}
2909
+ */
2910
+ formDataCtor;
2911
+ constructor(param = {}) {
2912
+ this.apiKey = param.apiKey;
2913
+ this.username = param.username;
2914
+ this.password = param.password;
2915
+ this.accessToken = param.accessToken;
2916
+ this.basePath = param.basePath;
2917
+ this.baseOptions = param.baseOptions;
2918
+ this.formDataCtor = param.formDataCtor;
2919
+ }
2920
+ /**
2921
+ * Check if the given MIME is a JSON MIME.
2922
+ * JSON MIME examples:
2923
+ * application/json
2924
+ * application/json; charset=UTF8
2925
+ * APPLICATION/JSON
2926
+ * application/vnd.company+json
2927
+ * @param mime - MIME (Multipurpose Internet Mail Extensions)
2928
+ * @return True if the given MIME is JSON, false otherwise.
2929
+ */
2930
+ isJsonMime(mime) {
2931
+ const jsonMime = new RegExp('^(application\/json|[^;/ \t]+\/[^;/ \t]+[+]json)[ \t]*(;.*)?$', 'i');
2932
+ return mime !== null && (jsonMime.test(mime) || mime.toLowerCase() === 'application/json-patch+json');
2933
+ }
2934
+ }
2935
+
2936
+ class BackendApiClients {
2937
+ config;
2938
+ transactionIntentsApi;
2939
+ accountsApi;
2940
+ sessionsApi;
2941
+ authenticationApi;
2942
+ constructor(config) {
2943
+ this.config = config;
2944
+ this.transactionIntentsApi = new TransactionIntentsApi(config.backend);
2945
+ this.accountsApi = new AccountsApi(config.backend);
2946
+ this.sessionsApi = new SessionsApi(config.backend);
2947
+ this.authenticationApi = new AuthenticationApi(config.backend);
2948
+ }
2949
+ }
2950
+
2951
+ const createConfig = ({ basePath, accessToken, }) => {
2952
+ if (!basePath.trim()) {
2953
+ throw Error('basePath can not be empty');
2954
+ }
2955
+ const apiConfigOptions = {
2956
+ basePath,
2957
+ accessToken,
2958
+ };
2959
+ return new Configuration(apiConfigOptions);
2960
+ };
2961
+
59
2962
  var OpenfortErrorType;
60
2963
  (function (OpenfortErrorType) {
61
2964
  OpenfortErrorType["AUTHENTICATION_ERROR"] = "AUTHENTICATION_ERROR";
@@ -126,7 +3029,7 @@ class SDKConfiguration {
126
3029
  this.iframeUrl = overrides.iframeUrl;
127
3030
  this.shieldUrl = overrides.shieldUrl;
128
3031
  this.openfortAPIConfig = {
129
- backend: openapiClients.createConfig({
3032
+ backend: createConfig({
130
3033
  basePath: overrides.backendUrl,
131
3034
  accessToken: baseConfiguration.publishableKey,
132
3035
  }),
@@ -137,7 +3040,7 @@ class SDKConfiguration {
137
3040
  this.iframeUrl = 'https://iframe.openfort.xyz';
138
3041
  this.shieldUrl = 'https://shield.openfort.xyz';
139
3042
  this.openfortAPIConfig = {
140
- backend: openapiClients.createConfig({
3043
+ backend: createConfig({
141
3044
  basePath: 'https://api.openfort.xyz',
142
3045
  accessToken: baseConfiguration.publishableKey,
143
3046
  }),
@@ -161,11 +3064,12 @@ class AuthManager {
161
3064
  this.config = config;
162
3065
  this.backendApiClients = backendApiClients;
163
3066
  }
164
- async initOAuth(provider, options) {
3067
+ async initOAuth(provider, usePooling, options) {
165
3068
  const request = {
166
3069
  oAuthInitRequest: {
167
3070
  provider,
168
3071
  options,
3072
+ usePooling: usePooling || false,
169
3073
  },
170
3074
  };
171
3075
  const result = await this.backendApiClients.authenticationApi.initOAuth(request);
@@ -177,6 +3081,52 @@ class AuthManager {
177
3081
  key: result.data.key,
178
3082
  };
179
3083
  }
3084
+ async initLinkOAuth(provider, playerToken, usePooling, options) {
3085
+ const request = {
3086
+ oAuthInitRequest: {
3087
+ provider,
3088
+ options,
3089
+ usePooling: usePooling || false,
3090
+ },
3091
+ };
3092
+ const result = await this.backendApiClients.authenticationApi.initLinkOAuth(request, {
3093
+ // eslint-disable-next-line @typescript-eslint/naming-convention
3094
+ headers: { 'x-player-token': playerToken },
3095
+ });
3096
+ if (isBrowser() && !options?.skipBrowserRedirect) {
3097
+ window.location.assign(result.data.url);
3098
+ }
3099
+ return {
3100
+ url: result.data.url,
3101
+ key: result.data.key,
3102
+ };
3103
+ }
3104
+ async poolOAuth(key) {
3105
+ const request = {
3106
+ key,
3107
+ };
3108
+ for (let i = 0; i < 600; i++) {
3109
+ try {
3110
+ // eslint-disable-next-line no-await-in-loop
3111
+ const response = await this.backendApiClients.authenticationApi.poolOAuth(request);
3112
+ if (response.status === 200) {
3113
+ return response.data;
3114
+ }
3115
+ }
3116
+ catch (error) {
3117
+ // @ts-ignore
3118
+ if (error.response && error.response.status === 404) {
3119
+ // eslint-disable-next-line no-await-in-loop
3120
+ await new Promise((resolve) => { setTimeout(resolve, 500); });
3121
+ // eslint-disable-next-line no-continue
3122
+ continue;
3123
+ }
3124
+ throw error;
3125
+ }
3126
+ }
3127
+ throw new Error('Failed to pool OAuth, try again later');
3128
+ }
3129
+ // Deprecated
180
3130
  async authenticateOAuth(provider, token, tokenType) {
181
3131
  const request = {
182
3132
  authenticateOAuthRequest: {
@@ -1146,7 +4096,7 @@ class Openfort {
1146
4096
  iframeManager;
1147
4097
  constructor(sdkConfiguration) {
1148
4098
  this.config = new SDKConfiguration(sdkConfiguration);
1149
- this.backendApiClients = new openapiClients.BackendApiClients(this.config.openfortAPIConfig);
4099
+ this.backendApiClients = new BackendApiClients(this.config.openfortAPIConfig);
1150
4100
  this.authManager = new AuthManager(this.config, this.backendApiClients);
1151
4101
  this.instanceManager = new InstanceManager(new SessionStorage(), new LocalStorage(), new LocalStorage(), this.authManager);
1152
4102
  this.iframeManager = new IframeManager(this.config);
@@ -1261,8 +4211,14 @@ class Openfort {
1261
4211
  });
1262
4212
  return result;
1263
4213
  }
1264
- async initOAuth(provider, options) {
1265
- return await this.authManager.initOAuth(provider, options);
4214
+ async initOAuth(provider, usePooling, options) {
4215
+ return await this.authManager.initOAuth(provider, usePooling, options);
4216
+ }
4217
+ async initLinkOAuth(provider, playerToken, usePooling, options) {
4218
+ return await this.authManager.initLinkOAuth(provider, playerToken, usePooling, options);
4219
+ }
4220
+ async poolOAuth(key) {
4221
+ return await this.authManager.poolOAuth(key);
1266
4222
  }
1267
4223
  async authenticateWithOAuth(provider, token, tokenType) {
1268
4224
  this.instanceManager.removeAccessToken();
@@ -1503,5 +4459,6 @@ class Openfort {
1503
4459
  }
1504
4460
 
1505
4461
  exports.OpenfortConfiguration = OpenfortConfiguration;
4462
+ exports.SDKConfiguration = SDKConfiguration;
1506
4463
  exports.ShieldConfiguration = ShieldConfiguration;
1507
4464
  exports.default = Openfort;