@openfort/openfort-js 0.7.0 → 0.7.1

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