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