@openfort/openfort-js 0.7.1 → 0.7.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -4,10 +4,13 @@ Object.defineProperty(exports, '__esModule', { value: true });
4
4
 
5
5
  var hash = require('@ethersproject/hash');
6
6
  var globalAxios = require('axios');
7
+ var providers = require('@ethersproject/providers');
8
+ var bytes = require('@ethersproject/bytes');
9
+ var events = require('events');
10
+ var uuid = require('uuid');
7
11
  var jose = require('jose');
8
12
  var secp256k1 = require('@noble/curves/secp256k1');
9
13
  var signingKey = require('@ethersproject/signing-key');
10
- var bytes = require('@ethersproject/bytes');
11
14
  var transactions = require('@ethersproject/transactions');
12
15
 
13
16
  exports.EmbeddedState = void 0;
@@ -18,6 +21,10 @@ exports.EmbeddedState = void 0;
18
21
  EmbeddedState[EmbeddedState["CREATING_ACCOUNT"] = 3] = "CREATING_ACCOUNT";
19
22
  EmbeddedState[EmbeddedState["READY"] = 4] = "READY";
20
23
  })(exports.EmbeddedState || (exports.EmbeddedState = {}));
24
+ var OpenfortEvents;
25
+ (function (OpenfortEvents) {
26
+ OpenfortEvents["LOGGED_OUT"] = "loggedOut";
27
+ })(OpenfortEvents || (OpenfortEvents = {}));
21
28
  var AccountType;
22
29
  (function (AccountType) {
23
30
  AccountType["UPGRADEABLE_V4"] = "Upgradeable_v04";
@@ -43,16 +50,15 @@ exports.ThirdPartyOAuthProvider = void 0;
43
50
  ThirdPartyOAuthProvider["CUSTOM"] = "custom";
44
51
  ThirdPartyOAuthProvider["OIDC"] = "oidc";
45
52
  })(exports.ThirdPartyOAuthProvider || (exports.ThirdPartyOAuthProvider = {}));
53
+ exports.BasicAuthProvider = void 0;
54
+ (function (BasicAuthProvider) {
55
+ BasicAuthProvider["EMAIL"] = "email";
56
+ BasicAuthProvider["WALLET"] = "wallet";
57
+ })(exports.BasicAuthProvider || (exports.BasicAuthProvider = {}));
46
58
  exports.OAuthProvider = void 0;
47
59
  (function (OAuthProvider) {
48
- OAuthProvider["ACCELBYTE"] = "accelbyte";
49
- OAuthProvider["FIREBASE"] = "firebase";
50
60
  OAuthProvider["GOOGLE"] = "google";
51
- OAuthProvider["LOOTLOCKER"] = "lootlocker";
52
- OAuthProvider["PLAYFAB"] = "playfab";
53
- OAuthProvider["CUSTOM"] = "custom";
54
- OAuthProvider["OIDC"] = "oidc";
55
- OAuthProvider["SUPABASE"] = "supabase";
61
+ OAuthProvider["TWITTER"] = "twitter";
56
62
  })(exports.OAuthProvider || (exports.OAuthProvider = {}));
57
63
 
58
64
  /* tslint:disable */
@@ -865,7 +871,7 @@ class AccountsApi extends BaseAPI {
865
871
  const AuthenticationApiAxiosParamCreator = function (configuration) {
866
872
  return {
867
873
  /**
868
- *
874
+ * Deprecated
869
875
  * @summary Authenticate player with oauth token.
870
876
  * @param {AuthenticateOAuthRequest} authenticateOAuthRequest
871
877
  * @param {*} [options] Override http request option.
@@ -933,7 +939,7 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
933
939
  /**
934
940
  * 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.
935
941
  * @summary Authorize player with token.
936
- * @param {OAuthProvider} provider OAuth provider
942
+ * @param {AuthProvider} provider OAuth provider
937
943
  * @param {OAuthRequest} oAuthRequest
938
944
  * @param {*} [options] Override http request option.
939
945
  * @deprecated
@@ -1000,6 +1006,36 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1000
1006
  options: localVarRequestOptions,
1001
1007
  };
1002
1008
  },
1009
+ /**
1010
+ *
1011
+ * @summary Initialize Link OAuth.
1012
+ * @param {OAuthInitRequest} oAuthInitRequest
1013
+ * @param {*} [options] Override http request option.
1014
+ * @throws {RequiredError}
1015
+ */
1016
+ initLinkOAuth: async (oAuthInitRequest, options = {}) => {
1017
+ // verify required parameter 'oAuthInitRequest' is not null or undefined
1018
+ assertParamExists('initLinkOAuth', 'oAuthInitRequest', oAuthInitRequest);
1019
+ const localVarPath = `/iam/v1/oauth/init_link`;
1020
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1021
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1022
+ let baseOptions;
1023
+ if (configuration) {
1024
+ baseOptions = configuration.baseOptions;
1025
+ }
1026
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1027
+ const localVarHeaderParameter = {};
1028
+ const localVarQueryParameter = {};
1029
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1030
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1031
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1032
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1033
+ localVarRequestOptions.data = serializeDataIfNeeded(oAuthInitRequest, localVarRequestOptions, configuration);
1034
+ return {
1035
+ url: toPathString(localVarUrlObj),
1036
+ options: localVarRequestOptions,
1037
+ };
1038
+ },
1003
1039
  /**
1004
1040
  *
1005
1041
  * @summary Initialize OAuth.
@@ -1183,6 +1219,40 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1183
1219
  options: localVarRequestOptions,
1184
1220
  };
1185
1221
  },
1222
+ /**
1223
+ *
1224
+ * @summary Initialize OAuth.
1225
+ * @param {string} key
1226
+ * @param {*} [options] Override http request option.
1227
+ * @throws {RequiredError}
1228
+ */
1229
+ poolOAuth: async (key, options = {}) => {
1230
+ // verify required parameter 'key' is not null or undefined
1231
+ assertParamExists('poolOAuth', 'key', key);
1232
+ const localVarPath = `/iam/v1/oauth/pool`;
1233
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1234
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1235
+ let baseOptions;
1236
+ if (configuration) {
1237
+ baseOptions = configuration.baseOptions;
1238
+ }
1239
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1240
+ const localVarHeaderParameter = {};
1241
+ const localVarQueryParameter = {};
1242
+ // authentication pk required
1243
+ // http bearer authentication required
1244
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1245
+ if (key !== undefined) {
1246
+ localVarQueryParameter['key'] = key;
1247
+ }
1248
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1249
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1250
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1251
+ return {
1252
+ url: toPathString(localVarUrlObj),
1253
+ options: localVarRequestOptions,
1254
+ };
1255
+ },
1186
1256
  /**
1187
1257
  * Get or create a new session for the player based on the refresh token.
1188
1258
  * @summary Refresh or create auth session.
@@ -1213,6 +1283,105 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1213
1283
  options: localVarRequestOptions,
1214
1284
  };
1215
1285
  },
1286
+ /**
1287
+ * Start the Email Verification process for a player.
1288
+ * @summary Request an Email Verification.
1289
+ * @param {RequestResetPasswordRequest} requestResetPasswordRequest
1290
+ * @param {*} [options] Override http request option.
1291
+ * @throws {RequiredError}
1292
+ */
1293
+ requestEmailVerification: async (requestResetPasswordRequest, options = {}) => {
1294
+ // verify required parameter 'requestResetPasswordRequest' is not null or undefined
1295
+ assertParamExists('requestEmailVerification', 'requestResetPasswordRequest', requestResetPasswordRequest);
1296
+ const localVarPath = `/iam/v1/password/email/request_verification`;
1297
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1298
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1299
+ let baseOptions;
1300
+ if (configuration) {
1301
+ baseOptions = configuration.baseOptions;
1302
+ }
1303
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1304
+ const localVarHeaderParameter = {};
1305
+ const localVarQueryParameter = {};
1306
+ // authentication pk required
1307
+ // http bearer authentication required
1308
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1309
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1310
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1311
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1312
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1313
+ localVarRequestOptions.data = serializeDataIfNeeded(requestResetPasswordRequest, localVarRequestOptions, configuration);
1314
+ return {
1315
+ url: toPathString(localVarUrlObj),
1316
+ options: localVarRequestOptions,
1317
+ };
1318
+ },
1319
+ /**
1320
+ * Start the Reset process for a player\'s password.
1321
+ * @summary Request a Reset password.
1322
+ * @param {RequestResetPasswordRequest} requestResetPasswordRequest
1323
+ * @param {*} [options] Override http request option.
1324
+ * @throws {RequiredError}
1325
+ */
1326
+ requestResetPassword: async (requestResetPasswordRequest, options = {}) => {
1327
+ // verify required parameter 'requestResetPasswordRequest' is not null or undefined
1328
+ assertParamExists('requestResetPassword', 'requestResetPasswordRequest', requestResetPasswordRequest);
1329
+ const localVarPath = `/iam/v1/password/password/request_reset`;
1330
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1331
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1332
+ let baseOptions;
1333
+ if (configuration) {
1334
+ baseOptions = configuration.baseOptions;
1335
+ }
1336
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1337
+ const localVarHeaderParameter = {};
1338
+ const localVarQueryParameter = {};
1339
+ // authentication pk required
1340
+ // http bearer authentication required
1341
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1342
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1343
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1344
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1345
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1346
+ localVarRequestOptions.data = serializeDataIfNeeded(requestResetPasswordRequest, localVarRequestOptions, configuration);
1347
+ return {
1348
+ url: toPathString(localVarUrlObj),
1349
+ options: localVarRequestOptions,
1350
+ };
1351
+ },
1352
+ /**
1353
+ * Reset a player\'s password.
1354
+ * @summary Reset a password.
1355
+ * @param {ResetPasswordRequest} resetPasswordRequest
1356
+ * @param {*} [options] Override http request option.
1357
+ * @throws {RequiredError}
1358
+ */
1359
+ resetPassword: async (resetPasswordRequest, options = {}) => {
1360
+ // verify required parameter 'resetPasswordRequest' is not null or undefined
1361
+ assertParamExists('resetPassword', 'resetPasswordRequest', resetPasswordRequest);
1362
+ const localVarPath = `/iam/v1/password/password/reset`;
1363
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1364
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1365
+ let baseOptions;
1366
+ if (configuration) {
1367
+ baseOptions = configuration.baseOptions;
1368
+ }
1369
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1370
+ const localVarHeaderParameter = {};
1371
+ const localVarQueryParameter = {};
1372
+ // authentication pk required
1373
+ // http bearer authentication required
1374
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1375
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1376
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1377
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1378
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1379
+ localVarRequestOptions.data = serializeDataIfNeeded(resetPasswordRequest, localVarRequestOptions, configuration);
1380
+ return {
1381
+ url: toPathString(localVarUrlObj),
1382
+ options: localVarRequestOptions,
1383
+ };
1384
+ },
1216
1385
  /**
1217
1386
  * Create and authenticate a player based on email and password.
1218
1387
  * @summary Email and password signup.
@@ -1339,10 +1508,43 @@ const AuthenticationApiAxiosParamCreator = function (configuration) {
1339
1508
  options: localVarRequestOptions,
1340
1509
  };
1341
1510
  },
1511
+ /**
1512
+ * Verify a player\'s email address.
1513
+ * @summary Verify an email.
1514
+ * @param {ResetPasswordRequest} resetPasswordRequest
1515
+ * @param {*} [options] Override http request option.
1516
+ * @throws {RequiredError}
1517
+ */
1518
+ verifyEmail: async (resetPasswordRequest, options = {}) => {
1519
+ // verify required parameter 'resetPasswordRequest' is not null or undefined
1520
+ assertParamExists('verifyEmail', 'resetPasswordRequest', resetPasswordRequest);
1521
+ const localVarPath = `/iam/v1/password/email/verify`;
1522
+ // use dummy base URL string because the URL constructor only accepts absolute URLs.
1523
+ const localVarUrlObj = new URL(localVarPath, DUMMY_BASE_URL);
1524
+ let baseOptions;
1525
+ if (configuration) {
1526
+ baseOptions = configuration.baseOptions;
1527
+ }
1528
+ const localVarRequestOptions = { method: 'POST', ...baseOptions, ...options };
1529
+ const localVarHeaderParameter = {};
1530
+ const localVarQueryParameter = {};
1531
+ // authentication pk required
1532
+ // http bearer authentication required
1533
+ await setBearerAuthToObject(localVarHeaderParameter, configuration);
1534
+ localVarHeaderParameter['Content-Type'] = 'application/json';
1535
+ setSearchParams(localVarUrlObj, localVarQueryParameter);
1536
+ let headersFromBaseOptions = baseOptions && baseOptions.headers ? baseOptions.headers : {};
1537
+ localVarRequestOptions.headers = { ...localVarHeaderParameter, ...headersFromBaseOptions, ...options.headers };
1538
+ localVarRequestOptions.data = serializeDataIfNeeded(resetPasswordRequest, localVarRequestOptions, configuration);
1539
+ return {
1540
+ url: toPathString(localVarUrlObj),
1541
+ options: localVarRequestOptions,
1542
+ };
1543
+ },
1342
1544
  /**
1343
1545
  * The endpoint verifies the token generated by OAuth provider and retrieves a corresponding player. Returns the latest 10 transaction intents for the player.
1344
1546
  * @summary Retrieve player by token.
1345
- * @param {OAuthProvider} provider OAuth provider
1547
+ * @param {AuthProvider} provider OAuth provider
1346
1548
  * @param {OAuthRequest} oAuthRequest
1347
1549
  * @param {*} [options] Override http request option.
1348
1550
  * @deprecated
@@ -1420,7 +1622,7 @@ const AuthenticationApiFp = function (configuration) {
1420
1622
  const localVarAxiosParamCreator = AuthenticationApiAxiosParamCreator(configuration);
1421
1623
  return {
1422
1624
  /**
1423
- *
1625
+ * Deprecated
1424
1626
  * @summary Authenticate player with oauth token.
1425
1627
  * @param {AuthenticateOAuthRequest} authenticateOAuthRequest
1426
1628
  * @param {*} [options] Override http request option.
@@ -1444,7 +1646,7 @@ const AuthenticationApiFp = function (configuration) {
1444
1646
  /**
1445
1647
  * 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.
1446
1648
  * @summary Authorize player with token.
1447
- * @param {OAuthProvider} provider OAuth provider
1649
+ * @param {AuthProvider} provider OAuth provider
1448
1650
  * @param {OAuthRequest} oAuthRequest
1449
1651
  * @param {*} [options] Override http request option.
1450
1652
  * @deprecated
@@ -1465,6 +1667,17 @@ const AuthenticationApiFp = function (configuration) {
1465
1667
  const localVarAxiosArgs = await localVarAxiosParamCreator.getJwks(publishableKey, options);
1466
1668
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1467
1669
  },
1670
+ /**
1671
+ *
1672
+ * @summary Initialize Link OAuth.
1673
+ * @param {OAuthInitRequest} oAuthInitRequest
1674
+ * @param {*} [options] Override http request option.
1675
+ * @throws {RequiredError}
1676
+ */
1677
+ async initLinkOAuth(oAuthInitRequest, options) {
1678
+ const localVarAxiosArgs = await localVarAxiosParamCreator.initLinkOAuth(oAuthInitRequest, options);
1679
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1680
+ },
1468
1681
  /**
1469
1682
  *
1470
1683
  * @summary Initialize OAuth.
@@ -1529,6 +1742,17 @@ const AuthenticationApiFp = function (configuration) {
1529
1742
  const localVarAxiosArgs = await localVarAxiosParamCreator.me(options);
1530
1743
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1531
1744
  },
1745
+ /**
1746
+ *
1747
+ * @summary Initialize OAuth.
1748
+ * @param {string} key
1749
+ * @param {*} [options] Override http request option.
1750
+ * @throws {RequiredError}
1751
+ */
1752
+ async poolOAuth(key, options) {
1753
+ const localVarAxiosArgs = await localVarAxiosParamCreator.poolOAuth(key, options);
1754
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1755
+ },
1532
1756
  /**
1533
1757
  * Get or create a new session for the player based on the refresh token.
1534
1758
  * @summary Refresh or create auth session.
@@ -1540,6 +1764,39 @@ const AuthenticationApiFp = function (configuration) {
1540
1764
  const localVarAxiosArgs = await localVarAxiosParamCreator.refresh(refreshTokenRequest, options);
1541
1765
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1542
1766
  },
1767
+ /**
1768
+ * Start the Email Verification process for a player.
1769
+ * @summary Request an Email Verification.
1770
+ * @param {RequestResetPasswordRequest} requestResetPasswordRequest
1771
+ * @param {*} [options] Override http request option.
1772
+ * @throws {RequiredError}
1773
+ */
1774
+ async requestEmailVerification(requestResetPasswordRequest, options) {
1775
+ const localVarAxiosArgs = await localVarAxiosParamCreator.requestEmailVerification(requestResetPasswordRequest, options);
1776
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1777
+ },
1778
+ /**
1779
+ * Start the Reset process for a player\'s password.
1780
+ * @summary Request a Reset password.
1781
+ * @param {RequestResetPasswordRequest} requestResetPasswordRequest
1782
+ * @param {*} [options] Override http request option.
1783
+ * @throws {RequiredError}
1784
+ */
1785
+ async requestResetPassword(requestResetPasswordRequest, options) {
1786
+ const localVarAxiosArgs = await localVarAxiosParamCreator.requestResetPassword(requestResetPasswordRequest, options);
1787
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1788
+ },
1789
+ /**
1790
+ * Reset a player\'s password.
1791
+ * @summary Reset a password.
1792
+ * @param {ResetPasswordRequest} resetPasswordRequest
1793
+ * @param {*} [options] Override http request option.
1794
+ * @throws {RequiredError}
1795
+ */
1796
+ async resetPassword(resetPasswordRequest, options) {
1797
+ const localVarAxiosArgs = await localVarAxiosParamCreator.resetPassword(resetPasswordRequest, options);
1798
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1799
+ },
1543
1800
  /**
1544
1801
  * Create and authenticate a player based on email and password.
1545
1802
  * @summary Email and password signup.
@@ -1584,10 +1841,21 @@ const AuthenticationApiFp = function (configuration) {
1584
1841
  const localVarAxiosArgs = await localVarAxiosParamCreator.unlinkSIWE(sIWERequest, options);
1585
1842
  return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1586
1843
  },
1844
+ /**
1845
+ * Verify a player\'s email address.
1846
+ * @summary Verify an email.
1847
+ * @param {ResetPasswordRequest} resetPasswordRequest
1848
+ * @param {*} [options] Override http request option.
1849
+ * @throws {RequiredError}
1850
+ */
1851
+ async verifyEmail(resetPasswordRequest, options) {
1852
+ const localVarAxiosArgs = await localVarAxiosParamCreator.verifyEmail(resetPasswordRequest, options);
1853
+ return createRequestFunction(localVarAxiosArgs, globalAxios, BASE_PATH, configuration);
1854
+ },
1587
1855
  /**
1588
1856
  * The endpoint verifies the token generated by OAuth provider and retrieves a corresponding player. Returns the latest 10 transaction intents for the player.
1589
1857
  * @summary Retrieve player by token.
1590
- * @param {OAuthProvider} provider OAuth provider
1858
+ * @param {AuthProvider} provider OAuth provider
1591
1859
  * @param {OAuthRequest} oAuthRequest
1592
1860
  * @param {*} [options] Override http request option.
1593
1861
  * @deprecated
@@ -1618,7 +1886,7 @@ const AuthenticationApiFp = function (configuration) {
1618
1886
  */
1619
1887
  class AuthenticationApi extends BaseAPI {
1620
1888
  /**
1621
- *
1889
+ * Deprecated
1622
1890
  * @summary Authenticate player with oauth token.
1623
1891
  * @param {AuthenticationApiAuthenticateOAuthRequest} requestParameters Request parameters.
1624
1892
  * @param {*} [options] Override http request option.
@@ -1662,6 +1930,17 @@ class AuthenticationApi extends BaseAPI {
1662
1930
  getJwks(requestParameters, options) {
1663
1931
  return AuthenticationApiFp(this.configuration).getJwks(requestParameters.publishableKey, options).then((request) => request(this.axios, this.basePath));
1664
1932
  }
1933
+ /**
1934
+ *
1935
+ * @summary Initialize Link OAuth.
1936
+ * @param {AuthenticationApiInitLinkOAuthRequest} requestParameters Request parameters.
1937
+ * @param {*} [options] Override http request option.
1938
+ * @throws {RequiredError}
1939
+ * @memberof AuthenticationApi
1940
+ */
1941
+ initLinkOAuth(requestParameters, options) {
1942
+ return AuthenticationApiFp(this.configuration).initLinkOAuth(requestParameters.oAuthInitRequest, options).then((request) => request(this.axios, this.basePath));
1943
+ }
1665
1944
  /**
1666
1945
  *
1667
1946
  * @summary Initialize OAuth.
@@ -1726,6 +2005,17 @@ class AuthenticationApi extends BaseAPI {
1726
2005
  me(options) {
1727
2006
  return AuthenticationApiFp(this.configuration).me(options).then((request) => request(this.axios, this.basePath));
1728
2007
  }
2008
+ /**
2009
+ *
2010
+ * @summary Initialize OAuth.
2011
+ * @param {AuthenticationApiPoolOAuthRequest} requestParameters Request parameters.
2012
+ * @param {*} [options] Override http request option.
2013
+ * @throws {RequiredError}
2014
+ * @memberof AuthenticationApi
2015
+ */
2016
+ poolOAuth(requestParameters, options) {
2017
+ return AuthenticationApiFp(this.configuration).poolOAuth(requestParameters.key, options).then((request) => request(this.axios, this.basePath));
2018
+ }
1729
2019
  /**
1730
2020
  * Get or create a new session for the player based on the refresh token.
1731
2021
  * @summary Refresh or create auth session.
@@ -1737,6 +2027,39 @@ class AuthenticationApi extends BaseAPI {
1737
2027
  refresh(requestParameters, options) {
1738
2028
  return AuthenticationApiFp(this.configuration).refresh(requestParameters.refreshTokenRequest, options).then((request) => request(this.axios, this.basePath));
1739
2029
  }
2030
+ /**
2031
+ * Start the Email Verification process for a player.
2032
+ * @summary Request an Email Verification.
2033
+ * @param {AuthenticationApiRequestEmailVerificationRequest} requestParameters Request parameters.
2034
+ * @param {*} [options] Override http request option.
2035
+ * @throws {RequiredError}
2036
+ * @memberof AuthenticationApi
2037
+ */
2038
+ requestEmailVerification(requestParameters, options) {
2039
+ return AuthenticationApiFp(this.configuration).requestEmailVerification(requestParameters.requestResetPasswordRequest, options).then((request) => request(this.axios, this.basePath));
2040
+ }
2041
+ /**
2042
+ * Start the Reset process for a player\'s password.
2043
+ * @summary Request a Reset password.
2044
+ * @param {AuthenticationApiRequestResetPasswordRequest} requestParameters Request parameters.
2045
+ * @param {*} [options] Override http request option.
2046
+ * @throws {RequiredError}
2047
+ * @memberof AuthenticationApi
2048
+ */
2049
+ requestResetPassword(requestParameters, options) {
2050
+ return AuthenticationApiFp(this.configuration).requestResetPassword(requestParameters.requestResetPasswordRequest, options).then((request) => request(this.axios, this.basePath));
2051
+ }
2052
+ /**
2053
+ * Reset a player\'s password.
2054
+ * @summary Reset a password.
2055
+ * @param {AuthenticationApiResetPasswordRequest} requestParameters Request parameters.
2056
+ * @param {*} [options] Override http request option.
2057
+ * @throws {RequiredError}
2058
+ * @memberof AuthenticationApi
2059
+ */
2060
+ resetPassword(requestParameters, options) {
2061
+ return AuthenticationApiFp(this.configuration).resetPassword(requestParameters.resetPasswordRequest, options).then((request) => request(this.axios, this.basePath));
2062
+ }
1740
2063
  /**
1741
2064
  * Create and authenticate a player based on email and password.
1742
2065
  * @summary Email and password signup.
@@ -1781,6 +2104,17 @@ class AuthenticationApi extends BaseAPI {
1781
2104
  unlinkSIWE(requestParameters, options) {
1782
2105
  return AuthenticationApiFp(this.configuration).unlinkSIWE(requestParameters.sIWERequest, options).then((request) => request(this.axios, this.basePath));
1783
2106
  }
2107
+ /**
2108
+ * Verify a player\'s email address.
2109
+ * @summary Verify an email.
2110
+ * @param {AuthenticationApiVerifyEmailRequest} requestParameters Request parameters.
2111
+ * @param {*} [options] Override http request option.
2112
+ * @throws {RequiredError}
2113
+ * @memberof AuthenticationApi
2114
+ */
2115
+ verifyEmail(requestParameters, options) {
2116
+ return AuthenticationApiFp(this.configuration).verifyEmail(requestParameters.resetPasswordRequest, options).then((request) => request(this.axios, this.basePath));
2117
+ }
1784
2118
  /**
1785
2119
  * The endpoint verifies the token generated by OAuth provider and retrieves a corresponding player. Returns the latest 10 transaction intents for the player.
1786
2120
  * @summary Retrieve player by token.
@@ -2722,6 +3056,1446 @@ class SDKConfiguration {
2722
3056
  }
2723
3057
  }
2724
3058
 
3059
+ const chain$m = {
3060
+ chain: 'BSC',
3061
+ chainId: 56,
3062
+ explorers: [
3063
+ {
3064
+ name: 'bscscan',
3065
+ url: 'https://bscscan.com',
3066
+ standard: 'EIP3091',
3067
+ },
3068
+ {
3069
+ name: 'dexguru',
3070
+ url: 'https://bnb.dex.guru',
3071
+ standard: 'EIP3091',
3072
+ icon: {
3073
+ url: 'ipfs://QmRaASKRSjQ5btoUQ2rNTJNxKtx2a2RoewgA7DMQkLVEne',
3074
+ width: 83,
3075
+ height: 82,
3076
+ format: 'svg',
3077
+ },
3078
+ },
3079
+ ],
3080
+ faucets: [],
3081
+ features: [],
3082
+ icon: {
3083
+ url: 'ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/binance-coin/512.png',
3084
+ width: 512,
3085
+ height: 512,
3086
+ format: 'png',
3087
+ },
3088
+ infoURL: 'https://www.bnbchain.org/en',
3089
+ name: 'BNB Smart Chain Mainnet',
3090
+ nativeCurrency: {
3091
+ name: 'BNB Chain Native Token',
3092
+ symbol: 'BNB',
3093
+ decimals: 18,
3094
+ },
3095
+ networkId: 56,
3096
+ redFlags: [],
3097
+ rpc: [
3098
+ 'https://bsc.publicnode.com',
3099
+ 'https://bsc-dataseed1.bnbchain.org',
3100
+ 'https://bsc-dataseed2.bnbchain.org',
3101
+ 'https://bsc-dataseed3.bnbchain.org',
3102
+ 'https://bsc-dataseed4.bnbchain.org',
3103
+ 'https://bsc-dataseed1.defibit.io',
3104
+ 'https://bsc-dataseed2.defibit.io',
3105
+ 'https://bsc-dataseed3.defibit.io',
3106
+ 'https://bsc-dataseed4.defibit.io',
3107
+ 'https://bsc-dataseed1.ninicoin.io',
3108
+ 'https://bsc-dataseed2.ninicoin.io',
3109
+ 'https://bsc-dataseed3.ninicoin.io',
3110
+ 'https://bsc-dataseed4.ninicoin.io',
3111
+ 'wss://bsc.publicnode.com',
3112
+ 'wss://bsc-ws-node.nariox.org',
3113
+ ],
3114
+ shortName: 'bnb',
3115
+ slip44: 714,
3116
+ slug: 'binance',
3117
+ testnet: false,
3118
+ };
3119
+
3120
+ const chain$l = {
3121
+ chain: 'BSC',
3122
+ chainId: 97,
3123
+ explorers: [
3124
+ {
3125
+ name: 'bscscan-testnet',
3126
+ url: 'https://testnet.bscscan.com',
3127
+ standard: 'EIP3091',
3128
+ },
3129
+ ],
3130
+ faucets: ['https://testnet.bnbchain.org/faucet-smart'],
3131
+ features: [],
3132
+ icon: {
3133
+ url: 'ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/binance-coin/512.png',
3134
+ width: 512,
3135
+ height: 512,
3136
+ format: 'png',
3137
+ },
3138
+ infoURL: 'https://www.bnbchain.org/en',
3139
+ name: 'BNB Smart Chain Testnet',
3140
+ nativeCurrency: {
3141
+ name: 'BNB Chain Native Token',
3142
+ symbol: 'tBNB',
3143
+ decimals: 18,
3144
+ },
3145
+ networkId: 97,
3146
+ redFlags: [],
3147
+ rpc: [
3148
+ 'https://bsc-testnet.publicnode.com',
3149
+ 'https://data-seed-prebsc-1-s1.bnbchain.org:8545',
3150
+ 'https://data-seed-prebsc-2-s1.bnbchain.org:8545',
3151
+ 'https://data-seed-prebsc-1-s2.bnbchain.org:8545',
3152
+ 'https://data-seed-prebsc-2-s2.bnbchain.org:8545',
3153
+ 'https://data-seed-prebsc-1-s3.bnbchain.org:8545',
3154
+ 'https://data-seed-prebsc-2-s3.bnbchain.org:8545',
3155
+ ],
3156
+ shortName: 'bnbt',
3157
+ slug: 'binance-testnet',
3158
+ testnet: true,
3159
+ };
3160
+
3161
+ const chain$k = {
3162
+ name: 'Base',
3163
+ chain: 'ETH',
3164
+ rpc: [
3165
+ 'https://mainnet.base.org',
3166
+ ],
3167
+ faucets: [],
3168
+ nativeCurrency: {
3169
+ name: 'Ether',
3170
+ symbol: 'ETH',
3171
+ decimals: 18,
3172
+ },
3173
+ infoURL: 'https://base.org',
3174
+ shortName: 'base',
3175
+ chainId: 8453,
3176
+ networkId: 8453,
3177
+ icon: {
3178
+ url: 'ipfs://QmW5Vn15HeRkScMfPcW12ZdZcC2yUASpu6eCsECRdEmjjj/base-512.png',
3179
+ height: 512,
3180
+ width: 512,
3181
+ format: 'png',
3182
+ },
3183
+ explorers: [
3184
+ {
3185
+ name: 'basescout',
3186
+ url: 'https://base.blockscout.com',
3187
+ icon: {
3188
+ url: 'ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM',
3189
+ width: 551,
3190
+ height: 540,
3191
+ format: 'png',
3192
+ },
3193
+ standard: 'EIP3091',
3194
+ },
3195
+ {
3196
+ name: 'basescan',
3197
+ url: 'https://basescan.org',
3198
+ standard: 'none',
3199
+ },
3200
+ ],
3201
+ status: 'active',
3202
+ testnet: false,
3203
+ slug: 'base',
3204
+ };
3205
+
3206
+ const chain$j = {
3207
+ chain: 'ETH',
3208
+ chainId: 84532,
3209
+ explorers: [
3210
+ {
3211
+ name: 'basescout',
3212
+ url: 'https://base-sepolia.blockscout.com',
3213
+ standard: 'EIP3091',
3214
+ icon: {
3215
+ url: 'ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM',
3216
+ width: 551,
3217
+ height: 540,
3218
+ format: 'png',
3219
+ },
3220
+ },
3221
+ ],
3222
+ faucets: [],
3223
+ icon: {
3224
+ url: 'ipfs://QmaxRoHpxZd8PqccAynherrMznMufG6sdmHZLihkECXmZv',
3225
+ width: 1200,
3226
+ height: 1200,
3227
+ format: 'png',
3228
+ },
3229
+ infoURL: 'https://base.org',
3230
+ name: 'Base Sepolia Testnet',
3231
+ nativeCurrency: {
3232
+ name: 'Sepolia Ether',
3233
+ symbol: 'ETH',
3234
+ decimals: 18,
3235
+ },
3236
+ networkId: 84532,
3237
+ rpc: [
3238
+ 'https://sepolia.base.org',
3239
+ ],
3240
+ shortName: 'basesep',
3241
+ slug: 'base-sepolia-testnet',
3242
+ testnet: true,
3243
+ };
3244
+
3245
+ const chain$i = {
3246
+ name: 'Beam',
3247
+ chainId: 4337,
3248
+ chain: 'BEAM',
3249
+ shortName: 'Beam',
3250
+ slug: 'beam',
3251
+ icon: {
3252
+ url: 'ipfs://QmQJ21NWyGGDraicVEzS1Uqq1yXahM9NCuNZgnfYvtspdt',
3253
+ height: 512,
3254
+ width: 512,
3255
+ format: 'png',
3256
+ },
3257
+ features: [
3258
+ {
3259
+ name: 'EIP1559',
3260
+ },
3261
+ ],
3262
+ nativeCurrency: {
3263
+ name: 'Beam',
3264
+ symbol: 'BEAM',
3265
+ decimals: 18,
3266
+ },
3267
+ rpc: [
3268
+ 'https://eu.build.onbeam.com/rpc/14bfbcc5-49c1-40e8-82c2-025c9a1834e1',
3269
+ ],
3270
+ faucets: ['https://faucet.onbeam.com'],
3271
+ explorers: [
3272
+ {
3273
+ name: 'Beam Explorer',
3274
+ url: 'https://subnets.avax.network/beam/',
3275
+ standard: 'EIP3091',
3276
+ },
3277
+ ],
3278
+ infoURL: 'https://gaming.meritcircle.io/',
3279
+ testnet: false,
3280
+ };
3281
+
3282
+ const chain$h = {
3283
+ name: 'Beam Testnet',
3284
+ chainId: 13337,
3285
+ chain: 'BEAM',
3286
+ shortName: 'Beam Testnet',
3287
+ slug: 'beam-testnet',
3288
+ features: [
3289
+ {
3290
+ name: 'EIP1559',
3291
+ },
3292
+ ],
3293
+ icon: {
3294
+ url: 'ipfs://QmQJ21NWyGGDraicVEzS1Uqq1yXahM9NCuNZgnfYvtspdt',
3295
+ height: 512,
3296
+ width: 512,
3297
+ format: 'png',
3298
+ },
3299
+ nativeCurrency: {
3300
+ name: 'Beam',
3301
+ symbol: 'BEAM',
3302
+ decimals: 18,
3303
+ },
3304
+ rpc: [
3305
+ 'https://eu.build.onbeam.com/rpc/testnet/14bfbcc5-49c1-40e8-82c2-025c9a1834e1',
3306
+ ],
3307
+ faucets: ['https://faucet.avax.network/?subnet=beam', 'https://faucet.onbeam.com'],
3308
+ explorers: [
3309
+ {
3310
+ name: 'Beam Explorer',
3311
+ url: 'https://subnets-test.avax.network/beam',
3312
+ standard: 'EIP3091',
3313
+ },
3314
+ ],
3315
+ infoURL: 'https://www.onbeam.com',
3316
+ testnet: true,
3317
+ };
3318
+
3319
+ const chain$g = {
3320
+ chain: 'AVAX',
3321
+ chainId: 43113,
3322
+ explorers: [
3323
+ {
3324
+ name: 'snowtrace',
3325
+ url: 'https://testnet.snowtrace.io',
3326
+ standard: 'EIP3091',
3327
+ },
3328
+ ],
3329
+ faucets: ['https://faucet.avax-test.network/'],
3330
+ features: [],
3331
+ icon: {
3332
+ url: 'ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/avalanche/512.png',
3333
+ width: 512,
3334
+ height: 512,
3335
+ format: 'png',
3336
+ },
3337
+ infoURL: 'https://cchain.explorer.avax-test.network',
3338
+ name: 'Avalanche Fuji Testnet',
3339
+ nativeCurrency: {
3340
+ name: 'Avalanche',
3341
+ symbol: 'AVAX',
3342
+ decimals: 18,
3343
+ },
3344
+ networkId: 43113,
3345
+ redFlags: [],
3346
+ rpc: [
3347
+ 'https://api.avax-test.network/ext/bc/C/rpc',
3348
+ 'https://avalanche-fuji-c-chain.publicnode.com',
3349
+ ],
3350
+ shortName: 'Fuji',
3351
+ slug: 'avalanche-fuji',
3352
+ testnet: true,
3353
+ };
3354
+
3355
+ const chain$f = {
3356
+ chain: 'AVAX',
3357
+ chainId: 43114,
3358
+ explorers: [
3359
+ {
3360
+ name: 'snowtrace',
3361
+ url: 'https://snowtrace.io',
3362
+ standard: 'EIP3091',
3363
+ },
3364
+ ],
3365
+ faucets: [],
3366
+ features: [
3367
+ {
3368
+ name: 'EIP1559',
3369
+ },
3370
+ ],
3371
+ icon: {
3372
+ url: 'ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/avalanche/512.png',
3373
+ width: 512,
3374
+ height: 512,
3375
+ format: 'png',
3376
+ },
3377
+ infoURL: 'https://www.avax.network/',
3378
+ name: 'Avalanche C-Chain',
3379
+ nativeCurrency: {
3380
+ name: 'Avalanche',
3381
+ symbol: 'AVAX',
3382
+ decimals: 18,
3383
+ },
3384
+ networkId: 43114,
3385
+ redFlags: [],
3386
+ rpc: [
3387
+ 'https://api.avax.network/ext/bc/C/rpc',
3388
+ 'https://avalanche-c-chain.publicnode.com',
3389
+ ],
3390
+ shortName: 'avax',
3391
+ slip44: 9005,
3392
+ slug: 'avalanche',
3393
+ testnet: false,
3394
+ };
3395
+
3396
+ const chain$e = {
3397
+ chain: 'ETH',
3398
+ chainId: 11155111,
3399
+ explorers: [
3400
+ {
3401
+ name: 'etherscan-sepolia',
3402
+ url: 'https://sepolia.etherscan.io',
3403
+ standard: 'EIP3091',
3404
+ },
3405
+ {
3406
+ name: 'otterscan-sepolia',
3407
+ url: 'https://sepolia.otterscan.io',
3408
+ standard: 'EIP3091',
3409
+ },
3410
+ ],
3411
+ faucets: ['http://fauceth.komputing.org?chain=11155111'],
3412
+ features: [],
3413
+ icon: {
3414
+ url: 'ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/ethereum/512.png',
3415
+ width: 512,
3416
+ height: 512,
3417
+ format: 'png',
3418
+ },
3419
+ infoURL: 'https://sepolia.otterscan.io',
3420
+ name: 'Sepolia',
3421
+ nativeCurrency: {
3422
+ name: 'Sepolia Ether',
3423
+ symbol: 'ETH',
3424
+ decimals: 18,
3425
+ },
3426
+ networkId: 11155111,
3427
+ redFlags: [],
3428
+ rpc: [
3429
+ 'https://rpc.sepolia.org',
3430
+ 'https://rpc2.sepolia.org',
3431
+ 'https://rpc-sepolia.rockx.com',
3432
+ 'https://rpc.sepolia.ethpandaops.io',
3433
+ 'https://sepolia.gateway.tenderly.co',
3434
+ 'https://ethereum-sepolia.publicnode.com',
3435
+ ],
3436
+ shortName: 'sep',
3437
+ slug: 'sepolia',
3438
+ testnet: true,
3439
+ title: 'Ethereum Testnet Sepolia',
3440
+ };
3441
+
3442
+ const chain$d = {
3443
+ chain: 'ETH',
3444
+ chainId: 59140,
3445
+ explorers: [
3446
+ {
3447
+ name: 'Etherscan',
3448
+ url: 'https://goerli.lineascan.build',
3449
+ standard: 'EIP3091',
3450
+ icon: {
3451
+ url: 'ipfs://QmURjritnHL7a8TwZgsFwp3f272DJmG5paaPtWDZ98QZwH',
3452
+ width: 97,
3453
+ height: 102,
3454
+ format: 'svg',
3455
+ },
3456
+ },
3457
+ {
3458
+ name: 'Blockscout',
3459
+ url: 'https://explorer.goerli.linea.build',
3460
+ standard: 'EIP3091',
3461
+ icon: {
3462
+ url: 'ipfs://QmURjritnHL7a8TwZgsFwp3f272DJmG5paaPtWDZ98QZwH',
3463
+ width: 97,
3464
+ height: 102,
3465
+ format: 'svg',
3466
+ },
3467
+ },
3468
+ ],
3469
+ faucets: ['https://faucetlink.to/goerli'],
3470
+ icon: {
3471
+ url: 'ipfs://QmURjritnHL7a8TwZgsFwp3f272DJmG5paaPtWDZ98QZwH',
3472
+ width: 97,
3473
+ height: 102,
3474
+ format: 'svg',
3475
+ },
3476
+ infoURL: 'https://linea.build',
3477
+ name: 'Linea Testnet',
3478
+ nativeCurrency: {
3479
+ name: 'Linea Ether',
3480
+ symbol: 'ETH',
3481
+ decimals: 18,
3482
+ },
3483
+ networkId: 59140,
3484
+ parent: {
3485
+ type: 'L2',
3486
+ chain: 'eip155-5',
3487
+ bridges: [
3488
+ {
3489
+ url: 'https://goerli.hop.exchange/#/send?token=ETH&sourceNetwork=ethereum&destNetwork=linea',
3490
+ },
3491
+ ],
3492
+ },
3493
+ rpc: [
3494
+ 'https://rpc.goerli.linea.build',
3495
+ 'wss://rpc.goerli.linea.build',
3496
+ ],
3497
+ shortName: 'linea-testnet',
3498
+ slug: 'linea-testnet',
3499
+ status: 'active',
3500
+ testnet: true,
3501
+ title: 'Linea Goerli Testnet',
3502
+ };
3503
+
3504
+ const chain$c = {
3505
+ chain: 'GNO',
3506
+ chainId: 10200,
3507
+ explorers: [
3508
+ {
3509
+ name: 'blockscout',
3510
+ url: 'https://gnosis-chiado.blockscout.com',
3511
+ standard: 'EIP3091',
3512
+ icon: {
3513
+ url: 'ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM',
3514
+ width: 551,
3515
+ height: 540,
3516
+ format: 'png',
3517
+ },
3518
+ },
3519
+ ],
3520
+ faucets: ['https://gnosisfaucet.com'],
3521
+ icon: {
3522
+ url: 'ipfs://bafybeidk4swpgdyqmpz6shd5onvpaujvwiwthrhypufnwr6xh3dausz2dm',
3523
+ width: 1800,
3524
+ height: 1800,
3525
+ format: 'png',
3526
+ },
3527
+ infoURL: 'https://docs.gnosischain.com',
3528
+ name: 'Gnosis Chiado Testnet',
3529
+ nativeCurrency: {
3530
+ name: 'Chiado xDAI',
3531
+ symbol: 'XDAI',
3532
+ decimals: 18,
3533
+ },
3534
+ networkId: 10200,
3535
+ rpc: [
3536
+ 'https://rpc.chiadochain.net',
3537
+ 'https://rpc.chiado.gnosis.gateway.fm',
3538
+ 'wss://rpc.chiadochain.net/wss',
3539
+ 'https://gnosis-chiado-rpc.publicnode.com',
3540
+ 'wss://gnosis-chiado-rpc.publicnode.com',
3541
+ 'https://gnosis-chiado.drpc.org',
3542
+ 'wss://gnosis-chiado.drpc.org',
3543
+ ],
3544
+ shortName: 'chi',
3545
+ slip44: 1,
3546
+ slug: 'gnosis-chiado-testnet',
3547
+ testnet: true,
3548
+ };
3549
+
3550
+ const chain$b = {
3551
+ chain: 'Immutable zkEVM',
3552
+ chainId: 13371,
3553
+ explorers: [
3554
+ {
3555
+ name: 'Immutable explorer',
3556
+ url: 'https://explorer.immutable.com',
3557
+ standard: 'EIP3091',
3558
+ icon: {
3559
+ url: 'ipfs://QmXFUYFW4e6wifbU9LKVq7owM14bnE6ZbbYq3bn1jBP3Mw',
3560
+ width: 1168,
3561
+ height: 1168,
3562
+ format: 'png',
3563
+ },
3564
+ },
3565
+ ],
3566
+ faucets: ['https://docs.immutable.com/docs/zkEVM/guides/faucet'],
3567
+ icon: {
3568
+ url: 'ipfs://QmXFUYFW4e6wifbU9LKVq7owM14bnE6ZbbYq3bn1jBP3Mw',
3569
+ width: 1168,
3570
+ height: 1168,
3571
+ format: 'png',
3572
+ },
3573
+ infoURL: 'https://www.immutable.com',
3574
+ name: 'Immutable zkEVM',
3575
+ nativeCurrency: {
3576
+ name: 'IMX',
3577
+ symbol: 'IMX',
3578
+ decimals: 18,
3579
+ },
3580
+ networkId: 13371,
3581
+ rpc: [
3582
+ 'https://rpc.immutable.com',
3583
+ 'https://immutable-zkevm.drpc.org',
3584
+ 'wss://immutable-zkevm.drpc.org',
3585
+ ],
3586
+ shortName: 'imx',
3587
+ slug: 'immutable-zkevm',
3588
+ testnet: false,
3589
+ };
3590
+
3591
+ const chain$a = {
3592
+ chain: 'ETH',
3593
+ chainId: 421614,
3594
+ explorers: [
3595
+ {
3596
+ name: 'Arbitrum Sepolia Rollup Testnet Explorer',
3597
+ url: 'https://sepolia-explorer.arbitrum.io',
3598
+ standard: 'EIP3091',
3599
+ },
3600
+ ],
3601
+ faucets: [],
3602
+ infoURL: 'https://arbitrum.io',
3603
+ name: 'Arbitrum Sepolia',
3604
+ nativeCurrency: {
3605
+ name: 'Sepolia Ether',
3606
+ symbol: 'ETH',
3607
+ decimals: 18,
3608
+ },
3609
+ networkId: 421614,
3610
+ parent: {
3611
+ type: 'L2',
3612
+ chain: 'eip155-11155111',
3613
+ bridges: [
3614
+ {
3615
+ url: 'https://bridge.arbitrum.io',
3616
+ },
3617
+ ],
3618
+ },
3619
+ rpc: [
3620
+ 'https://sepolia-rollup.arbitrum.io/rpc',
3621
+ ],
3622
+ shortName: 'arb-sep',
3623
+ slug: 'arbitrum-sepolia',
3624
+ testnet: true,
3625
+ title: 'Arbitrum Sepolia Rollup Testnet',
3626
+ };
3627
+
3628
+ const chain$9 = {
3629
+ chain: 'ETH',
3630
+ chainId: 42161,
3631
+ explorers: [
3632
+ {
3633
+ name: 'Arbiscan',
3634
+ url: 'https://arbiscan.io',
3635
+ standard: 'EIP3091',
3636
+ },
3637
+ {
3638
+ name: 'Arbitrum Explorer',
3639
+ url: 'https://explorer.arbitrum.io',
3640
+ standard: 'EIP3091',
3641
+ },
3642
+ {
3643
+ name: 'dexguru',
3644
+ url: 'https://arbitrum.dex.guru',
3645
+ standard: 'EIP3091',
3646
+ icon: {
3647
+ url: 'ipfs://QmRaASKRSjQ5btoUQ2rNTJNxKtx2a2RoewgA7DMQkLVEne',
3648
+ width: 83,
3649
+ height: 82,
3650
+ format: 'svg',
3651
+ },
3652
+ },
3653
+ ],
3654
+ faucets: [],
3655
+ features: [],
3656
+ icon: {
3657
+ url: 'ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/arbitrum/512.png',
3658
+ width: 512,
3659
+ height: 512,
3660
+ format: 'png',
3661
+ },
3662
+ infoURL: 'https://arbitrum.io',
3663
+ name: 'Arbitrum One',
3664
+ nativeCurrency: {
3665
+ name: 'Ether',
3666
+ symbol: 'ETH',
3667
+ decimals: 18,
3668
+ },
3669
+ networkId: 42161,
3670
+ parent: {
3671
+ type: 'L2',
3672
+ chain: 'eip155-1',
3673
+ bridges: [
3674
+ {
3675
+ url: 'https://bridge.arbitrum.io',
3676
+ },
3677
+ ],
3678
+ },
3679
+ redFlags: [],
3680
+ rpc: [
3681
+ 'https://arb1.arbitrum.io/rpc',
3682
+ 'https://arbitrum-one.publicnode.com',
3683
+ 'wss://arbitrum-one.publicnode.com',
3684
+ ],
3685
+ shortName: 'arb1',
3686
+ slug: 'arbitrum',
3687
+ testnet: false,
3688
+ };
3689
+
3690
+ const chain$8 = {
3691
+ chain: 'ETH',
3692
+ chainId: 42170,
3693
+ explorers: [
3694
+ {
3695
+ name: 'Arbitrum Nova Chain Explorer',
3696
+ url: 'https://nova-explorer.arbitrum.io',
3697
+ standard: 'EIP3091',
3698
+ icon: {
3699
+ url: 'ipfs://QmYtUimyqHkkFxYdbXXRbUqNg2VLPUg6Uu2C2nmFWowiZM',
3700
+ width: 551,
3701
+ height: 540,
3702
+ format: 'png',
3703
+ },
3704
+ },
3705
+ {
3706
+ name: 'dexguru',
3707
+ url: 'https://nova.dex.guru',
3708
+ standard: 'EIP3091',
3709
+ icon: {
3710
+ url: 'ipfs://QmRaASKRSjQ5btoUQ2rNTJNxKtx2a2RoewgA7DMQkLVEne',
3711
+ width: 83,
3712
+ height: 82,
3713
+ format: 'svg',
3714
+ },
3715
+ },
3716
+ ],
3717
+ faucets: [],
3718
+ infoURL: 'https://arbitrum.io',
3719
+ name: 'Arbitrum Nova',
3720
+ nativeCurrency: {
3721
+ name: 'Ether',
3722
+ symbol: 'ETH',
3723
+ decimals: 18,
3724
+ },
3725
+ networkId: 42170,
3726
+ parent: {
3727
+ type: 'L2',
3728
+ chain: 'eip155-1',
3729
+ bridges: [
3730
+ {
3731
+ url: 'https://bridge.arbitrum.io',
3732
+ },
3733
+ ],
3734
+ },
3735
+ rpc: [
3736
+ 'https://nova.arbitrum.io/rpc',
3737
+ 'https://arbitrum-nova.publicnode.com',
3738
+ 'wss://arbitrum-nova.publicnode.com',
3739
+ ],
3740
+ shortName: 'arb-nova',
3741
+ slug: 'arbitrum-nova',
3742
+ testnet: false,
3743
+ };
3744
+
3745
+ const chain$7 = {
3746
+ chain: 'Polygon',
3747
+ chainId: 137,
3748
+ explorers: [
3749
+ {
3750
+ name: 'polygonscan',
3751
+ url: 'https://polygonscan.com',
3752
+ standard: 'EIP3091',
3753
+ },
3754
+ {
3755
+ name: 'dexguru',
3756
+ url: 'https://polygon.dex.guru',
3757
+ standard: 'EIP3091',
3758
+ icon: {
3759
+ url: 'ipfs://QmRaASKRSjQ5btoUQ2rNTJNxKtx2a2RoewgA7DMQkLVEne',
3760
+ width: 83,
3761
+ height: 82,
3762
+ format: 'svg',
3763
+ },
3764
+ },
3765
+ ],
3766
+ faucets: [],
3767
+ features: [],
3768
+ icon: {
3769
+ url: 'ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/polygon/512.png',
3770
+ width: 512,
3771
+ height: 512,
3772
+ format: 'png',
3773
+ },
3774
+ infoURL: 'https://polygon.technology/',
3775
+ name: 'Polygon Mainnet',
3776
+ nativeCurrency: {
3777
+ name: 'MATIC',
3778
+ symbol: 'MATIC',
3779
+ decimals: 18,
3780
+ },
3781
+ networkId: 137,
3782
+ redFlags: [],
3783
+ rpc: [
3784
+ 'https://polygon-rpc.com',
3785
+ 'https://rpc-mainnet.matic.network',
3786
+ 'https://matic-mainnet.chainstacklabs.com',
3787
+ 'https://rpc-mainnet.maticvigil.com',
3788
+ 'https://rpc-mainnet.matic.quiknode.pro',
3789
+ 'https://matic-mainnet-full-rpc.bwarelabs.com',
3790
+ 'https://polygon-bor.publicnode.com',
3791
+ 'wss://polygon-bor.publicnode.com',
3792
+ 'https://polygon.gateway.tenderly.co',
3793
+ 'wss://polygon.gateway.tenderly.co',
3794
+ ],
3795
+ shortName: 'matic',
3796
+ slip44: 966,
3797
+ slug: 'polygon',
3798
+ testnet: false,
3799
+ };
3800
+
3801
+ const chain$6 = {
3802
+ chain: 'Polygon',
3803
+ chainId: 80002,
3804
+ explorers: [
3805
+ {
3806
+ name: 'polygonamoy',
3807
+ url: 'https://www.oklink.com/amoy',
3808
+ standard: 'EIP3091',
3809
+ },
3810
+ ],
3811
+ faucets: ['https://faucet.polygon.technology/'],
3812
+ features: [],
3813
+ icon: {
3814
+ url: 'ipfs://QmcxZHpyJa8T4i63xqjPYrZ6tKrt55tZJpbXcjSDKuKaf9/polygon/512.png',
3815
+ width: 512,
3816
+ height: 512,
3817
+ format: 'png',
3818
+ },
3819
+ infoURL: 'https://polygon.technology/',
3820
+ name: 'Polygon Amoy Testnet',
3821
+ nativeCurrency: {
3822
+ name: 'MATIC',
3823
+ symbol: 'MATIC',
3824
+ decimals: 18,
3825
+ },
3826
+ networkId: 80002,
3827
+ redFlags: [],
3828
+ rpc: [
3829
+ 'https://rpc-amoy.polygon.technology',
3830
+ ],
3831
+ shortName: 'polygonamoy',
3832
+ slip44: 1,
3833
+ slug: 'polygon-amoy-testnet',
3834
+ testnet: true,
3835
+ title: 'Polygon Amoy Testnet',
3836
+ };
3837
+
3838
+ const chain$5 = {
3839
+ chain: 'Ancient8',
3840
+ chainId: 28122024,
3841
+ explorers: [
3842
+ {
3843
+ name: 'scan-testnet',
3844
+ url: 'https://scanv2-testnet.ancient8.gg',
3845
+ standard: 'EIP3091',
3846
+ },
3847
+ ],
3848
+ faucets: [],
3849
+ icon: {
3850
+ url: 'ipfs://bafkreievnqg3xjokaty4kfbxxbrzm5v5y7exbaaia2txrh4sfgrqsalfym',
3851
+ width: 128,
3852
+ height: 128,
3853
+ format: 'png',
3854
+ },
3855
+ infoURL: 'https://ancient8.gg/',
3856
+ name: 'Ancient8 Testnet',
3857
+ nativeCurrency: {
3858
+ name: 'Ether',
3859
+ symbol: 'ETH',
3860
+ decimals: 18,
3861
+ },
3862
+ networkId: 28122024,
3863
+ rpc: ['https://rpcv2-testnet.ancient8.gg'],
3864
+ shortName: 'a8',
3865
+ slip44: 1,
3866
+ slug: 'ancient8-testnet',
3867
+ testnet: true,
3868
+ };
3869
+
3870
+ const chain$4 = {
3871
+ chain: 'Ancient8',
3872
+ chainId: 888888888,
3873
+ explorers: [
3874
+ {
3875
+ name: 'Ancient8 Explorer',
3876
+ url: 'https://scan.ancient8.gg',
3877
+ standard: 'EIP3091',
3878
+ },
3879
+ ],
3880
+ faucets: [],
3881
+ icon: {
3882
+ url: 'ipfs://bafkreievnqg3xjokaty4kfbxxbrzm5v5y7exbaaia2txrh4sfgrqsalfym',
3883
+ width: 128,
3884
+ height: 128,
3885
+ format: 'png',
3886
+ },
3887
+ infoURL: 'https://ancient8.gg/',
3888
+ name: 'Ancient8',
3889
+ nativeCurrency: {
3890
+ name: 'Ether',
3891
+ symbol: 'ETH',
3892
+ decimals: 18,
3893
+ },
3894
+ networkId: 888888888,
3895
+ rpc: ['https://rpc.ancient8.gg'],
3896
+ shortName: 'ancient8',
3897
+ slug: 'ancient8',
3898
+ testnet: false,
3899
+ };
3900
+
3901
+ const chain$3 = {
3902
+ chain: 'ETH',
3903
+ chainId: 999999999,
3904
+ explorers: [
3905
+ {
3906
+ name: 'Zora Sepolia Testnet Network Explorer',
3907
+ url: 'https://sepolia.explorer.zora.energy',
3908
+ standard: 'EIP3091',
3909
+ },
3910
+ ],
3911
+ faucets: [],
3912
+ icon: {
3913
+ url: 'ipfs://bafkreifvrly5tgd34xqeo67s4etmiu52bkroml7uy7eosizf57htf5nrzq',
3914
+ width: 250,
3915
+ height: 250,
3916
+ format: 'png',
3917
+ },
3918
+ infoURL: 'https://zora.energy',
3919
+ name: 'Zora Sepolia Testnet',
3920
+ nativeCurrency: {
3921
+ name: 'Sepolia Ether',
3922
+ symbol: 'ETH',
3923
+ decimals: 18,
3924
+ },
3925
+ networkId: 999999999,
3926
+ rpc: ['https://sepolia.rpc.zora.energy'],
3927
+ shortName: 'zsep',
3928
+ slip44: 1,
3929
+ slug: 'zora-sepolia-testnet',
3930
+ testnet: true,
3931
+ };
3932
+
3933
+ const chain$2 = {
3934
+ chain: 'ETH',
3935
+ chainId: 7777777,
3936
+ explorers: [
3937
+ {
3938
+ name: 'Zora Network Explorer',
3939
+ url: 'https://explorer.zora.energy',
3940
+ standard: 'EIP3091',
3941
+ },
3942
+ ],
3943
+ faucets: [],
3944
+ features: [],
3945
+ icon: {
3946
+ url: 'ipfs://QmZ6qaRwTPFEZUspwMUjaxC6KhmzcELdRQcQzS3P72Dzts/Vector.svg',
3947
+ width: 512,
3948
+ height: 512,
3949
+ format: 'svg',
3950
+ },
3951
+ infoURL: 'https://zora.energy',
3952
+ name: 'Zora',
3953
+ nativeCurrency: {
3954
+ name: 'Ether',
3955
+ symbol: 'ETH',
3956
+ decimals: 18,
3957
+ },
3958
+ networkId: 7777777,
3959
+ redFlags: [],
3960
+ rpc: ['https://rpc.zora.energy/'],
3961
+ shortName: 'zora',
3962
+ slug: 'zora',
3963
+ testnet: false,
3964
+ };
3965
+
3966
+ const chain$1 = {
3967
+ chain: 'Degen',
3968
+ chainId: 666666666,
3969
+ explorers: [],
3970
+ faucets: [],
3971
+ icon: {
3972
+ url: 'ipfs://Qmb6yAe4wXeBkxjfhxzoUT9TzETcmE7Vne59etm9GJaQf7',
3973
+ width: 789,
3974
+ height: 668,
3975
+ format: 'svg',
3976
+ },
3977
+ infoURL: 'https://degen.tips',
3978
+ name: 'Degen Chain',
3979
+ nativeCurrency: {
3980
+ name: 'DEGEN',
3981
+ symbol: 'DEGEN',
3982
+ decimals: 18,
3983
+ },
3984
+ networkId: 666666666,
3985
+ rpc: ['https://rpc.degen.tips'],
3986
+ shortName: 'degen-chain',
3987
+ slug: 'degen-chain',
3988
+ status: 'incubating',
3989
+ testnet: false,
3990
+ title: 'Degen Chain',
3991
+ };
3992
+
3993
+ const chain = {
3994
+ chain: 'Immutable zkEVM',
3995
+ chainId: 13473,
3996
+ explorers: [
3997
+ {
3998
+ name: 'Immutable Testnet explorer',
3999
+ url: 'https://explorer.testnet.immutable.com',
4000
+ standard: 'EIP3091',
4001
+ icon: {
4002
+ url: 'ipfs://QmXFUYFW4e6wifbU9LKVq7owM14bnE6ZbbYq3bn1jBP3Mw',
4003
+ width: 1168,
4004
+ height: 1168,
4005
+ format: 'png',
4006
+ },
4007
+ },
4008
+ ],
4009
+ faucets: ['https://docs.immutable.com/docs/zkEVM/guides/faucet'],
4010
+ icon: {
4011
+ url: 'ipfs://QmXFUYFW4e6wifbU9LKVq7owM14bnE6ZbbYq3bn1jBP3Mw',
4012
+ width: 1168,
4013
+ height: 1168,
4014
+ format: 'png',
4015
+ },
4016
+ infoURL: 'https://www.immutable.com',
4017
+ name: 'Immutable zkEVM Testnet',
4018
+ nativeCurrency: {
4019
+ name: 'Test IMX',
4020
+ symbol: 'tIMX',
4021
+ decimals: 18,
4022
+ },
4023
+ networkId: 13473,
4024
+ rpc: [
4025
+ 'https://rpc.testnet.immutable.com',
4026
+ 'https://immutable-zkevm-testnet.drpc.org',
4027
+ 'wss://immutable-zkevm-testnet.drpc.org',
4028
+ ],
4029
+ shortName: 'imx-testnet',
4030
+ slip44: 1,
4031
+ slug: 'immutable-zkevm-testnet',
4032
+ testnet: true,
4033
+ };
4034
+
4035
+ const chainMap = {
4036
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4037
+ 56: chain$m,
4038
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4039
+ 97: chain$l,
4040
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4041
+ 8453: chain$k,
4042
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4043
+ 84532: chain$j,
4044
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4045
+ 4337: chain$i,
4046
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4047
+ 13337: chain$h,
4048
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4049
+ 43113: chain$g,
4050
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4051
+ 43114: chain$f,
4052
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4053
+ 11155111: chain$e,
4054
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4055
+ 59140: chain$d,
4056
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4057
+ 10200: chain$c,
4058
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4059
+ 421614: chain$a,
4060
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4061
+ 42161: chain$9,
4062
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4063
+ 42170: chain$8,
4064
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4065
+ 137: chain$7,
4066
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4067
+ 80002: chain$6,
4068
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4069
+ 28122024: chain$5,
4070
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4071
+ 888888888: chain$4,
4072
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4073
+ 999999999: chain$3,
4074
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4075
+ 7777777: chain$2,
4076
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4077
+ 666666666: chain$1,
4078
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4079
+ 13473: chain,
4080
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4081
+ 13371: chain$b,
4082
+ };
4083
+
4084
+ var BackendTransactionStatus;
4085
+ (function (BackendTransactionStatus) {
4086
+ BackendTransactionStatus["PENDING"] = "PENDING";
4087
+ BackendTransactionStatus["SUBMITTED"] = "SUBMITTED";
4088
+ BackendTransactionStatus["SUCCESSFUL"] = "SUCCESSFUL";
4089
+ BackendTransactionStatus["REVERTED"] = "REVERTED";
4090
+ BackendTransactionStatus["FAILED"] = "FAILED";
4091
+ BackendTransactionStatus["CANCELLED"] = "CANCELLED";
4092
+ })(BackendTransactionStatus || (BackendTransactionStatus = {}));
4093
+ var ProviderEvent;
4094
+ (function (ProviderEvent) {
4095
+ ProviderEvent["ACCOUNTS_CHANGED"] = "accountsChanged";
4096
+ })(ProviderEvent || (ProviderEvent = {}));
4097
+
4098
+ class TypedEventEmitter {
4099
+ emitter = new events.EventEmitter();
4100
+ emit(eventName, ...eventArg) {
4101
+ this.emitter.emit(eventName, ...eventArg);
4102
+ }
4103
+ on(eventName, handler) {
4104
+ this.emitter.on(eventName, handler);
4105
+ }
4106
+ removeListener(eventName, handler) {
4107
+ this.emitter.removeListener(eventName, handler);
4108
+ }
4109
+ }
4110
+
4111
+ /**
4112
+ * ProviderErrors should take priority over RpcErrorCodes
4113
+ * https://eips.ethereum.org/EIPS/eip-1193#provider-errors
4114
+ * https://eips.ethereum.org/EIPS/eip-1474#error-codes
4115
+ */
4116
+ var ProviderErrorCode;
4117
+ (function (ProviderErrorCode) {
4118
+ ProviderErrorCode[ProviderErrorCode["USER_REJECTED_REQUEST"] = 4001] = "USER_REJECTED_REQUEST";
4119
+ ProviderErrorCode[ProviderErrorCode["UNAUTHORIZED"] = 4100] = "UNAUTHORIZED";
4120
+ ProviderErrorCode[ProviderErrorCode["UNSUPPORTED_METHOD"] = 4200] = "UNSUPPORTED_METHOD";
4121
+ ProviderErrorCode[ProviderErrorCode["DISCONNECTED"] = 4900] = "DISCONNECTED";
4122
+ })(ProviderErrorCode || (ProviderErrorCode = {}));
4123
+ var RpcErrorCode;
4124
+ (function (RpcErrorCode) {
4125
+ RpcErrorCode[RpcErrorCode["RPC_SERVER_ERROR"] = -32000] = "RPC_SERVER_ERROR";
4126
+ RpcErrorCode[RpcErrorCode["INVALID_REQUEST"] = -32600] = "INVALID_REQUEST";
4127
+ RpcErrorCode[RpcErrorCode["METHOD_NOT_FOUND"] = -32601] = "METHOD_NOT_FOUND";
4128
+ RpcErrorCode[RpcErrorCode["INVALID_PARAMS"] = -32602] = "INVALID_PARAMS";
4129
+ RpcErrorCode[RpcErrorCode["INTERNAL_ERROR"] = -32603] = "INTERNAL_ERROR";
4130
+ RpcErrorCode[RpcErrorCode["PARSE_ERROR"] = -32700] = "PARSE_ERROR";
4131
+ RpcErrorCode[RpcErrorCode["TRANSACTION_REJECTED"] = -32003] = "TRANSACTION_REJECTED";
4132
+ })(RpcErrorCode || (RpcErrorCode = {}));
4133
+ class JsonRpcError extends Error {
4134
+ message;
4135
+ code;
4136
+ constructor(code, message) {
4137
+ super(message);
4138
+ this.message = message;
4139
+ this.code = code;
4140
+ }
4141
+ }
4142
+
4143
+ const buildOpenfortTransactions = async (transactionRequest, backendApiClients, instanceManager, policyId) => {
4144
+ const interactions = transactionRequest.map((tx) => {
4145
+ if (!tx.to) {
4146
+ throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, 'eth_sendTransaction requires a "to" field');
4147
+ }
4148
+ return {
4149
+ to: String(tx.to),
4150
+ data: tx.data ? String(tx.data) : undefined,
4151
+ value: tx.value ? String(tx.value) : undefined,
4152
+ };
4153
+ });
4154
+ const accessToken = instanceManager.getAccessToken();
4155
+ const chainId = instanceManager.getChainID();
4156
+ if (!accessToken || !chainId) {
4157
+ throw new JsonRpcError(RpcErrorCode.RPC_SERVER_ERROR, 'No access token found');
4158
+ }
4159
+ const transactionResponse = await backendApiClients.transactionIntentsApi.createTransactionIntent({
4160
+ createTransactionIntentRequest: {
4161
+ policy: policyId,
4162
+ chainId: Number(chainId),
4163
+ interactions,
4164
+ },
4165
+ }, {
4166
+ headers: {
4167
+ authorization: `Bearer ${backendApiClients.config.backend.accessToken}`,
4168
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4169
+ 'x-player-token': accessToken.token,
4170
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4171
+ 'x-auth-provider': accessToken.thirdPartyProvider,
4172
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4173
+ 'x-token-type': accessToken.thirdPartyTokenType,
4174
+ },
4175
+ });
4176
+ return transactionResponse.data;
4177
+ };
4178
+ const sendTransaction = async ({ params, signer, backendClient, instanceManager, policyId, }) => {
4179
+ const openfortTransaction = await buildOpenfortTransactions(params, backendClient, instanceManager, policyId);
4180
+ let response;
4181
+ if (openfortTransaction?.nextAction?.payload?.userOperationHash) {
4182
+ const signature = await signer.sign(openfortTransaction.nextAction.payload.userOperationHash);
4183
+ const openfortSignatureResponse = (await backendClient.transactionIntentsApi.signature({
4184
+ id: openfortTransaction.id,
4185
+ signatureRequest: { signature },
4186
+ })).data.response;
4187
+ if (!openfortSignatureResponse) {
4188
+ throw new JsonRpcError(RpcErrorCode.RPC_SERVER_ERROR, 'Transaction failed to submit');
4189
+ }
4190
+ response = openfortSignatureResponse;
4191
+ }
4192
+ else if (openfortTransaction.response) {
4193
+ response = openfortTransaction.response;
4194
+ }
4195
+ else {
4196
+ throw new JsonRpcError(RpcErrorCode.RPC_SERVER_ERROR, 'Transaction failed to submit');
4197
+ }
4198
+ if (response.status === 0 && !response.transactionHash) {
4199
+ throw new JsonRpcError(RpcErrorCode.RPC_SERVER_ERROR, response.error.reason);
4200
+ }
4201
+ return response.transactionHash;
4202
+ };
4203
+
4204
+ const getSignedTypedData = async (typedData, accountType, chainId, signer, evmAddress) => {
4205
+ // Ethers auto-generates the EIP712Domain type in the TypedDataEncoder, and so it needs to be removed
4206
+ const types = { ...typedData.types };
4207
+ // @ts-ignore
4208
+ delete types.EIP712Domain;
4209
+ // Hash the EIP712 payload and generate the complete payload
4210
+ let typedDataHash = hash._TypedDataEncoder.hash(typedData.domain, types, typedData.message);
4211
+ if (accountType === AccountType.UPGRADEABLE_V5) {
4212
+ const updatedDomain = {
4213
+ name: 'Openfort',
4214
+ version: '0.5',
4215
+ chainId: Number(chainId),
4216
+ verifyingContract: evmAddress,
4217
+ };
4218
+ const updatedTypes = {
4219
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4220
+ OpenfortMessage: [{ name: 'hashedMessage', type: 'bytes32' }],
4221
+ };
4222
+ const updatedMessage = {
4223
+ hashedMessage: typedDataHash,
4224
+ };
4225
+ typedDataHash = hash._TypedDataEncoder.hash(updatedDomain, updatedTypes, updatedMessage);
4226
+ // primaryType: "OpenfortMessage"
4227
+ }
4228
+ const ethsigNoType = await signer.sign(typedDataHash, false, false);
4229
+ return ethsigNoType;
4230
+ };
4231
+
4232
+ const REQUIRED_TYPED_DATA_PROPERTIES = ['types', 'domain', 'primaryType', 'message'];
4233
+ const isValidTypedDataPayload = (typedData) => (REQUIRED_TYPED_DATA_PROPERTIES.every((key) => key in typedData));
4234
+ const transformTypedData = (typedData, chainId) => {
4235
+ let transformedTypedData;
4236
+ if (typeof typedData === 'string') {
4237
+ try {
4238
+ transformedTypedData = JSON.parse(typedData);
4239
+ }
4240
+ catch (err) {
4241
+ throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, `Failed to parse typed data JSON: ${err}`);
4242
+ }
4243
+ }
4244
+ else if (typeof typedData === 'object') {
4245
+ transformedTypedData = typedData;
4246
+ }
4247
+ else {
4248
+ throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, `Invalid typed data argument: ${typedData}`);
4249
+ }
4250
+ if (!isValidTypedDataPayload(transformedTypedData)) {
4251
+ throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, `Invalid typed data argument. The following properties are required:
4252
+ ${REQUIRED_TYPED_DATA_PROPERTIES.join(', ')}`);
4253
+ }
4254
+ const providedChainId = transformedTypedData.domain?.chainId;
4255
+ if (providedChainId) {
4256
+ // domain.chainId (if defined) can be a number, string, or hex value, but the backend & guardian only accept a number.
4257
+ if (typeof providedChainId === 'string') {
4258
+ if (providedChainId.startsWith('0x')) {
4259
+ transformedTypedData.domain.chainId = parseInt(providedChainId, 16);
4260
+ }
4261
+ else {
4262
+ transformedTypedData.domain.chainId = parseInt(providedChainId, 10);
4263
+ }
4264
+ }
4265
+ if (transformedTypedData.domain.chainId !== chainId) {
4266
+ throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, `Invalid chainId, expected ${chainId}`);
4267
+ }
4268
+ }
4269
+ return transformedTypedData;
4270
+ };
4271
+ const signTypedDataV4 = async ({ params, method, signer, accountType, rpcProvider, }) => {
4272
+ const fromAddress = params[0];
4273
+ const typedDataParam = params[1];
4274
+ if (!fromAddress || !typedDataParam) {
4275
+ throw new JsonRpcError(RpcErrorCode.INVALID_PARAMS, `${method} requires an address and a typed data JSON`);
4276
+ }
4277
+ const { chainId } = await rpcProvider.detectNetwork();
4278
+ const typedData = transformTypedData(typedDataParam, chainId);
4279
+ const signature = await getSignedTypedData(typedData, accountType, chainId, signer, fromAddress);
4280
+ return signature;
4281
+ };
4282
+
4283
+ class EvmProvider {
4284
+ #signer;
4285
+ #policyId;
4286
+ #eventEmitter;
4287
+ #rpcProvider; // Used for read
4288
+ #instanceManager;
4289
+ #backendApiClients;
4290
+ #address;
4291
+ isOpenfort = true;
4292
+ constructor({ signer, address, backendApiClients, instanceManager, openfortEventEmitter, policyId, }) {
4293
+ this.#signer = signer;
4294
+ this.#policyId = policyId;
4295
+ this.#address = address;
4296
+ this.#instanceManager = instanceManager;
4297
+ this.#backendApiClients = backendApiClients;
4298
+ const chainId = Number(this.#instanceManager.getChainID());
4299
+ this.#rpcProvider = new providers.StaticJsonRpcProvider(chainMap[chainId].rpc[0]);
4300
+ this.#backendApiClients = backendApiClients;
4301
+ this.#eventEmitter = new TypedEventEmitter();
4302
+ openfortEventEmitter.on(OpenfortEvents.LOGGED_OUT, this.#handleLogout);
4303
+ }
4304
+ #handleLogout = () => {
4305
+ const shouldEmitAccountsChanged = !!this.#address;
4306
+ this.#address = undefined;
4307
+ this.#signer.logout();
4308
+ if (shouldEmitAccountsChanged) {
4309
+ this.#eventEmitter.emit(ProviderEvent.ACCOUNTS_CHANGED, []);
4310
+ }
4311
+ };
4312
+ async #performRequest(request) {
4313
+ switch (request.method) {
4314
+ case 'eth_requestAccounts': {
4315
+ if (this.#address) {
4316
+ return [this.#address];
4317
+ }
4318
+ const user = await this.#signer.ensureEmbeddedAccount();
4319
+ this.#address = user.address;
4320
+ this.#eventEmitter.emit(ProviderEvent.ACCOUNTS_CHANGED, [this.#address]);
4321
+ return [this.#address];
4322
+ }
4323
+ case 'eth_sendTransaction': {
4324
+ if (!this.#address) {
4325
+ throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'Unauthorized - call eth_requestAccounts first');
4326
+ }
4327
+ return await sendTransaction({
4328
+ params: request.params || [],
4329
+ signer: this.#signer,
4330
+ backendClient: this.#backendApiClients,
4331
+ instanceManager: this.#instanceManager,
4332
+ policyId: this.#policyId,
4333
+ });
4334
+ }
4335
+ case 'eth_accounts': {
4336
+ return this.#address ? [this.#address] : [];
4337
+ }
4338
+ case 'eth_signTypedData':
4339
+ case 'eth_signTypedData_v4': {
4340
+ if (!this.#address) {
4341
+ throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'Unauthorized - call eth_requestAccounts first');
4342
+ }
4343
+ const accountType = this.#instanceManager.getAccountType();
4344
+ if (!accountType) {
4345
+ throw new JsonRpcError(ProviderErrorCode.UNAUTHORIZED, 'Unauthorized - call eth_requestAccounts first');
4346
+ }
4347
+ return await signTypedDataV4({
4348
+ method: request.method,
4349
+ params: request.params || [],
4350
+ signer: this.#signer,
4351
+ accountType,
4352
+ rpcProvider: this.#rpcProvider,
4353
+ });
4354
+ }
4355
+ case 'eth_chainId': {
4356
+ // Call detect network to fetch the chainId so to take advantage of
4357
+ // the caching layer provided by StaticJsonRpcProvider.
4358
+ // In case Openfort is changed from StaticJsonRpcProvider to a
4359
+ // JsonRpcProvider, this function will still work as expected given
4360
+ // that detectNetwork call _uncachedDetectNetwork which will force
4361
+ // the provider to re-fetch the chainId from remote.
4362
+ const { chainId } = await this.#rpcProvider.detectNetwork();
4363
+ return bytes.hexlify(chainId);
4364
+ }
4365
+ // Pass through methods
4366
+ case 'eth_gasPrice':
4367
+ case 'eth_getBalance':
4368
+ case 'eth_getCode':
4369
+ case 'eth_getStorageAt':
4370
+ case 'eth_estimateGas':
4371
+ case 'eth_call':
4372
+ case 'eth_blockNumber':
4373
+ case 'eth_getBlockByHash':
4374
+ case 'eth_getBlockByNumber':
4375
+ case 'eth_getTransactionByHash':
4376
+ case 'eth_getTransactionReceipt':
4377
+ case 'eth_getTransactionCount': {
4378
+ return this.#rpcProvider.send(request.method, request.params || []);
4379
+ }
4380
+ default: {
4381
+ throw new JsonRpcError(ProviderErrorCode.UNSUPPORTED_METHOD, 'Method not supported');
4382
+ }
4383
+ }
4384
+ }
4385
+ async #performJsonRpcRequest(request) {
4386
+ const { id, jsonrpc } = request;
4387
+ try {
4388
+ const result = await this.#performRequest(request);
4389
+ return {
4390
+ id,
4391
+ jsonrpc,
4392
+ result,
4393
+ };
4394
+ }
4395
+ catch (error) {
4396
+ let jsonRpcError;
4397
+ if (error instanceof JsonRpcError) {
4398
+ jsonRpcError = error;
4399
+ }
4400
+ else if (error instanceof Error) {
4401
+ jsonRpcError = new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, error.message);
4402
+ }
4403
+ else {
4404
+ jsonRpcError = new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, 'Internal error');
4405
+ }
4406
+ return {
4407
+ id,
4408
+ jsonrpc,
4409
+ error: jsonRpcError,
4410
+ };
4411
+ }
4412
+ }
4413
+ async request(request) {
4414
+ try {
4415
+ return this.#performRequest(request);
4416
+ }
4417
+ catch (error) {
4418
+ if (error instanceof JsonRpcError) {
4419
+ throw error;
4420
+ }
4421
+ if (error instanceof Error) {
4422
+ throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, error.message);
4423
+ }
4424
+ throw new JsonRpcError(RpcErrorCode.INTERNAL_ERROR, 'Internal error');
4425
+ }
4426
+ }
4427
+ sendAsync(request, callback) {
4428
+ if (!callback) {
4429
+ throw new Error('No callback provided');
4430
+ }
4431
+ if (Array.isArray(request)) {
4432
+ Promise.all(request.map(this.#performJsonRpcRequest)).then((result) => {
4433
+ callback(null, result);
4434
+ }).catch((error) => {
4435
+ callback(error, []);
4436
+ });
4437
+ }
4438
+ else {
4439
+ this.#performJsonRpcRequest(request).then((result) => {
4440
+ callback(null, result);
4441
+ }).catch((error) => {
4442
+ callback(error, null);
4443
+ });
4444
+ }
4445
+ }
4446
+ async send(request, callbackOrParams, callback) {
4447
+ // Web3 >= 1.0.0-beta.38 calls `send` with method and parameters.
4448
+ if (typeof request === 'string') {
4449
+ if (typeof callbackOrParams === 'function') {
4450
+ return this.sendAsync({
4451
+ method: request,
4452
+ params: [],
4453
+ }, callbackOrParams);
4454
+ }
4455
+ if (callback) {
4456
+ return this.sendAsync({
4457
+ method: request,
4458
+ params: Array.isArray(callbackOrParams) ? callbackOrParams : [],
4459
+ }, callback);
4460
+ }
4461
+ return this.request({
4462
+ method: request,
4463
+ params: Array.isArray(callbackOrParams) ? callbackOrParams : [],
4464
+ });
4465
+ }
4466
+ // Web3 <= 1.0.0-beta.37 uses `send` with a callback for async queries.
4467
+ if (typeof callbackOrParams === 'function') {
4468
+ return this.sendAsync(request, callbackOrParams);
4469
+ }
4470
+ if (!Array.isArray(request) && typeof request === 'object') {
4471
+ return this.#performJsonRpcRequest(request);
4472
+ }
4473
+ throw new JsonRpcError(RpcErrorCode.INVALID_REQUEST, 'Invalid request');
4474
+ }
4475
+ on(event, listener) {
4476
+ this.#eventEmitter.on(event, listener);
4477
+ }
4478
+ removeListener(event, listener) {
4479
+ this.#eventEmitter.removeListener(event, listener);
4480
+ }
4481
+ }
4482
+
4483
+ const openfortProviderInfo = {
4484
+ // eslint-disable-next-line max-len
4485
+ icon: 'data:image/svg+xml,<svg aria-hidden="true" viewBox="597.32 331.34 171.36 105.32" ><g><rect x="673.9" y="404.26" width="18.2" height="32.4" /><polygon points="768.68,331.36 768.68,331.36 768.68,331.34 610.78,331.34 610.78,331.36 597.32,331.36 597.32,436.64 615.52,436.64 615.52,349.54 750.48,349.54 750.48,436.64 768.68,436.64 " /><polygon points="732.16,367.79 633.83,367.79 633.83,370.19 633.79,370.19 633.79,436.64 651.99,436.64 651.99,385.99 713.9,385.99 713.9,436.64 732.09,436.64 732.09,385.99 732.16,385.99 " /></g></svg>',
4486
+ name: 'Ecosystem ID',
4487
+ rdns: 'com.ecosystem.id',
4488
+ uuid: uuid.v4(),
4489
+ };
4490
+ function announceProvider(detail) {
4491
+ if (typeof window === 'undefined')
4492
+ return;
4493
+ const event = new CustomEvent('eip6963:announceProvider', { detail: Object.freeze(detail) });
4494
+ window.dispatchEvent(event);
4495
+ const handler = () => window.dispatchEvent(event);
4496
+ window.addEventListener('eip6963:requestProvider', handler);
4497
+ }
4498
+
2725
4499
  var SignerType;
2726
4500
  (function (SignerType) {
2727
4501
  SignerType["EMBEDDED"] = "embedded";
@@ -2737,11 +4511,12 @@ class AuthManager {
2737
4511
  this.config = config;
2738
4512
  this.backendApiClients = backendApiClients;
2739
4513
  }
2740
- async initOAuth(provider, options) {
4514
+ async initOAuth(provider, usePooling, options) {
2741
4515
  const request = {
2742
4516
  oAuthInitRequest: {
2743
4517
  provider,
2744
4518
  options,
4519
+ usePooling: usePooling || false,
2745
4520
  },
2746
4521
  };
2747
4522
  const result = await this.backendApiClients.authenticationApi.initOAuth(request);
@@ -2753,6 +4528,52 @@ class AuthManager {
2753
4528
  key: result.data.key,
2754
4529
  };
2755
4530
  }
4531
+ async initLinkOAuth(provider, playerToken, usePooling, options) {
4532
+ const request = {
4533
+ oAuthInitRequest: {
4534
+ provider,
4535
+ options,
4536
+ usePooling: usePooling || false,
4537
+ },
4538
+ };
4539
+ const result = await this.backendApiClients.authenticationApi.initLinkOAuth(request, {
4540
+ // eslint-disable-next-line @typescript-eslint/naming-convention
4541
+ headers: { 'x-player-token': playerToken },
4542
+ });
4543
+ if (isBrowser() && !options?.skipBrowserRedirect) {
4544
+ window.location.assign(result.data.url);
4545
+ }
4546
+ return {
4547
+ url: result.data.url,
4548
+ key: result.data.key,
4549
+ };
4550
+ }
4551
+ async poolOAuth(key) {
4552
+ const request = {
4553
+ key,
4554
+ };
4555
+ for (let i = 0; i < 600; i++) {
4556
+ try {
4557
+ // eslint-disable-next-line no-await-in-loop
4558
+ const response = await this.backendApiClients.authenticationApi.poolOAuth(request);
4559
+ if (response.status === 200) {
4560
+ return response.data;
4561
+ }
4562
+ }
4563
+ catch (error) {
4564
+ // @ts-ignore
4565
+ if (error.response && error.response.status === 404) {
4566
+ // eslint-disable-next-line no-await-in-loop
4567
+ await new Promise((resolve) => { setTimeout(resolve, 500); });
4568
+ // eslint-disable-next-line no-continue
4569
+ continue;
4570
+ }
4571
+ throw error;
4572
+ }
4573
+ }
4574
+ throw new Error('Failed to pool OAuth, try again later');
4575
+ }
4576
+ // Deprecated
2756
4577
  async authenticateOAuth(provider, token, tokenType) {
2757
4578
  const request = {
2758
4579
  authenticateOAuthRequest: {
@@ -2880,7 +4701,7 @@ class AuthManager {
2880
4701
  headers: {
2881
4702
  authorization: `Bearer ${this.config.baseConfiguration.publishableKey}`,
2882
4703
  // eslint-disable-next-line @typescript-eslint/naming-convention
2883
- 'player-token': accessToken,
4704
+ 'x-player-token': accessToken,
2884
4705
  },
2885
4706
  });
2886
4707
  }
@@ -3699,6 +5520,13 @@ class NotLoggedIn extends Error {
3699
5520
  Object.setPrototypeOf(this, NotLoggedIn.prototype);
3700
5521
  }
3701
5522
  }
5523
+ class EmbeddedNotConfigured extends Error {
5524
+ constructor(message) {
5525
+ super(message);
5526
+ this.name = 'EmbeddedNotConfigured';
5527
+ Object.setPrototypeOf(this, EmbeddedNotConfigured.prototype);
5528
+ }
5529
+ }
3702
5530
  class NoSignerConfigured extends Error {
3703
5531
  constructor(message) {
3704
5532
  super(message);
@@ -3720,11 +5548,13 @@ class Openfort {
3720
5548
  instanceManager;
3721
5549
  backendApiClients;
3722
5550
  iframeManager;
5551
+ openfortEventEmitter;
3723
5552
  constructor(sdkConfiguration) {
3724
5553
  this.config = new SDKConfiguration(sdkConfiguration);
3725
5554
  this.backendApiClients = new BackendApiClients(this.config.openfortAPIConfig);
3726
5555
  this.authManager = new AuthManager(this.config, this.backendApiClients);
3727
5556
  this.instanceManager = new InstanceManager(new SessionStorage(), new LocalStorage(), new LocalStorage(), this.authManager);
5557
+ this.openfortEventEmitter = new TypedEventEmitter();
3728
5558
  this.iframeManager = new IframeManager(this.config);
3729
5559
  }
3730
5560
  async logout() {
@@ -3756,6 +5586,29 @@ class Openfort {
3756
5586
  this.instanceManager.removeJWK();
3757
5587
  }
3758
5588
  }
5589
+ getEthereumProvider(options = {
5590
+ announceProvider: true,
5591
+ }) {
5592
+ if (!(this.signer instanceof EmbeddedSigner)) {
5593
+ throw new EmbeddedNotConfigured('Embedded signer must be configured to get Ethereum provider');
5594
+ }
5595
+ const address = this.instanceManager.getAccountAddress();
5596
+ const provider = new EvmProvider({
5597
+ openfortEventEmitter: this.openfortEventEmitter,
5598
+ signer: this.signer,
5599
+ address: address,
5600
+ instanceManager: this.instanceManager,
5601
+ backendApiClients: this.backendApiClients,
5602
+ policyId: options.policy,
5603
+ });
5604
+ if (options?.announceProvider) {
5605
+ announceProvider({
5606
+ info: openfortProviderInfo,
5607
+ provider,
5608
+ });
5609
+ }
5610
+ return provider;
5611
+ }
3759
5612
  async flushSigner() {
3760
5613
  if (this.signer) {
3761
5614
  await this.signer.logout();
@@ -3837,8 +5690,14 @@ class Openfort {
3837
5690
  });
3838
5691
  return result;
3839
5692
  }
3840
- async initOAuth(provider, options) {
3841
- return await this.authManager.initOAuth(provider, options);
5693
+ async initOAuth(provider, usePooling, options) {
5694
+ return await this.authManager.initOAuth(provider, usePooling, options);
5695
+ }
5696
+ async initLinkOAuth(provider, playerToken, usePooling, options) {
5697
+ return await this.authManager.initLinkOAuth(provider, playerToken, usePooling, options);
5698
+ }
5699
+ async poolOAuth(key) {
5700
+ return await this.authManager.poolOAuth(key);
3842
5701
  }
3843
5702
  async authenticateWithOAuth(provider, token, tokenType) {
3844
5703
  this.instanceManager.removeAccessToken();
@@ -4079,5 +5938,6 @@ class Openfort {
4079
5938
  }
4080
5939
 
4081
5940
  exports.OpenfortConfiguration = OpenfortConfiguration;
5941
+ exports.SDKConfiguration = SDKConfiguration;
4082
5942
  exports.ShieldConfiguration = ShieldConfiguration;
4083
5943
  exports.default = Openfort;