@openfort/openfort-js 0.10.34 → 0.10.36

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (30) hide show
  1. package/dist/cjs/packages/internal/openapi-clients/dist/index.js +1 -1
  2. package/dist/cjs/sdk/src/api/embeddedWallet.js +1 -1
  3. package/dist/cjs/sdk/src/core/configuration/account.js +1 -1
  4. package/dist/cjs/sdk/src/core/openfortInternal.js +1 -1
  5. package/dist/cjs/sdk/src/index.js +1 -1
  6. package/dist/cjs/sdk/src/types/types.js +1 -1
  7. package/dist/cjs/sdk/src/utils/authorization.js +1 -0
  8. package/dist/cjs/sdk/src/version.js +1 -1
  9. package/dist/cjs/sdk/src/wallets/embedded.js +1 -1
  10. package/dist/cjs/sdk/src/wallets/evm/evmProvider.js +1 -1
  11. package/dist/cjs/sdk/src/wallets/evm/registerSession.js +1 -1
  12. package/dist/cjs/sdk/src/wallets/evm/revokeSession.js +1 -1
  13. package/dist/cjs/sdk/src/wallets/evm/sendCallSync.js +1 -1
  14. package/dist/cjs/sdk/src/wallets/evm/sendCalls.js +1 -1
  15. package/dist/index.d.ts +183 -2
  16. package/dist/packages/internal/openapi-clients/dist/index.js +1 -1
  17. package/dist/sdk/src/api/embeddedWallet.js +1 -1
  18. package/dist/sdk/src/core/configuration/account.js +1 -1
  19. package/dist/sdk/src/core/openfortInternal.js +1 -1
  20. package/dist/sdk/src/index.js +1 -1
  21. package/dist/sdk/src/types/types.js +1 -1
  22. package/dist/sdk/src/utils/authorization.js +1 -0
  23. package/dist/sdk/src/version.js +1 -1
  24. package/dist/sdk/src/wallets/embedded.js +1 -1
  25. package/dist/sdk/src/wallets/evm/evmProvider.js +1 -1
  26. package/dist/sdk/src/wallets/evm/registerSession.js +1 -1
  27. package/dist/sdk/src/wallets/evm/revokeSession.js +1 -1
  28. package/dist/sdk/src/wallets/evm/sendCallSync.js +1 -1
  29. package/dist/sdk/src/wallets/evm/sendCalls.js +1 -1
  30. package/package.json +1 -1
package/dist/index.d.ts CHANGED
@@ -1,5 +1,7 @@
1
+ import { PasskeyDetails } from 'wallets/types';
1
2
  import { PasskeyHandler as PasskeyHandler$1 } from 'core/configuration/passkey';
2
3
  import { ThirdPartyOAuthProvider as ThirdPartyOAuthProvider$1 } from 'types';
4
+ import { Account } from 'core/configuration/account';
3
5
  import { Hex } from 'wallets/evm/types';
4
6
 
5
7
  declare class TypedEventEmitter<T extends Record<string, any[]>> {
@@ -2973,6 +2975,44 @@ interface CreateTransactionIntentRequest {
2973
2975
  'interactions': Array<Interaction$1>;
2974
2976
  }
2975
2977
 
2978
+ /**
2979
+ * Openfort API
2980
+ * Complete Openfort API references and guides can be found at: https://www.openfort.io/docs
2981
+ *
2982
+ * The version of the OpenAPI document: 1.0.0
2983
+ * Contact: founders@openfort.xyz
2984
+ *
2985
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
2986
+ * https://openapi-generator.tech
2987
+ * Do not edit the class manually.
2988
+ */
2989
+
2990
+ /**
2991
+ *
2992
+ * @export
2993
+ * @interface DeleteAccountResponse
2994
+ */
2995
+ interface DeleteAccountResponse {
2996
+ /**
2997
+ *
2998
+ * @type {string}
2999
+ * @memberof DeleteAccountResponse
3000
+ */
3001
+ 'id': string;
3002
+ /**
3003
+ *
3004
+ * @type {EntityTypeACCOUNT}
3005
+ * @memberof DeleteAccountResponse
3006
+ */
3007
+ 'object': EntityTypeACCOUNT;
3008
+ /**
3009
+ *
3010
+ * @type {boolean}
3011
+ * @memberof DeleteAccountResponse
3012
+ */
3013
+ 'deleted': boolean;
3014
+ }
3015
+
2976
3016
  /**
2977
3017
  * Openfort API
2978
3018
  * Complete Openfort API references and guides can be found at: https://www.openfort.io/docs
@@ -5588,6 +5628,19 @@ interface AccountsApiGetSignerIdByAddressRequest {
5588
5628
  */
5589
5629
  readonly address: string;
5590
5630
  }
5631
+ /**
5632
+ * Request parameters for removeAccount operation in AccountsApi.
5633
+ * @export
5634
+ * @interface AccountsApiRemoveAccountRequest
5635
+ */
5636
+ interface AccountsApiRemoveAccountRequest {
5637
+ /**
5638
+ *
5639
+ * @type {string}
5640
+ * @memberof AccountsApiRemoveAccount
5641
+ */
5642
+ readonly id: string;
5643
+ }
5591
5644
  /**
5592
5645
  * Request parameters for requestTransferOwnership operation in AccountsApi.
5593
5646
  * @export
@@ -5773,6 +5826,14 @@ declare class AccountsApi extends BaseAPI {
5773
5826
  * @memberof AccountsApi
5774
5827
  */
5775
5828
  getSignerIdByAddress(requestParameters: AccountsApiGetSignerIdByAddressRequest, options?: AxiosRequestConfig): Promise<AxiosResponse<SignerIdResponse, any, {}>>;
5829
+ /**
5830
+ * Removes an account from a project.
5831
+ * @param {AccountsApiRemoveAccountRequest} requestParameters Request parameters.
5832
+ * @param {*} [options] Override http request option.
5833
+ * @throws {RequiredError}
5834
+ * @memberof AccountsApi
5835
+ */
5836
+ removeAccount(requestParameters: AccountsApiRemoveAccountRequest, options?: AxiosRequestConfig): Promise<AxiosResponse<DeleteAccountResponse, any, {}>>;
5776
5837
  /**
5777
5838
  * Perform a request to change the owner of an account. To perform an update on the owner of an account, first you must provide a new owner address. Once requested, the owner must accept to take ownership by calling `acceptOwnership()` in the smart contract account.
5778
5839
  * @summary Request transfer ownership of account.
@@ -7294,7 +7355,8 @@ interface StandardDetails {
7294
7355
  }
7295
7356
  declare enum AccountTypeEnum {
7296
7357
  EOA = "Externally Owned Account",
7297
- SMART_ACCOUNT = "Smart Account"
7358
+ SMART_ACCOUNT = "Smart Account",
7359
+ DELEGATED_ACCOUNT = "Delegated Account"
7298
7360
  }
7299
7361
  declare enum ChainTypeEnum {
7300
7362
  EVM = "EVM",
@@ -7308,6 +7370,7 @@ interface EmbeddedAccount {
7308
7370
  createdAt?: number;
7309
7371
  implementationType?: string;
7310
7372
  factoryAddress?: string;
7373
+ implementationAddress?: string;
7311
7374
  salt?: string;
7312
7375
  accountType: AccountTypeEnum;
7313
7376
  recoveryMethod?: RecoveryMethod;
@@ -7348,6 +7411,11 @@ type RecoveryParams = {
7348
7411
  recoveryMethod: RecoveryMethod.PASSKEY;
7349
7412
  passkeyInfo?: PasskeyInfo;
7350
7413
  };
7414
+ type EntropyResponse = {
7415
+ recoveryPassword?: string;
7416
+ encryptionSession?: string;
7417
+ passkey?: PasskeyDetails;
7418
+ };
7351
7419
  declare enum SortOrdering {
7352
7420
  ASC = "asc",
7353
7421
  DESC = "desc"
@@ -7856,6 +7924,23 @@ declare class OpenfortInternal {
7856
7924
  validateAndRefreshToken(forceRefresh?: boolean): Promise<void>;
7857
7925
  }
7858
7926
 
7927
+ interface SignerConfigureRequest {
7928
+ chainId?: number;
7929
+ entropy?: EntropyResponse;
7930
+ accountType: AccountTypeEnum;
7931
+ chainType: ChainTypeEnum;
7932
+ getPasskeyKeyFn: (id: string) => Promise<Uint8Array>;
7933
+ }
7934
+ interface SignerCreateRequest {
7935
+ accountType: AccountTypeEnum;
7936
+ chainType: ChainTypeEnum;
7937
+ chainId?: number;
7938
+ entropy?: EntropyResponse;
7939
+ }
7940
+ interface SignerRecoverRequest {
7941
+ account: string;
7942
+ entropy?: EntropyResponse;
7943
+ }
7859
7944
  declare class MissingRecoveryPasswordError extends Error {
7860
7945
  constructor();
7861
7946
  }
@@ -7872,6 +7957,102 @@ declare class OTPRequiredError extends Error {
7872
7957
  constructor();
7873
7958
  }
7874
7959
 
7960
+ interface Signer$1 {
7961
+ sign(message: Uint8Array | string, requireArrayify?: boolean, requireHash?: boolean): Promise<string>;
7962
+ disconnect(): Promise<void>;
7963
+ configure(params: SignerConfigureRequest): Promise<Account>;
7964
+ switchChain({ chainId }: {
7965
+ chainId: number;
7966
+ }): Promise<void>;
7967
+ setRecoveryMethod({ recoveryMethod, recoveryPassword, encryptionSession, }: {
7968
+ recoveryMethod: RecoveryMethod;
7969
+ recoveryPassword?: string;
7970
+ encryptionSession?: string;
7971
+ }): Promise<void>;
7972
+ export(): Promise<string>;
7973
+ create(params: SignerCreateRequest): Promise<Account>;
7974
+ recover(params: SignerRecoverRequest): Promise<Account>;
7975
+ }
7976
+
7977
+ /**
7978
+ * EIP-7702 Authorization utilities
7979
+ * Standalone implementation for preparing and signing EIP-7702 authorizations
7980
+ */
7981
+
7982
+ /**
7983
+ * EIP-7702 Authorization object
7984
+ */
7985
+ type Authorization = {
7986
+ /** Contract address to delegate execution to */
7987
+ address: string;
7988
+ /** Chain ID where the authorization is valid */
7989
+ chainId: number;
7990
+ /** Nonce of the EOA account */
7991
+ nonce: number;
7992
+ };
7993
+ /**
7994
+ * Signed EIP-7702 Authorization object
7995
+ */
7996
+ type SignedAuthorization = Authorization & {
7997
+ /** Signature r value */
7998
+ r: string;
7999
+ /** Signature s value */
8000
+ s: string;
8001
+ /** Signature v value (27 or 28) */
8002
+ v: number;
8003
+ /** Y parity (0 or 1) */
8004
+ yParity: number;
8005
+ };
8006
+ /**
8007
+ * Parameters for preparing an authorization
8008
+ */
8009
+ type PrepareAuthorizationParams = {
8010
+ /** Contract address to delegate to */
8011
+ contractAddress: string;
8012
+ /** Chain ID (optional, will be auto-filled if not provided) */
8013
+ chainId?: number;
8014
+ /** Nonce (optional, will be auto-filled if not provided) */
8015
+ nonce?: number;
8016
+ /** RPC URL for fetching chain data if chainId or nonce are not provided */
8017
+ rpcUrl?: string;
8018
+ /** Account address for fetching nonce */
8019
+ accountAddress?: string;
8020
+ };
8021
+ /**
8022
+ * Parameters for signing an authorization
8023
+ */
8024
+ type SignAuthorizationParams = {
8025
+ /** The prepared authorization to sign */
8026
+ authorization: Authorization;
8027
+ /** Signer instance to use for signing */
8028
+ signer: Signer$1;
8029
+ };
8030
+ /**
8031
+ * Signs an EIP-7702 Authorization using the Signer interface.
8032
+ *
8033
+ * @param params - Parameters for signing
8034
+ * @returns The signed authorization with signature fields
8035
+ */
8036
+ declare function signAuthorization(params: SignAuthorizationParams): Promise<SignedAuthorization>;
8037
+ /**
8038
+ * Serializes a signed authorization to compact signature format.
8039
+ * The API expects this format to parse with Viem's parseSignature function.
8040
+ * Format: 0x${r}${s}${yParity} (130 character hex string = 65 bytes)
8041
+ *
8042
+ * @param signedAuth - The signed authorization
8043
+ * @returns Compact signature hex string (r + s + yParity)
8044
+ */
8045
+ declare function serializeSignedAuthorization(signedAuth: SignedAuthorization): string;
8046
+ /**
8047
+ * Prepares and signs an EIP-7702 authorization in one call.
8048
+ *
8049
+ * @param params - Parameters including contract address, chainId, nonce, and signer
8050
+ * @returns The signed authorization with signature fields
8051
+ */
8052
+ declare function prepareAndSignAuthorization(params: PrepareAuthorizationParams & {
8053
+ signer: Signer$1;
8054
+ }): Promise<SignedAuthorization>;
8055
+
7875
8056
  type RevokePermissionsRequestParams = {
7876
8057
  permissionContext: Hex;
7877
8058
  };
@@ -8070,4 +8251,4 @@ type GrantPermissionsReturnType = {
8070
8251
  */
8071
8252
  declare const openfortEvents: TypedEventEmitter<OpenfortEventMap>;
8072
8253
 
8073
- export { AccountTypeEnum, AuthActionRequiredActions, AuthActionRequiredResponse, AuthApi, AuthInitPayload, AuthPlayerResponse, AuthResponse, AuthType, BasicAuthProvider, ChainTypeEnum, EmbeddedAccount, EmbeddedState, EmbeddedWalletApi, GrantPermissionsParameters, GrantPermissionsReturnType, InitAuthResponse, InitializeOAuthOptions, MissingProjectEntropyError, MissingRecoveryPasswordError, NotConfiguredError, OAuthProvider, OTPRequiredError, Openfort, OpenfortConfiguration, OpenfortError, OpenfortErrorType, OpenfortEventMap, OpenfortEvents, OpenfortInternal, OpenfortSDKConfiguration, Permission, Policy, Provider, ProxyApi, RecoveryMethod, RecoveryParams, RevokePermissionsRequestParams, SDKConfiguration, SDKOverrides, SessionResponse, ShieldAuthOptions, ShieldConfiguration, ShieldOptions, SignedMessagePayload, Signer, IStorage as Storage, ThirdPartyAuthConfiguration, ThirdPartyAuthProvider as ThirdPartyOAuthProvider, TokenType, TransactionIntentResponse, TypedDataPayload, UserApi, WrongRecoveryPasswordError, openfortEvents };
8254
+ export { AccountTypeEnum, AuthActionRequiredActions, AuthActionRequiredResponse, AuthApi, AuthInitPayload, AuthPlayerResponse, AuthResponse, AuthType, Authorization, BasicAuthProvider, ChainTypeEnum, EmbeddedAccount, EmbeddedState, EmbeddedWalletApi, GrantPermissionsParameters, GrantPermissionsReturnType, InitAuthResponse, InitializeOAuthOptions, MissingProjectEntropyError, MissingRecoveryPasswordError, NotConfiguredError, OAuthProvider, OTPRequiredError, Openfort, OpenfortConfiguration, OpenfortError, OpenfortErrorType, OpenfortEventMap, OpenfortEvents, OpenfortInternal, OpenfortSDKConfiguration, Permission, Policy, PrepareAuthorizationParams, Provider, ProxyApi, RecoveryMethod, RecoveryParams, RevokePermissionsRequestParams, SDKConfiguration, SDKOverrides, SessionResponse, ShieldAuthOptions, ShieldConfiguration, ShieldOptions, SignAuthorizationParams, SignedAuthorization, SignedMessagePayload, Signer, IStorage as Storage, ThirdPartyAuthConfiguration, ThirdPartyAuthProvider as ThirdPartyOAuthProvider, TokenType, TransactionIntentResponse, TypedDataPayload, UserApi, WrongRecoveryPasswordError, openfortEvents, prepareAndSignAuthorization, serializeSignedAuthorization, signAuthorization };
@@ -1 +1 @@
1
- import e from"axios";import t from"axios-retry";const s="https://api.openfort.io".replace(/\/+$/,"");class n{basePath;axios;configuration;constructor(t,n=s,a=e){this.basePath=n,this.axios=a,t&&(this.configuration=t,this.basePath=t.basePath||this.basePath)}}class a extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const i="https://example.com",o=function(e,t,s){if(null==s)throw new a(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},r=async function(e,t){if(t&&t.accessToken){const s="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+s}};function c(e,t,s=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach(t=>c(e,t,s)):Object.keys(t).forEach(n=>c(e,t[n],`${s}${""!==s?".":""}${n}`)):e.has(s)?e.append(s,t):e.set(s,t))}const h=function(e,...t){const s=new URLSearchParams(e.search);c(s,t),e.search=s.toString()},u=function(e,t,s){const n="string"!=typeof e;return(n&&s&&s.isJsonMime?s.isJsonMime(t.headers["Content-Type"]):n)?JSON.stringify(void 0!==e?e:{}):e||""},d=function(e){return e.pathname+e.search+e.hash},l=function(e,t,s,n){return(a=t,i=s)=>{const o={...e.options,url:(n?.basePath||a.defaults.baseURL||i)+e.url};return a.request(o)}},p=function(t){const n=function(e){return{cancelTransferOwnership:async(t,s,n={})=>{o("cancelTransferOwnership","id",t),o("cancelTransferOwnership","cancelTransferOwnershipRequest",s);const a="/v1/accounts/{id}/cancel_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},y={};await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},completeRecovery:async(t,s,n={})=>{o("completeRecovery","id",t),o("completeRecovery","completeRecoveryRequest",s);const a="/v1/accounts/{id}/complete_recovery".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},y={};await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},createAccount:async(t,s={})=>{o("createAccount","createAccountRequest",t);const n=new URL("/v1/accounts",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},createAccountV2:async(t,s={})=>{o("createAccountV2","createAccountRequestV2",t);const n=new URL("/v2/accounts",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},deployAccount:async(t,s,n={})=>{o("deployAccount","id",t),o("deployAccount","deployRequest",s);const a="/v1/accounts/{id}/deploy".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},y={};await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},disableAccount:async(t,s={})=>{o("disableAccount","id",t);const n="/v1/accounts/{id}/disable".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,i);let c;e&&(c=e.baseOptions);const u={method:"POST",...c,...s},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},getAccount:async(t,s,n={})=>{o("getAccount","id",t);const a="/v1/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},y={};await r(p,e),s&&(y.expand=s),h(c,y);let g=u&&u.headers?u.headers:{};return l.headers={...p,...g,...n.headers},{url:d(c),options:l}},getAccountV2:async(t,s={})=>{o("getAccountV2","id",t);const n="/v2/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,i);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...s},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},getAccounts:async(t,s,n,a,o,c,u,l={})=>{const p=new URL("/v1/accounts",i);let y;e&&(y=e.baseOptions);const g={method:"GET",...y,...l},w={},m={};await r(w,e),void 0!==t&&(m.limit=t),void 0!==s&&(m.skip=s),void 0!==n&&(m.order=n),void 0!==a&&(m.chainId=a),void 0!==o&&(m.player=o),void 0!==c&&(m.address=c),u&&(m.expand=u),h(p,m);let R=y&&y.headers?y.headers:{};return g.headers={...w,...R,...l.headers},{url:d(p),options:g}},getAccountsV2:async(t,s,n,a,o,c,u,l,p={})=>{const y=new URL("/v2/accounts",i);let g;e&&(g=e.baseOptions);const w={method:"GET",...g,...p},m={},R={};await r(m,e),void 0!==t&&(R.limit=t),void 0!==s&&(R.skip=s),void 0!==n&&(R.order=n),void 0!==a&&(R.chainId=a),void 0!==o&&(R.user=o),void 0!==c&&(R.chainType=c),void 0!==u&&(R.accountType=u),void 0!==l&&(R.address=l),h(y,R);let f=g&&g.headers?g.headers:{};return w.headers={...m,...f,...p.headers},{url:d(y),options:w}},getSignerIdByAddress:async(t,s={})=>{o("getSignerIdByAddress","address",t);const n=new URL("/v2/accounts/signer",i);let a;e&&(a=e.baseOptions);const c={method:"GET",...a,...s},u={},l={};await r(u,e),void 0!==t&&(l.address=t),h(n,l);let p=a&&a.headers?a.headers:{};return c.headers={...u,...p,...s.headers},{url:d(n),options:c}},requestTransferOwnership:async(t,s,n={})=>{o("requestTransferOwnership","id",t),o("requestTransferOwnership","transferOwnershipRequest",s);const a="/v1/accounts/{id}/request_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},y={};await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},signPayload:async(t,s,n={})=>{o("signPayload","id",t),o("signPayload","signPayloadRequest",s);const a="/v1/accounts/{id}/sign_payload".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},y={};await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},startRecovery:async(t,s,n={})=>{o("startRecovery","id",t),o("startRecovery","startRecoveryRequest",s);const a="/v1/accounts/{id}/start_recovery".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},y={};await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},switchChainV2:async(t,s={})=>{o("switchChainV2","switchChainQueriesV2",t);const n=new URL("/v2/accounts/switch-chain",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},syncAccount:async(t,s={})=>{o("syncAccount","id",t);const n="/v1/accounts/{id}/sync".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,i);let c;e&&(c=e.baseOptions);const u={method:"POST",...c,...s},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}}}}(t);return{async cancelTransferOwnership(a,i,o){const r=await n.cancelTransferOwnership(a,i,o);return l(r,e,s,t)},async completeRecovery(a,i,o){const r=await n.completeRecovery(a,i,o);return l(r,e,s,t)},async createAccount(a,i){const o=await n.createAccount(a,i);return l(o,e,s,t)},async createAccountV2(a,i){const o=await n.createAccountV2(a,i);return l(o,e,s,t)},async deployAccount(a,i,o){const r=await n.deployAccount(a,i,o);return l(r,e,s,t)},async disableAccount(a,i){const o=await n.disableAccount(a,i);return l(o,e,s,t)},async getAccount(a,i,o){const r=await n.getAccount(a,i,o);return l(r,e,s,t)},async getAccountV2(a,i){const o=await n.getAccountV2(a,i);return l(o,e,s,t)},async getAccounts(a,i,o,r,c,h,u,d){const p=await n.getAccounts(a,i,o,r,c,h,u,d);return l(p,e,s,t)},async getAccountsV2(a,i,o,r,c,h,u,d,p){const y=await n.getAccountsV2(a,i,o,r,c,h,u,d,p);return l(y,e,s,t)},async getSignerIdByAddress(a,i){const o=await n.getSignerIdByAddress(a,i);return l(o,e,s,t)},async requestTransferOwnership(a,i,o){const r=await n.requestTransferOwnership(a,i,o);return l(r,e,s,t)},async signPayload(a,i,o){const r=await n.signPayload(a,i,o);return l(r,e,s,t)},async startRecovery(a,i,o){const r=await n.startRecovery(a,i,o);return l(r,e,s,t)},async switchChainV2(a,i){const o=await n.switchChainV2(a,i);return l(o,e,s,t)},async syncAccount(a,i){const o=await n.syncAccount(a,i);return l(o,e,s,t)}}};class y extends n{cancelTransferOwnership(e,t){return p(this.configuration).cancelTransferOwnership(e.id,e.cancelTransferOwnershipRequest,t).then(e=>e(this.axios,this.basePath))}completeRecovery(e,t){return p(this.configuration).completeRecovery(e.id,e.completeRecoveryRequest,t).then(e=>e(this.axios,this.basePath))}createAccount(e,t){return p(this.configuration).createAccount(e.createAccountRequest,t).then(e=>e(this.axios,this.basePath))}createAccountV2(e,t){return p(this.configuration).createAccountV2(e.createAccountRequestV2,t).then(e=>e(this.axios,this.basePath))}deployAccount(e,t){return p(this.configuration).deployAccount(e.id,e.deployRequest,t).then(e=>e(this.axios,this.basePath))}disableAccount(e,t){return p(this.configuration).disableAccount(e.id,t).then(e=>e(this.axios,this.basePath))}getAccount(e,t){return p(this.configuration).getAccount(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}getAccountV2(e,t){return p(this.configuration).getAccountV2(e.id,t).then(e=>e(this.axios,this.basePath))}getAccounts(e={},t){return p(this.configuration).getAccounts(e.limit,e.skip,e.order,e.chainId,e.player,e.address,e.expand,t).then(e=>e(this.axios,this.basePath))}getAccountsV2(e={},t){return p(this.configuration).getAccountsV2(e.limit,e.skip,e.order,e.chainId,e.user,e.chainType,e.accountType,e.address,t).then(e=>e(this.axios,this.basePath))}getSignerIdByAddress(e,t){return p(this.configuration).getSignerIdByAddress(e.address,t).then(e=>e(this.axios,this.basePath))}requestTransferOwnership(e,t){return p(this.configuration).requestTransferOwnership(e.id,e.transferOwnershipRequest,t).then(e=>e(this.axios,this.basePath))}signPayload(e,t){return p(this.configuration).signPayload(e.id,e.signPayloadRequest,t).then(e=>e(this.axios,this.basePath))}startRecovery(e,t){return p(this.configuration).startRecovery(e.id,e.startRecoveryRequest,t).then(e=>e(this.axios,this.basePath))}switchChainV2(e,t){return p(this.configuration).switchChainV2(e.switchChainQueriesV2,t).then(e=>e(this.axios,this.basePath))}syncAccount(e,t){return p(this.configuration).syncAccount(e.id,t).then(e=>e(this.axios,this.basePath))}}const g=function(t){const n=function(e){return{authenticateSIWE:async(t,s={})=>{o("authenticateSIWE","sIWEAuthenticateRequest",t);const n=new URL("/iam/v1/siwe/authenticate",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},getJwks:async(t,s={})=>{o("getJwks","publishableKey",t);const n="/iam/v1/{publishable_key}/jwks.json".replace("{publishable_key}",encodeURIComponent(String(t))),a=new URL(n,i);let r;e&&(r=e.baseOptions);const c={method:"GET",...r,...s};h(a,{});let u=r&&r.headers?r.headers:{};return c.headers={...u,...s.headers},{url:d(a),options:c}},initOAuth:async(t,s,n={})=>{o("initOAuth","oAuthInitRequest",t);const a=new URL("/iam/v1/oauth/init",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},initSIWE:async(t,s,n={})=>{o("initSIWE","sIWERequest",t);const a=new URL("/iam/v1/siwe/init",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},linkEmail:async(t,s,n={})=>{o("linkEmail","loginRequest",t);const a=new URL("/iam/v1/password/link",i);let r;e&&(r=e.baseOptions);const c={method:"POST",...r,...n},l={};null!=s&&(l["x-game"]=String(s)),l["Content-Type"]="application/json",h(a,{});let p=r&&r.headers?r.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(a),options:c}},linkOAuth:async(t,s,n={})=>{o("linkOAuth","oAuthInitRequest",t);const a=new URL("/iam/v1/oauth/init_link",i);let r;e&&(r=e.baseOptions);const c={method:"POST",...r,...n},l={};null!=s&&(l["x-game"]=String(s)),l["Content-Type"]="application/json",h(a,{});let p=r&&r.headers?r.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(a),options:c}},linkSIWE:async(t,s={})=>{o("linkSIWE","sIWEAuthenticateRequest",t);const n=new URL("/iam/v1/siwe/link",i);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},linkThirdParty:async(t,s,n={})=>{o("linkThirdParty","thirdPartyLinkRequest",t);const a=new URL("/iam/v1/oauth/link",i);let r;e&&(r=e.baseOptions);const c={method:"POST",...r,...n},l={};null!=s&&(l["x-game"]=String(s)),l["Content-Type"]="application/json",h(a,{});let p=r&&r.headers?r.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(a),options:c}},loginEmailPassword:async(t,s,n={})=>{o("loginEmailPassword","loginRequest",t);const a=new URL("/iam/v1/password/login",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},loginOIDC:async(t,s,n={})=>{o("loginOIDC","loginOIDCRequest",t);const a=new URL("/iam/v1/oidc/login",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},loginWithIdToken:async(t,s={})=>{o("loginWithIdToken","loginWithIdTokenRequest",t);const n=new URL("/iam/v1/oauth/login_id_token",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},logout:async(t,s={})=>{o("logout","logoutRequest",t);const n=new URL("/iam/v1/sessions/logout",i);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},me:async(t={})=>{const s=new URL("/iam/v1/me",i);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let o=n&&n.headers?n.headers:{};return a.headers={...o,...t.headers},{url:d(s),options:a}},poolOAuth:async(t,s={})=>{o("poolOAuth","key",t);const n=new URL("/iam/v1/oauth/pool",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},u={},l={};await r(u,e),void 0!==t&&(l.key=t),h(n,l);let p=a&&a.headers?a.headers:{};return c.headers={...u,...p,...s.headers},{url:d(n),options:c}},refresh:async(t,s={})=>{o("refresh","refreshTokenRequest",t);const n=new URL("/iam/v1/sessions",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},registerGuest:async(t,s={})=>{const n=new URL("/iam/v1/guest",i);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...s},c={};await r(c,e),null!=t&&(c["x-game"]=String(t)),h(n,{});let u=a&&a.headers?a.headers:{};return o.headers={...c,...u,...s.headers},{url:d(n),options:o}},requestEmailVerification:async(t,s={})=>{o("requestEmailVerification","requestVerifyEmailRequest",t);const n=new URL("/iam/v1/password/request_email_verification",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},requestResetPassword:async(t,s={})=>{o("requestResetPassword","requestResetPasswordRequest",t);const n=new URL("/iam/v1/password/request_reset",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},resetPassword:async(t,s={})=>{o("resetPassword","resetPasswordRequest",t);const n=new URL("/iam/v1/password/reset",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},signupEmailPassword:async(t,s,n={})=>{o("signupEmailPassword","signupRequest",t);const a=new URL("/iam/v1/password/signup",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},thirdParty:async(t,s,n={})=>{o("thirdParty","thirdPartyOAuthRequest",t);const a=new URL("/iam/v1/oauth/third_party",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},unlinkEmail:async(t,s={})=>{o("unlinkEmail","unlinkEmailRequest",t);const n=new URL("/iam/v1/password/unlink",i);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},unlinkOAuth:async(t,s={})=>{o("unlinkOAuth","unlinkOAuthRequest",t);const n=new URL("/iam/v1/oauth/unlink",i);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},unlinkSIWE:async(t,s={})=>{o("unlinkSIWE","sIWERequest",t);const n=new URL("/iam/v1/siwe/unlink",i);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}},verifyEmail:async(t,s={})=>{o("verifyEmail","verifyEmailRequest",t);const n=new URL("/iam/v1/password/verify_email",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},verifyOAuthToken:async(t,s={})=>{o("verifyOAuthToken","authenticateOAuthRequest",t);const n=new URL("/iam/v1/oauth/verify",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}}}}(t);return{async authenticateSIWE(a,i){const o=await n.authenticateSIWE(a,i);return l(o,e,s,t)},async getJwks(a,i){const o=await n.getJwks(a,i);return l(o,e,s,t)},async initOAuth(a,i,o){const r=await n.initOAuth(a,i,o);return l(r,e,s,t)},async initSIWE(a,i,o){const r=await n.initSIWE(a,i,o);return l(r,e,s,t)},async linkEmail(a,i,o){const r=await n.linkEmail(a,i,o);return l(r,e,s,t)},async linkOAuth(a,i,o){const r=await n.linkOAuth(a,i,o);return l(r,e,s,t)},async linkSIWE(a,i){const o=await n.linkSIWE(a,i);return l(o,e,s,t)},async linkThirdParty(a,i,o){const r=await n.linkThirdParty(a,i,o);return l(r,e,s,t)},async loginEmailPassword(a,i,o){const r=await n.loginEmailPassword(a,i,o);return l(r,e,s,t)},async loginOIDC(a,i,o){const r=await n.loginOIDC(a,i,o);return l(r,e,s,t)},async loginWithIdToken(a,i){const o=await n.loginWithIdToken(a,i);return l(o,e,s,t)},async logout(a,i){const o=await n.logout(a,i);return l(o,e,s,t)},async me(a){const i=await n.me(a);return l(i,e,s,t)},async poolOAuth(a,i){const o=await n.poolOAuth(a,i);return l(o,e,s,t)},async refresh(a,i){const o=await n.refresh(a,i);return l(o,e,s,t)},async registerGuest(a,i){const o=await n.registerGuest(a,i);return l(o,e,s,t)},async requestEmailVerification(a,i){const o=await n.requestEmailVerification(a,i);return l(o,e,s,t)},async requestResetPassword(a,i){const o=await n.requestResetPassword(a,i);return l(o,e,s,t)},async resetPassword(a,i){const o=await n.resetPassword(a,i);return l(o,e,s,t)},async signupEmailPassword(a,i,o){const r=await n.signupEmailPassword(a,i,o);return l(r,e,s,t)},async thirdParty(a,i,o){const r=await n.thirdParty(a,i,o);return l(r,e,s,t)},async unlinkEmail(a,i){const o=await n.unlinkEmail(a,i);return l(o,e,s,t)},async unlinkOAuth(a,i){const o=await n.unlinkOAuth(a,i);return l(o,e,s,t)},async unlinkSIWE(a,i){const o=await n.unlinkSIWE(a,i);return l(o,e,s,t)},async verifyEmail(a,i){const o=await n.verifyEmail(a,i);return l(o,e,s,t)},async verifyOAuthToken(a,i){const o=await n.verifyOAuthToken(a,i);return l(o,e,s,t)}}};class w extends n{authenticateSIWE(e,t){return g(this.configuration).authenticateSIWE(e.sIWEAuthenticateRequest,t).then(e=>e(this.axios,this.basePath))}getJwks(e,t){return g(this.configuration).getJwks(e.publishableKey,t).then(e=>e(this.axios,this.basePath))}initOAuth(e,t){return g(this.configuration).initOAuth(e.oAuthInitRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}initSIWE(e,t){return g(this.configuration).initSIWE(e.sIWERequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkEmail(e,t){return g(this.configuration).linkEmail(e.loginRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkOAuth(e,t){return g(this.configuration).linkOAuth(e.oAuthInitRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkSIWE(e,t){return g(this.configuration).linkSIWE(e.sIWEAuthenticateRequest,t).then(e=>e(this.axios,this.basePath))}linkThirdParty(e,t){return g(this.configuration).linkThirdParty(e.thirdPartyLinkRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginEmailPassword(e,t){return g(this.configuration).loginEmailPassword(e.loginRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginOIDC(e,t){return g(this.configuration).loginOIDC(e.loginOIDCRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginWithIdToken(e,t){return g(this.configuration).loginWithIdToken(e.loginWithIdTokenRequest,t).then(e=>e(this.axios,this.basePath))}logout(e,t){return g(this.configuration).logout(e.logoutRequest,t).then(e=>e(this.axios,this.basePath))}me(e){return g(this.configuration).me(e).then(e=>e(this.axios,this.basePath))}poolOAuth(e,t){return g(this.configuration).poolOAuth(e.key,t).then(e=>e(this.axios,this.basePath))}refresh(e,t){return g(this.configuration).refresh(e.refreshTokenRequest,t).then(e=>e(this.axios,this.basePath))}registerGuest(e={},t){return g(this.configuration).registerGuest(e.xGame,t).then(e=>e(this.axios,this.basePath))}requestEmailVerification(e,t){return g(this.configuration).requestEmailVerification(e.requestVerifyEmailRequest,t).then(e=>e(this.axios,this.basePath))}requestResetPassword(e,t){return g(this.configuration).requestResetPassword(e.requestResetPasswordRequest,t).then(e=>e(this.axios,this.basePath))}resetPassword(e,t){return g(this.configuration).resetPassword(e.resetPasswordRequest,t).then(e=>e(this.axios,this.basePath))}signupEmailPassword(e,t){return g(this.configuration).signupEmailPassword(e.signupRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}thirdParty(e,t){return g(this.configuration).thirdParty(e.thirdPartyOAuthRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}unlinkEmail(e,t){return g(this.configuration).unlinkEmail(e.unlinkEmailRequest,t).then(e=>e(this.axios,this.basePath))}unlinkOAuth(e,t){return g(this.configuration).unlinkOAuth(e.unlinkOAuthRequest,t).then(e=>e(this.axios,this.basePath))}unlinkSIWE(e,t){return g(this.configuration).unlinkSIWE(e.sIWERequest,t).then(e=>e(this.axios,this.basePath))}verifyEmail(e,t){return g(this.configuration).verifyEmail(e.verifyEmailRequest,t).then(e=>e(this.axios,this.basePath))}verifyOAuthToken(e,t){return g(this.configuration).verifyOAuthToken(e.authenticateOAuthRequest,t).then(e=>e(this.axios,this.basePath))}}const m=function(t){const n=function(e){return{handleRpcRequest:async(t,s={})=>{o("handleRpcRequest","jsonRpcRequest",t);const n=new URL("/rpc",i);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...s},c={"Content-Type":"application/json"};h(n,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...s.headers},r.data=u(t,r,e),{url:d(n),options:r}}}}(t);return{async handleRpcRequest(a,i){const o=await n.handleRpcRequest(a,i);return l(o,e,s,t)}}};class R extends n{handleRpcRequest(e,t){return m(this.configuration).handleRpcRequest(e.jsonRpcRequest,t).then(e=>e(this.axios,this.basePath))}}const f=function(t){const n=function(e){return{createSession:async(t,s,n={})=>{o("createSession","createSessionRequest",t);const a=new URL("/v1/sessions",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["X-Behalf-Of-Project"]=String(s)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},getPlayerSessions:async(t,s,n,a,c,u={})=>{o("getPlayerSessions","player",t);const l=new URL("/v1/sessions",i);let p;e&&(p=e.baseOptions);const y={method:"GET",...p,...u},g={},w={};await r(g,e),void 0!==s&&(w.limit=s),void 0!==n&&(w.skip=n),void 0!==a&&(w.order=a),void 0!==t&&(w.player=t),c&&(w.expand=c),h(l,w);let m=p&&p.headers?p.headers:{};return y.headers={...g,...m,...u.headers},{url:d(l),options:y}},getSession:async(t,s,n={})=>{o("getSession","id",t);const a="/v1/sessions/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},y={};await r(p,e),s&&(y.expand=s),h(c,y);let g=u&&u.headers?u.headers:{};return l.headers={...p,...g,...n.headers},{url:d(c),options:l}},revokeSession:async(t,s,n={})=>{o("revokeSession","revokeSessionRequest",t);const a=new URL("/v1/sessions/revoke",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["X-Behalf-Of-Project"]=String(s)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},signatureSession:async(t,s,n={})=>{o("signatureSession","id",t),o("signatureSession","signatureRequest",s);const a="/v1/sessions/{id}/signature".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},y={};await r(y,e),await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}}}}(t);return{async createSession(a,i,o){const r=await n.createSession(a,i,o);return l(r,e,s,t)},async getPlayerSessions(a,i,o,r,c,h){const u=await n.getPlayerSessions(a,i,o,r,c,h);return l(u,e,s,t)},async getSession(a,i,o){const r=await n.getSession(a,i,o);return l(r,e,s,t)},async revokeSession(a,i,o){const r=await n.revokeSession(a,i,o);return l(r,e,s,t)},async signatureSession(a,i,o){const r=await n.signatureSession(a,i,o);return l(r,e,s,t)}}};class P extends n{createSession(e,t){return f(this.configuration).createSession(e.createSessionRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}getPlayerSessions(e,t){return f(this.configuration).getPlayerSessions(e.player,e.limit,e.skip,e.order,e.expand,t).then(e=>e(this.axios,this.basePath))}getSession(e,t){return f(this.configuration).getSession(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}revokeSession(e,t){return f(this.configuration).revokeSession(e.revokeSessionRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}signatureSession(e,t){return f(this.configuration).signatureSession(e.id,e.signatureRequest,t).then(e=>e(this.axios,this.basePath))}}const T=function(t){const n=function(e){return{createTransactionIntent:async(t,s,n={})=>{o("createTransactionIntent","createTransactionIntentRequest",t);const a=new URL("/v1/transaction_intents",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...n},p={};await r(p,e),null!=s&&(p["X-Behalf-Of-Project"]=String(s)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},estimateTransactionIntentCost:async(t,s={})=>{o("estimateTransactionIntentCost","createTransactionIntentRequest",t);const n=new URL("/v1/transaction_intents/estimate_gas_cost",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",h(n,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(n),options:c}},getTransactionIntent:async(t,s,n={})=>{o("getTransactionIntent","id",t);const a="/v1/transaction_intents/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},y={};await r(p,e),s&&(y.expand=s),h(c,y);let g=u&&u.headers?u.headers:{};return l.headers={...p,...g,...n.headers},{url:d(c),options:l}},getTransactionIntents:async(t,s,n,a,o,c,u,l,p,y={})=>{const g=new URL("/v1/transaction_intents",i);let w;e&&(w=e.baseOptions);const m={method:"GET",...w,...y},R={},f={};await r(R,e),void 0!==t&&(f.limit=t),void 0!==s&&(f.skip=s),void 0!==n&&(f.order=n),a&&(f.expand=a),void 0!==o&&(f.chainId=o),c&&(f.account=c),u&&(f.player=u),void 0!==l&&(f.status=l),p&&(f.policy=p),h(g,f);let P=w&&w.headers?w.headers:{};return m.headers={...R,...P,...y.headers},{url:d(g),options:m}},signature:async(t,s,n={})=>{o("signature","id",t),o("signature","signatureRequest",s);const a="/v1/transaction_intents/{id}/signature".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},y={};await r(y,e),await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}}}}(t);return{async createTransactionIntent(a,i,o){const r=await n.createTransactionIntent(a,i,o);return l(r,e,s,t)},async estimateTransactionIntentCost(a,i){const o=await n.estimateTransactionIntentCost(a,i);return l(o,e,s,t)},async getTransactionIntent(a,i,o){const r=await n.getTransactionIntent(a,i,o);return l(r,e,s,t)},async getTransactionIntents(a,i,o,r,c,h,u,d,p,y){const g=await n.getTransactionIntents(a,i,o,r,c,h,u,d,p,y);return l(g,e,s,t)},async signature(a,i,o){const r=await n.signature(a,i,o);return l(r,e,s,t)}}};class O extends n{createTransactionIntent(e,t){return T(this.configuration).createTransactionIntent(e.createTransactionIntentRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}estimateTransactionIntentCost(e,t){return T(this.configuration).estimateTransactionIntentCost(e.createTransactionIntentRequest,t).then(e=>e(this.axios,this.basePath))}getTransactionIntent(e,t){return T(this.configuration).getTransactionIntent(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}getTransactionIntents(e={},t){return T(this.configuration).getTransactionIntents(e.limit,e.skip,e.order,e.expand,e.chainId,e.account,e.player,e.status,e.policy,t).then(e=>e(this.axios,this.basePath))}signature(e,t){return T(this.configuration).signature(e.id,e.signatureRequest,t).then(e=>e(this.axios,this.basePath))}}class b{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const v=({basePath:e,accessToken:t,nativeAppIdentifier:s})=>{if(!e.trim())throw Error("basePath can not be empty");const n={basePath:e,accessToken:t};return s&&(n.baseOptions={headers:{"x-native-app-identifier":s}}),new b(n)};class S{config;transactionIntentsApi;accountsApi;rpcApi;sessionsApi;authenticationApi;storage;onLogout;axiosInstance;constructor(s){this.storage=s.storage,this.onLogout=s.onLogout,this.axiosInstance=e.create(),t(this.axiosInstance,{retries:3,retryDelay:t.exponentialDelay,retryCondition:t.isRetryableError}),this.setupInterceptors();const n={basePath:s.basePath,accessToken:s.accessToken,nativeAppIdentifier:s.nativeAppIdentifier};this.config={backend:v(n)},this.transactionIntentsApi=new O(this.config.backend,void 0,this.axiosInstance),this.accountsApi=new y(this.config.backend,void 0,this.axiosInstance),this.sessionsApi=new P(this.config.backend,void 0,this.axiosInstance),this.rpcApi=new R(this.config.backend,void 0,this.axiosInstance),this.authenticationApi=new w(this.config.backend,void 0,this.axiosInstance)}setupInterceptors(){this.axiosInstance.interceptors.response.use(e=>e,async e=>(401===e.response?.status&&(await this.clearAuthenticationState(),this.emitLogoutEvent()),Promise.reject(e)))}async clearAuthenticationState(){if(this.storage)try{this.storage.remove("openfort.authentication"),this.storage.remove("openfort.account"),this.storage.remove("openfort.session"),this.storage.remove("openfort.pkce_state"),this.storage.remove("openfort.pkce_verifier")}catch(e){}}emitLogoutEvent(){if(this.onLogout)try{this.onLogout()}catch(e){}}}export{S as BackendApiClients,v as createConfig};
1
+ import e from"axios";import t from"axios-retry";const n="https://api.openfort.io".replace(/\/+$/,"");class s{basePath;axios;configuration;constructor(t,s=n,a=e){this.basePath=s,this.axios=a,t&&(this.configuration=t,this.basePath=t.basePath||this.basePath)}}class a extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const i="https://example.com",o=function(e,t,n){if(null==n)throw new a(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},r=async function(e,t){if(t&&t.accessToken){const n="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+n}};function c(e,t,n=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach(t=>c(e,t,n)):Object.keys(t).forEach(s=>c(e,t[s],`${n}${""!==n?".":""}${s}`)):e.has(n)?e.append(n,t):e.set(n,t))}const h=function(e,...t){const n=new URLSearchParams(e.search);c(n,t),e.search=n.toString()},u=function(e,t,n){const s="string"!=typeof e;return(s&&n&&n.isJsonMime?n.isJsonMime(t.headers["Content-Type"]):s)?JSON.stringify(void 0!==e?e:{}):e||""},d=function(e){return e.pathname+e.search+e.hash},l=function(e,t,n,s){return(a=t,i=n)=>{const o={...e.options,url:(s?.basePath||a.defaults.baseURL||i)+e.url};return a.request(o)}},p=function(t){const s=function(e){return{cancelTransferOwnership:async(t,n,s={})=>{o("cancelTransferOwnership","id",t),o("cancelTransferOwnership","cancelTransferOwnershipRequest",n);const a="/v1/accounts/{id}/cancel_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=u(n,p,e),{url:d(c),options:p}},completeRecovery:async(t,n,s={})=>{o("completeRecovery","id",t),o("completeRecovery","completeRecoveryRequest",n);const a="/v1/accounts/{id}/complete_recovery".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=u(n,p,e),{url:d(c),options:p}},createAccount:async(t,n={})=>{o("createAccount","createAccountRequest",t);const s=new URL("/v1/accounts",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...n},l={};await r(l,e),l["Content-Type"]="application/json",h(s,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(s),options:c}},createAccountV2:async(t,n={})=>{o("createAccountV2","createAccountRequestV2",t);const s=new URL("/v2/accounts",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...n},l={};await r(l,e),l["Content-Type"]="application/json",h(s,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(s),options:c}},deployAccount:async(t,n,s={})=>{o("deployAccount","id",t),o("deployAccount","deployRequest",n);const a="/v1/accounts/{id}/deploy".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=u(n,p,e),{url:d(c),options:p}},disableAccount:async(t,n={})=>{o("disableAccount","id",t);const s="/v1/accounts/{id}/disable".replace("{id}",encodeURIComponent(String(t))),a=new URL(s,i);let c;e&&(c=e.baseOptions);const u={method:"POST",...c,...n},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...n.headers},{url:d(a),options:u}},getAccount:async(t,n,s={})=>{o("getAccount","id",t);const a="/v1/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...s},p={},y={};await r(p,e),n&&(y.expand=n),h(c,y);let g=u&&u.headers?u.headers:{};return l.headers={...p,...g,...s.headers},{url:d(c),options:l}},getAccountV2:async(t,n={})=>{o("getAccountV2","id",t);const s="/v2/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(s,i);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...n},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...n.headers},{url:d(a),options:u}},getAccounts:async(t,n,s,a,o,c,u,l={})=>{const p=new URL("/v1/accounts",i);let y;e&&(y=e.baseOptions);const g={method:"GET",...y,...l},w={},m={};await r(w,e),void 0!==t&&(m.limit=t),void 0!==n&&(m.skip=n),void 0!==s&&(m.order=s),void 0!==a&&(m.chainId=a),void 0!==o&&(m.player=o),void 0!==c&&(m.address=c),u&&(m.expand=u),h(p,m);let R=y&&y.headers?y.headers:{};return g.headers={...w,...R,...l.headers},{url:d(p),options:g}},getAccountsV2:async(t,n,s,a,o,c,u,l,p={})=>{const y=new URL("/v2/accounts",i);let g;e&&(g=e.baseOptions);const w={method:"GET",...g,...p},m={},R={};await r(m,e),void 0!==t&&(R.limit=t),void 0!==n&&(R.skip=n),void 0!==s&&(R.order=s),void 0!==a&&(R.chainId=a),void 0!==o&&(R.user=o),void 0!==c&&(R.chainType=c),void 0!==u&&(R.accountType=u),void 0!==l&&(R.address=l),h(y,R);let f=g&&g.headers?g.headers:{};return w.headers={...m,...f,...p.headers},{url:d(y),options:w}},getSignerIdByAddress:async(t,n={})=>{o("getSignerIdByAddress","address",t);const s=new URL("/v2/accounts/signer",i);let a;e&&(a=e.baseOptions);const c={method:"GET",...a,...n},u={},l={};await r(u,e),void 0!==t&&(l.address=t),h(s,l);let p=a&&a.headers?a.headers:{};return c.headers={...u,...p,...n.headers},{url:d(s),options:c}},removeAccount:async(t,n={})=>{o("removeAccount","id",t);const s="/v2/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(s,i);let c;e&&(c=e.baseOptions);const u={method:"DELETE",...c,...n},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...n.headers},{url:d(a),options:u}},requestTransferOwnership:async(t,n,s={})=>{o("requestTransferOwnership","id",t),o("requestTransferOwnership","transferOwnershipRequest",n);const a="/v1/accounts/{id}/request_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=u(n,p,e),{url:d(c),options:p}},signPayload:async(t,n,s={})=>{o("signPayload","id",t),o("signPayload","signPayloadRequest",n);const a="/v1/accounts/{id}/sign_payload".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=u(n,p,e),{url:d(c),options:p}},startRecovery:async(t,n,s={})=>{o("startRecovery","id",t),o("startRecovery","startRecoveryRequest",n);const a="/v1/accounts/{id}/start_recovery".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=u(n,p,e),{url:d(c),options:p}},switchChainV2:async(t,n={})=>{o("switchChainV2","switchChainQueriesV2",t);const s=new URL("/v2/accounts/switch-chain",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...n},l={};await r(l,e),l["Content-Type"]="application/json",h(s,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(s),options:c}},syncAccount:async(t,n={})=>{o("syncAccount","id",t);const s="/v1/accounts/{id}/sync".replace("{id}",encodeURIComponent(String(t))),a=new URL(s,i);let c;e&&(c=e.baseOptions);const u={method:"POST",...c,...n},l={};await r(l,e),h(a,{});let p=c&&c.headers?c.headers:{};return u.headers={...l,...p,...n.headers},{url:d(a),options:u}}}}(t);return{async cancelTransferOwnership(a,i,o){const r=await s.cancelTransferOwnership(a,i,o);return l(r,e,n,t)},async completeRecovery(a,i,o){const r=await s.completeRecovery(a,i,o);return l(r,e,n,t)},async createAccount(a,i){const o=await s.createAccount(a,i);return l(o,e,n,t)},async createAccountV2(a,i){const o=await s.createAccountV2(a,i);return l(o,e,n,t)},async deployAccount(a,i,o){const r=await s.deployAccount(a,i,o);return l(r,e,n,t)},async disableAccount(a,i){const o=await s.disableAccount(a,i);return l(o,e,n,t)},async getAccount(a,i,o){const r=await s.getAccount(a,i,o);return l(r,e,n,t)},async getAccountV2(a,i){const o=await s.getAccountV2(a,i);return l(o,e,n,t)},async getAccounts(a,i,o,r,c,h,u,d){const p=await s.getAccounts(a,i,o,r,c,h,u,d);return l(p,e,n,t)},async getAccountsV2(a,i,o,r,c,h,u,d,p){const y=await s.getAccountsV2(a,i,o,r,c,h,u,d,p);return l(y,e,n,t)},async getSignerIdByAddress(a,i){const o=await s.getSignerIdByAddress(a,i);return l(o,e,n,t)},async removeAccount(a,i){const o=await s.removeAccount(a,i);return l(o,e,n,t)},async requestTransferOwnership(a,i,o){const r=await s.requestTransferOwnership(a,i,o);return l(r,e,n,t)},async signPayload(a,i,o){const r=await s.signPayload(a,i,o);return l(r,e,n,t)},async startRecovery(a,i,o){const r=await s.startRecovery(a,i,o);return l(r,e,n,t)},async switchChainV2(a,i){const o=await s.switchChainV2(a,i);return l(o,e,n,t)},async syncAccount(a,i){const o=await s.syncAccount(a,i);return l(o,e,n,t)}}};class y extends s{cancelTransferOwnership(e,t){return p(this.configuration).cancelTransferOwnership(e.id,e.cancelTransferOwnershipRequest,t).then(e=>e(this.axios,this.basePath))}completeRecovery(e,t){return p(this.configuration).completeRecovery(e.id,e.completeRecoveryRequest,t).then(e=>e(this.axios,this.basePath))}createAccount(e,t){return p(this.configuration).createAccount(e.createAccountRequest,t).then(e=>e(this.axios,this.basePath))}createAccountV2(e,t){return p(this.configuration).createAccountV2(e.createAccountRequestV2,t).then(e=>e(this.axios,this.basePath))}deployAccount(e,t){return p(this.configuration).deployAccount(e.id,e.deployRequest,t).then(e=>e(this.axios,this.basePath))}disableAccount(e,t){return p(this.configuration).disableAccount(e.id,t).then(e=>e(this.axios,this.basePath))}getAccount(e,t){return p(this.configuration).getAccount(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}getAccountV2(e,t){return p(this.configuration).getAccountV2(e.id,t).then(e=>e(this.axios,this.basePath))}getAccounts(e={},t){return p(this.configuration).getAccounts(e.limit,e.skip,e.order,e.chainId,e.player,e.address,e.expand,t).then(e=>e(this.axios,this.basePath))}getAccountsV2(e={},t){return p(this.configuration).getAccountsV2(e.limit,e.skip,e.order,e.chainId,e.user,e.chainType,e.accountType,e.address,t).then(e=>e(this.axios,this.basePath))}getSignerIdByAddress(e,t){return p(this.configuration).getSignerIdByAddress(e.address,t).then(e=>e(this.axios,this.basePath))}removeAccount(e,t){return p(this.configuration).removeAccount(e.id,t).then(e=>e(this.axios,this.basePath))}requestTransferOwnership(e,t){return p(this.configuration).requestTransferOwnership(e.id,e.transferOwnershipRequest,t).then(e=>e(this.axios,this.basePath))}signPayload(e,t){return p(this.configuration).signPayload(e.id,e.signPayloadRequest,t).then(e=>e(this.axios,this.basePath))}startRecovery(e,t){return p(this.configuration).startRecovery(e.id,e.startRecoveryRequest,t).then(e=>e(this.axios,this.basePath))}switchChainV2(e,t){return p(this.configuration).switchChainV2(e.switchChainQueriesV2,t).then(e=>e(this.axios,this.basePath))}syncAccount(e,t){return p(this.configuration).syncAccount(e.id,t).then(e=>e(this.axios,this.basePath))}}const g=function(t){const s=function(e){return{authenticateSIWE:async(t,n={})=>{o("authenticateSIWE","sIWEAuthenticateRequest",t);const s=new URL("/iam/v1/siwe/authenticate",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...n},l={};await r(l,e),l["Content-Type"]="application/json",h(s,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(s),options:c}},getJwks:async(t,n={})=>{o("getJwks","publishableKey",t);const s="/iam/v1/{publishable_key}/jwks.json".replace("{publishable_key}",encodeURIComponent(String(t))),a=new URL(s,i);let r;e&&(r=e.baseOptions);const c={method:"GET",...r,...n};h(a,{});let u=r&&r.headers?r.headers:{};return c.headers={...u,...n.headers},{url:d(a),options:c}},initOAuth:async(t,n,s={})=>{o("initOAuth","oAuthInitRequest",t);const a=new URL("/iam/v1/oauth/init",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...s},p={};await r(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...s.headers},l.data=u(t,l,e),{url:d(a),options:l}},initSIWE:async(t,n,s={})=>{o("initSIWE","sIWERequest",t);const a=new URL("/iam/v1/siwe/init",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...s},p={};await r(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...s.headers},l.data=u(t,l,e),{url:d(a),options:l}},linkEmail:async(t,n,s={})=>{o("linkEmail","loginRequest",t);const a=new URL("/iam/v1/password/link",i);let r;e&&(r=e.baseOptions);const c={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",h(a,{});let p=r&&r.headers?r.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(a),options:c}},linkOAuth:async(t,n,s={})=>{o("linkOAuth","oAuthInitRequest",t);const a=new URL("/iam/v1/oauth/init_link",i);let r;e&&(r=e.baseOptions);const c={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",h(a,{});let p=r&&r.headers?r.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(a),options:c}},linkSIWE:async(t,n={})=>{o("linkSIWE","sIWEAuthenticateRequest",t);const s=new URL("/iam/v1/siwe/link",i);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...n},c={"Content-Type":"application/json"};h(s,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...n.headers},r.data=u(t,r,e),{url:d(s),options:r}},linkThirdParty:async(t,n,s={})=>{o("linkThirdParty","thirdPartyLinkRequest",t);const a=new URL("/iam/v1/oauth/link",i);let r;e&&(r=e.baseOptions);const c={method:"POST",...r,...s},l={};null!=n&&(l["x-game"]=String(n)),l["Content-Type"]="application/json",h(a,{});let p=r&&r.headers?r.headers:{};return c.headers={...l,...p,...s.headers},c.data=u(t,c,e),{url:d(a),options:c}},loginEmailPassword:async(t,n,s={})=>{o("loginEmailPassword","loginRequest",t);const a=new URL("/iam/v1/password/login",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...s},p={};await r(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...s.headers},l.data=u(t,l,e),{url:d(a),options:l}},loginOIDC:async(t,n,s={})=>{o("loginOIDC","loginOIDCRequest",t);const a=new URL("/iam/v1/oidc/login",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...s},p={};await r(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...s.headers},l.data=u(t,l,e),{url:d(a),options:l}},loginWithIdToken:async(t,n={})=>{o("loginWithIdToken","loginWithIdTokenRequest",t);const s=new URL("/iam/v1/oauth/login_id_token",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...n},l={};await r(l,e),l["Content-Type"]="application/json",h(s,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(s),options:c}},logout:async(t,n={})=>{o("logout","logoutRequest",t);const s=new URL("/iam/v1/sessions/logout",i);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...n},c={"Content-Type":"application/json"};h(s,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...n.headers},r.data=u(t,r,e),{url:d(s),options:r}},me:async(t={})=>{const n=new URL("/iam/v1/me",i);let s;e&&(s=e.baseOptions);const a={method:"GET",...s,...t};h(n,{});let o=s&&s.headers?s.headers:{};return a.headers={...o,...t.headers},{url:d(n),options:a}},poolOAuth:async(t,n={})=>{o("poolOAuth","key",t);const s=new URL("/iam/v1/oauth/pool",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...n},u={},l={};await r(u,e),void 0!==t&&(l.key=t),h(s,l);let p=a&&a.headers?a.headers:{};return c.headers={...u,...p,...n.headers},{url:d(s),options:c}},refresh:async(t,n={})=>{o("refresh","refreshTokenRequest",t);const s=new URL("/iam/v1/sessions",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...n},l={};await r(l,e),l["Content-Type"]="application/json",h(s,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(s),options:c}},registerGuest:async(t,n={})=>{const s=new URL("/iam/v1/guest",i);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...n},c={};await r(c,e),null!=t&&(c["x-game"]=String(t)),h(s,{});let u=a&&a.headers?a.headers:{};return o.headers={...c,...u,...n.headers},{url:d(s),options:o}},requestEmailVerification:async(t,n={})=>{o("requestEmailVerification","requestVerifyEmailRequest",t);const s=new URL("/iam/v1/password/request_email_verification",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...n},l={};await r(l,e),l["Content-Type"]="application/json",h(s,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(s),options:c}},requestResetPassword:async(t,n={})=>{o("requestResetPassword","requestResetPasswordRequest",t);const s=new URL("/iam/v1/password/request_reset",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...n},l={};await r(l,e),l["Content-Type"]="application/json",h(s,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(s),options:c}},resetPassword:async(t,n={})=>{o("resetPassword","resetPasswordRequest",t);const s=new URL("/iam/v1/password/reset",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...n},l={};await r(l,e),l["Content-Type"]="application/json",h(s,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(s),options:c}},signupEmailPassword:async(t,n,s={})=>{o("signupEmailPassword","signupRequest",t);const a=new URL("/iam/v1/password/signup",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...s},p={};await r(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...s.headers},l.data=u(t,l,e),{url:d(a),options:l}},thirdParty:async(t,n,s={})=>{o("thirdParty","thirdPartyOAuthRequest",t);const a=new URL("/iam/v1/oauth/third_party",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...s},p={};await r(p,e),null!=n&&(p["x-game"]=String(n)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...s.headers},l.data=u(t,l,e),{url:d(a),options:l}},unlinkEmail:async(t,n={})=>{o("unlinkEmail","unlinkEmailRequest",t);const s=new URL("/iam/v1/password/unlink",i);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...n},c={"Content-Type":"application/json"};h(s,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...n.headers},r.data=u(t,r,e),{url:d(s),options:r}},unlinkOAuth:async(t,n={})=>{o("unlinkOAuth","unlinkOAuthRequest",t);const s=new URL("/iam/v1/oauth/unlink",i);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...n},c={"Content-Type":"application/json"};h(s,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...n.headers},r.data=u(t,r,e),{url:d(s),options:r}},unlinkSIWE:async(t,n={})=>{o("unlinkSIWE","sIWERequest",t);const s=new URL("/iam/v1/siwe/unlink",i);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...n},c={"Content-Type":"application/json"};h(s,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...n.headers},r.data=u(t,r,e),{url:d(s),options:r}},verifyEmail:async(t,n={})=>{o("verifyEmail","verifyEmailRequest",t);const s=new URL("/iam/v1/password/verify_email",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...n},l={};await r(l,e),l["Content-Type"]="application/json",h(s,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(s),options:c}},verifyOAuthToken:async(t,n={})=>{o("verifyOAuthToken","authenticateOAuthRequest",t);const s=new URL("/iam/v1/oauth/verify",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...n},l={};await r(l,e),l["Content-Type"]="application/json",h(s,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(s),options:c}}}}(t);return{async authenticateSIWE(a,i){const o=await s.authenticateSIWE(a,i);return l(o,e,n,t)},async getJwks(a,i){const o=await s.getJwks(a,i);return l(o,e,n,t)},async initOAuth(a,i,o){const r=await s.initOAuth(a,i,o);return l(r,e,n,t)},async initSIWE(a,i,o){const r=await s.initSIWE(a,i,o);return l(r,e,n,t)},async linkEmail(a,i,o){const r=await s.linkEmail(a,i,o);return l(r,e,n,t)},async linkOAuth(a,i,o){const r=await s.linkOAuth(a,i,o);return l(r,e,n,t)},async linkSIWE(a,i){const o=await s.linkSIWE(a,i);return l(o,e,n,t)},async linkThirdParty(a,i,o){const r=await s.linkThirdParty(a,i,o);return l(r,e,n,t)},async loginEmailPassword(a,i,o){const r=await s.loginEmailPassword(a,i,o);return l(r,e,n,t)},async loginOIDC(a,i,o){const r=await s.loginOIDC(a,i,o);return l(r,e,n,t)},async loginWithIdToken(a,i){const o=await s.loginWithIdToken(a,i);return l(o,e,n,t)},async logout(a,i){const o=await s.logout(a,i);return l(o,e,n,t)},async me(a){const i=await s.me(a);return l(i,e,n,t)},async poolOAuth(a,i){const o=await s.poolOAuth(a,i);return l(o,e,n,t)},async refresh(a,i){const o=await s.refresh(a,i);return l(o,e,n,t)},async registerGuest(a,i){const o=await s.registerGuest(a,i);return l(o,e,n,t)},async requestEmailVerification(a,i){const o=await s.requestEmailVerification(a,i);return l(o,e,n,t)},async requestResetPassword(a,i){const o=await s.requestResetPassword(a,i);return l(o,e,n,t)},async resetPassword(a,i){const o=await s.resetPassword(a,i);return l(o,e,n,t)},async signupEmailPassword(a,i,o){const r=await s.signupEmailPassword(a,i,o);return l(r,e,n,t)},async thirdParty(a,i,o){const r=await s.thirdParty(a,i,o);return l(r,e,n,t)},async unlinkEmail(a,i){const o=await s.unlinkEmail(a,i);return l(o,e,n,t)},async unlinkOAuth(a,i){const o=await s.unlinkOAuth(a,i);return l(o,e,n,t)},async unlinkSIWE(a,i){const o=await s.unlinkSIWE(a,i);return l(o,e,n,t)},async verifyEmail(a,i){const o=await s.verifyEmail(a,i);return l(o,e,n,t)},async verifyOAuthToken(a,i){const o=await s.verifyOAuthToken(a,i);return l(o,e,n,t)}}};class w extends s{authenticateSIWE(e,t){return g(this.configuration).authenticateSIWE(e.sIWEAuthenticateRequest,t).then(e=>e(this.axios,this.basePath))}getJwks(e,t){return g(this.configuration).getJwks(e.publishableKey,t).then(e=>e(this.axios,this.basePath))}initOAuth(e,t){return g(this.configuration).initOAuth(e.oAuthInitRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}initSIWE(e,t){return g(this.configuration).initSIWE(e.sIWERequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkEmail(e,t){return g(this.configuration).linkEmail(e.loginRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkOAuth(e,t){return g(this.configuration).linkOAuth(e.oAuthInitRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkSIWE(e,t){return g(this.configuration).linkSIWE(e.sIWEAuthenticateRequest,t).then(e=>e(this.axios,this.basePath))}linkThirdParty(e,t){return g(this.configuration).linkThirdParty(e.thirdPartyLinkRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginEmailPassword(e,t){return g(this.configuration).loginEmailPassword(e.loginRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginOIDC(e,t){return g(this.configuration).loginOIDC(e.loginOIDCRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginWithIdToken(e,t){return g(this.configuration).loginWithIdToken(e.loginWithIdTokenRequest,t).then(e=>e(this.axios,this.basePath))}logout(e,t){return g(this.configuration).logout(e.logoutRequest,t).then(e=>e(this.axios,this.basePath))}me(e){return g(this.configuration).me(e).then(e=>e(this.axios,this.basePath))}poolOAuth(e,t){return g(this.configuration).poolOAuth(e.key,t).then(e=>e(this.axios,this.basePath))}refresh(e,t){return g(this.configuration).refresh(e.refreshTokenRequest,t).then(e=>e(this.axios,this.basePath))}registerGuest(e={},t){return g(this.configuration).registerGuest(e.xGame,t).then(e=>e(this.axios,this.basePath))}requestEmailVerification(e,t){return g(this.configuration).requestEmailVerification(e.requestVerifyEmailRequest,t).then(e=>e(this.axios,this.basePath))}requestResetPassword(e,t){return g(this.configuration).requestResetPassword(e.requestResetPasswordRequest,t).then(e=>e(this.axios,this.basePath))}resetPassword(e,t){return g(this.configuration).resetPassword(e.resetPasswordRequest,t).then(e=>e(this.axios,this.basePath))}signupEmailPassword(e,t){return g(this.configuration).signupEmailPassword(e.signupRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}thirdParty(e,t){return g(this.configuration).thirdParty(e.thirdPartyOAuthRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}unlinkEmail(e,t){return g(this.configuration).unlinkEmail(e.unlinkEmailRequest,t).then(e=>e(this.axios,this.basePath))}unlinkOAuth(e,t){return g(this.configuration).unlinkOAuth(e.unlinkOAuthRequest,t).then(e=>e(this.axios,this.basePath))}unlinkSIWE(e,t){return g(this.configuration).unlinkSIWE(e.sIWERequest,t).then(e=>e(this.axios,this.basePath))}verifyEmail(e,t){return g(this.configuration).verifyEmail(e.verifyEmailRequest,t).then(e=>e(this.axios,this.basePath))}verifyOAuthToken(e,t){return g(this.configuration).verifyOAuthToken(e.authenticateOAuthRequest,t).then(e=>e(this.axios,this.basePath))}}const m=function(t){const s=function(e){return{handleRpcRequest:async(t,n={})=>{o("handleRpcRequest","jsonRpcRequest",t);const s=new URL("/rpc",i);let a;e&&(a=e.baseOptions);const r={method:"POST",...a,...n},c={"Content-Type":"application/json"};h(s,{});let l=a&&a.headers?a.headers:{};return r.headers={...c,...l,...n.headers},r.data=u(t,r,e),{url:d(s),options:r}}}}(t);return{async handleRpcRequest(a,i){const o=await s.handleRpcRequest(a,i);return l(o,e,n,t)}}};class R extends s{handleRpcRequest(e,t){return m(this.configuration).handleRpcRequest(e.jsonRpcRequest,t).then(e=>e(this.axios,this.basePath))}}const f=function(t){const s=function(e){return{createSession:async(t,n,s={})=>{o("createSession","createSessionRequest",t);const a=new URL("/v1/sessions",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...s},p={};await r(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...s.headers},l.data=u(t,l,e),{url:d(a),options:l}},getPlayerSessions:async(t,n,s,a,c,u={})=>{o("getPlayerSessions","player",t);const l=new URL("/v1/sessions",i);let p;e&&(p=e.baseOptions);const y={method:"GET",...p,...u},g={},w={};await r(g,e),void 0!==n&&(w.limit=n),void 0!==s&&(w.skip=s),void 0!==a&&(w.order=a),void 0!==t&&(w.player=t),c&&(w.expand=c),h(l,w);let m=p&&p.headers?p.headers:{};return y.headers={...g,...m,...u.headers},{url:d(l),options:y}},getSession:async(t,n,s={})=>{o("getSession","id",t);const a="/v1/sessions/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...s},p={},y={};await r(p,e),n&&(y.expand=n),h(c,y);let g=u&&u.headers?u.headers:{};return l.headers={...p,...g,...s.headers},{url:d(c),options:l}},revokeSession:async(t,n,s={})=>{o("revokeSession","revokeSessionRequest",t);const a=new URL("/v1/sessions/revoke",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...s},p={};await r(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...s.headers},l.data=u(t,l,e),{url:d(a),options:l}},signatureSession:async(t,n,s={})=>{o("signatureSession","id",t),o("signatureSession","signatureRequest",n);const a="/v1/sessions/{id}/signature".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await r(y,e),await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=u(n,p,e),{url:d(c),options:p}}}}(t);return{async createSession(a,i,o){const r=await s.createSession(a,i,o);return l(r,e,n,t)},async getPlayerSessions(a,i,o,r,c,h){const u=await s.getPlayerSessions(a,i,o,r,c,h);return l(u,e,n,t)},async getSession(a,i,o){const r=await s.getSession(a,i,o);return l(r,e,n,t)},async revokeSession(a,i,o){const r=await s.revokeSession(a,i,o);return l(r,e,n,t)},async signatureSession(a,i,o){const r=await s.signatureSession(a,i,o);return l(r,e,n,t)}}};class P extends s{createSession(e,t){return f(this.configuration).createSession(e.createSessionRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}getPlayerSessions(e,t){return f(this.configuration).getPlayerSessions(e.player,e.limit,e.skip,e.order,e.expand,t).then(e=>e(this.axios,this.basePath))}getSession(e,t){return f(this.configuration).getSession(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}revokeSession(e,t){return f(this.configuration).revokeSession(e.revokeSessionRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}signatureSession(e,t){return f(this.configuration).signatureSession(e.id,e.signatureRequest,t).then(e=>e(this.axios,this.basePath))}}const T=function(t){const s=function(e){return{createTransactionIntent:async(t,n,s={})=>{o("createTransactionIntent","createTransactionIntentRequest",t);const a=new URL("/v1/transaction_intents",i);let c;e&&(c=e.baseOptions);const l={method:"POST",...c,...s},p={};await r(p,e),null!=n&&(p["X-Behalf-Of-Project"]=String(n)),p["Content-Type"]="application/json",h(a,{});let y=c&&c.headers?c.headers:{};return l.headers={...p,...y,...s.headers},l.data=u(t,l,e),{url:d(a),options:l}},estimateTransactionIntentCost:async(t,n={})=>{o("estimateTransactionIntentCost","createTransactionIntentRequest",t);const s=new URL("/v1/transaction_intents/estimate_gas_cost",i);let a;e&&(a=e.baseOptions);const c={method:"POST",...a,...n},l={};await r(l,e),l["Content-Type"]="application/json",h(s,{});let p=a&&a.headers?a.headers:{};return c.headers={...l,...p,...n.headers},c.data=u(t,c,e),{url:d(s),options:c}},getTransactionIntent:async(t,n,s={})=>{o("getTransactionIntent","id",t);const a="/v1/transaction_intents/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...s},p={},y={};await r(p,e),n&&(y.expand=n),h(c,y);let g=u&&u.headers?u.headers:{};return l.headers={...p,...g,...s.headers},{url:d(c),options:l}},getTransactionIntents:async(t,n,s,a,o,c,u,l,p,y={})=>{const g=new URL("/v1/transaction_intents",i);let w;e&&(w=e.baseOptions);const m={method:"GET",...w,...y},R={},f={};await r(R,e),void 0!==t&&(f.limit=t),void 0!==n&&(f.skip=n),void 0!==s&&(f.order=s),a&&(f.expand=a),void 0!==o&&(f.chainId=o),c&&(f.account=c),u&&(f.player=u),void 0!==l&&(f.status=l),p&&(f.policy=p),h(g,f);let P=w&&w.headers?w.headers:{};return m.headers={...R,...P,...y.headers},{url:d(g),options:m}},signature:async(t,n,s={})=>{o("signature","id",t),o("signature","signatureRequest",n);const a="/v1/transaction_intents/{id}/signature".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...s},y={};await r(y,e),await r(y,e),y["Content-Type"]="application/json",h(c,{});let g=l&&l.headers?l.headers:{};return p.headers={...y,...g,...s.headers},p.data=u(n,p,e),{url:d(c),options:p}}}}(t);return{async createTransactionIntent(a,i,o){const r=await s.createTransactionIntent(a,i,o);return l(r,e,n,t)},async estimateTransactionIntentCost(a,i){const o=await s.estimateTransactionIntentCost(a,i);return l(o,e,n,t)},async getTransactionIntent(a,i,o){const r=await s.getTransactionIntent(a,i,o);return l(r,e,n,t)},async getTransactionIntents(a,i,o,r,c,h,u,d,p,y){const g=await s.getTransactionIntents(a,i,o,r,c,h,u,d,p,y);return l(g,e,n,t)},async signature(a,i,o){const r=await s.signature(a,i,o);return l(r,e,n,t)}}};class O extends s{createTransactionIntent(e,t){return T(this.configuration).createTransactionIntent(e.createTransactionIntentRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}estimateTransactionIntentCost(e,t){return T(this.configuration).estimateTransactionIntentCost(e.createTransactionIntentRequest,t).then(e=>e(this.axios,this.basePath))}getTransactionIntent(e,t){return T(this.configuration).getTransactionIntent(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}getTransactionIntents(e={},t){return T(this.configuration).getTransactionIntents(e.limit,e.skip,e.order,e.expand,e.chainId,e.account,e.player,e.status,e.policy,t).then(e=>e(this.axios,this.basePath))}signature(e,t){return T(this.configuration).signature(e.id,e.signatureRequest,t).then(e=>e(this.axios,this.basePath))}}class b{apiKey;username;password;accessToken;basePath;baseOptions;formDataCtor;constructor(e={}){this.apiKey=e.apiKey,this.username=e.username,this.password=e.password,this.accessToken=e.accessToken,this.basePath=e.basePath,this.baseOptions=e.baseOptions,this.formDataCtor=e.formDataCtor}isJsonMime(e){const t=new RegExp("^(application/json|[^;/ \t]+/[^;/ \t]+[+]json)[ \t]*(;.*)?$","i");return null!==e&&(t.test(e)||"application/json-patch+json"===e.toLowerCase())}}const v=({basePath:e,accessToken:t,nativeAppIdentifier:n})=>{if(!e.trim())throw Error("basePath can not be empty");const s={basePath:e,accessToken:t};return n&&(s.baseOptions={headers:{"x-native-app-identifier":n}}),new b(s)};class S{config;transactionIntentsApi;accountsApi;rpcApi;sessionsApi;authenticationApi;storage;onLogout;axiosInstance;constructor(n){this.storage=n.storage,this.onLogout=n.onLogout,this.axiosInstance=e.create(),t(this.axiosInstance,{retries:3,retryDelay:t.exponentialDelay,retryCondition:t.isRetryableError}),this.setupInterceptors();const s={basePath:n.basePath,accessToken:n.accessToken,nativeAppIdentifier:n.nativeAppIdentifier};this.config={backend:v(s)},this.transactionIntentsApi=new O(this.config.backend,void 0,this.axiosInstance),this.accountsApi=new y(this.config.backend,void 0,this.axiosInstance),this.sessionsApi=new P(this.config.backend,void 0,this.axiosInstance),this.rpcApi=new R(this.config.backend,void 0,this.axiosInstance),this.authenticationApi=new w(this.config.backend,void 0,this.axiosInstance)}setupInterceptors(){this.axiosInstance.interceptors.response.use(e=>e,async e=>(401===e.response?.status&&(await this.clearAuthenticationState(),this.emitLogoutEvent()),Promise.reject(e)))}async clearAuthenticationState(){if(this.storage)try{this.storage.remove("openfort.authentication"),this.storage.remove("openfort.account"),this.storage.remove("openfort.session"),this.storage.remove("openfort.pkce_state"),this.storage.remove("openfort.pkce_verifier")}catch(e){}}emitLogoutEvent(){if(this.onLogout)try{this.onLogout()}catch(e){}}}export{S as BackendApiClients,v as createConfig};
@@ -1 +1 @@
1
- import{BackendApiClients as e}from"../../../packages/internal/openapi-clients/dist/index.js";import{PasskeyHandler as r}from"../core/configuration/passkey.js";import{SDKConfiguration as t}from"../core/config/config.js";import{Account as a}from"../core/configuration/account.js";import{Authentication as s}from"../core/configuration/authentication.js";import{OpenfortError as i,OpenfortErrorType as n,withOpenfortError as o}from"../core/errors/openfortError.js";import{OpenfortEvents as d,RecoveryMethod as c,ChainTypeEnum as h,AccountTypeEnum as g,EmbeddedState as y}from"../types/types.js";import{debugLog as m}from"../utils/debug.js";import{EmbeddedSigner as p}from"../wallets/embedded.js";import{EvmProvider as l}from"../wallets/evm/evmProvider.js";import"../wallets/evm/types.js";import{announceProvider as f,openfortProviderInfo as u}from"../wallets/evm/provider/eip6963.js";import{signMessage as A}from"../wallets/evm/walletHelpers.js";import{IframeManager as w}from"../wallets/iframeManager.js";import{ReactNativeMessenger as I}from"../wallets/messaging/ReactNativeMessenger.js";import"../wallets/messaging/browserMessenger/backwardCompatibility.js";import M from"../wallets/messaging/browserMessenger/messengers/WindowMessenger.js";class v{storage;validateAndRefreshToken;ensureInitialized;eventEmitter;passkeyHandler;iframeManager=null;iframeManagerPromise=null;signer=null;signerPromise=null;provider=null;messagePoster=null;messenger=null;constructor(e,r,t,a,s){this.storage=e,this.validateAndRefreshToken=r,this.ensureInitialized=t,this.eventEmitter=a,this.passkeyHandler=s,this.eventEmitter.on(d.ON_LOGOUT,()=>{m("Handling logout event in EmbeddedWalletApi"),this.handleLogout()})}get backendApiClients(){const r=t.getInstance();if(!r)throw new i("Configuration not found",n.INVALID_CONFIGURATION);return new e({basePath:r.backendUrl,accessToken:r.baseConfiguration.publishableKey,nativeAppIdentifier:r.nativeAppIdentifier})}async getIframeManager(){if(m("[HANDSHAKE DEBUG] getIframeManager called"),this.iframeManager&&this.iframeManager.hasFailed&&(m("[HANDSHAKE DEBUG] Existing iframeManager has failed, clearing for recreation"),this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null),this.iframeManager)return m("[HANDSHAKE DEBUG] Returning existing iframeManager instance"),this.iframeManager;if(this.iframeManagerPromise)return m("[HANDSHAKE DEBUG] Returning existing iframeManagerPromise"),this.iframeManagerPromise;m("[HANDSHAKE DEBUG] Creating new iframeManager"),this.iframeManagerPromise=this.createIframeManager();try{return m("[HANDSHAKE DEBUG] Awaiting iframeManager creation"),this.iframeManager=await this.iframeManagerPromise,m("[HANDSHAKE DEBUG] IframeManager created successfully"),this.iframeManagerPromise=null,this.iframeManager}catch(e){throw m("[HANDSHAKE DEBUG] Error creating iframeManager:",e),this.iframeManagerPromise=null,this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null,e}}async createIframeManager(){m("[HANDSHAKE DEBUG] createIframeManager starting");const e=t.getInstance();if(!e)throw m("[HANDSHAKE DEBUG] Configuration not found"),new i("Configuration not found",n.INVALID_CONFIGURATION);let r;if(m("[HANDSHAKE DEBUG] Configuration found"),this.messagePoster)m("[HANDSHAKE DEBUG] Creating ReactNativeMessenger with messagePoster"),this.messenger&&(m("[HANDSHAKE DEBUG] Destroying old messenger before creating new one"),this.messenger.destroy()),this.messenger=new I(this.messagePoster),m("[HANDSHAKE DEBUG] Created new ReactNativeMessenger instance"),r=this.messenger;else{m("[HANDSHAKE DEBUG] Creating WindowMessenger for browser mode");const t=this.createIframe(e.iframeUrl),a=new URL(e.iframeUrl).origin;r=new M({remoteWindow:t.contentWindow,allowedOrigins:[a]}),m("[HANDSHAKE DEBUG] Created WindowMessenger")}return m("[HANDSHAKE DEBUG] Creating IframeManager instance"),new w(e,this.storage,r)}async ensureSigner(){if(this.iframeManager&&this.iframeManager.hasFailed&&(m("IframeManager has failed, clearing signer for recreation"),this.signer=null),this.signer)return this.signer;if(this.signerPromise)return this.signerPromise;this.signerPromise=this.createSigner();try{return this.signer=await this.signerPromise,this.signer}catch(e){throw this.signerPromise=null,e}finally{this.signerPromise=null}}async createSigner(){const e=await this.getIframeManager();return new p(e,this.storage,this.backendApiClients,this.passkeyHandler,this.eventEmitter)}createIframe(e){if("undefined"==typeof document)throw new i("Document is not available. Please provide a message poster for non-browser environments.",n.INVALID_CONFIGURATION);const r=document.getElementById("openfort-iframe");r&&r.remove();const t=document.createElement("iframe");return t.style.display="none",t.id="openfort-iframe",t.src=e,document.body.appendChild(t),t}async getPasskeyKey(e){const r=await s.fromStorage(this.storage);return await this.passkeyHandler.deriveAndExportKey({id:e,seed:r.player})}async getEntropy(e){switch(e.recoveryMethod){case c.PASSWORD:return{recoveryPassword:e.password};case c.AUTOMATIC:return{encryptionSession:e.encryptionSession};case c.PASSKEY:return{passkey:e.passkeyInfo?{id:e.passkeyInfo.passkeyId,key:e.passkeyInfo.passkeyKey||await this.getPasskeyKey(e.passkeyInfo.passkeyId)}:{}};default:throw new i("Invalid recovery method",n.INVALID_CONFIGURATION)}}async configure(e){await this.validateAndRefreshToken();const r=e.recoveryParams??{recoveryMethod:c.AUTOMATIC},[t,i,n]=await Promise.all([s.fromStorage(this.storage),this.ensureSigner(),this.getEntropy(r)]),o={chainId:e.chainId,entropy:n,accountType:e.accountType??g.SMART_ACCOUNT,chainType:e.chainType??h.EVM,getPasskeyKeyFn:async e=>this.getPasskeyKey(e)},d=await i.configure(o);return{id:d.id,chainId:d.chainId,user:t.player,address:d.address,ownerAddress:d.ownerAddress,chainType:d.chainType,accountType:d.accountType,implementationType:d.implementationType,createdAt:d.createdAt,recoveryMethod:a.parseRecoveryMethod(d.recoveryMethod),recoveryMethodDetails:d.recoveryMethodDetails}}async create(e){await this.validateAndRefreshToken();const t=e.recoveryParams??{recoveryMethod:c.AUTOMATIC},o=await s.fromStorage(this.storage);if(!o)throw new i("missing authentication",n.AUTHENTICATION_ERROR);if(t.recoveryMethod===c.PASSKEY){const e=await this.passkeyHandler.createPasskey({id:r.randomPasskeyName(),displayName:"Openfort - Embedded Wallet",seed:o?.player});t.passkeyInfo={passkeyId:e.id,passkeyKey:e.key}}const[h,g]=await Promise.all([this.ensureSigner(),this.getEntropy(t)]),y=await h.create({accountType:e.accountType,chainType:e.chainType,chainId:e.chainId,entropy:g}),m={id:y.id,chainId:y.chainId,user:o.player,address:y.address,ownerAddress:y.ownerAddress,chainType:y.chainType,accountType:y.accountType,implementationType:y.implementationType,createdAt:y.createdAt,recoveryMethod:a.parseRecoveryMethod(y.recoveryMethod),recoveryMethodDetails:y.recoveryMethodDetails};return this.eventEmitter.emit(d.ON_EMBEDDED_WALLET_CREATED,m),m}async recover(e){await this.validateAndRefreshToken();const r=e.recoveryParams??{recoveryMethod:c.AUTOMATIC};if(r.recoveryMethod===c.PASSKEY){if(!r.passkeyInfo?.passkeyId)throw new i("Passkey ID must be provided for passkey recovery",n.INVALID_CONFIGURATION);r.passkeyInfo={passkeyId:r.passkeyInfo.passkeyId}}const[t,o,h]=await Promise.all([this.ensureSigner(),this.getEntropy(r),s.fromStorage(this.storage)]),g=await t.recover({account:e.account,entropy:o}),y={id:g.id,chainId:g.chainId,user:h.player,address:g.address,ownerAddress:g.ownerAddress,chainType:g.chainType,accountType:g.accountType,implementationType:g.implementationType,createdAt:g.createdAt,recoveryMethod:a.parseRecoveryMethod(g.recoveryMethod),recoveryMethodDetails:g.recoveryMethodDetails};return this.eventEmitter.emit(d.ON_EMBEDDED_WALLET_RECOVERED,y),y}async signMessage(e,r){await this.validateAndRefreshToken();const t=await this.ensureSigner(),{hashMessage:s=!0,arrayifyMessage:i=!1}=r||{},n=await a.fromStorage(this.storage);return await t.sign(e,i,s,n?.chainType)}async signTypedData(e,r,t){await this.validateAndRefreshToken();const s=await this.ensureSigner(),o=await a.fromStorage(this.storage);if(!o)throw new i("No account found",n.MISSING_SIGNER_ERROR);const d={...r};delete d.EIP712Domain;const{_TypedDataEncoder:c}=await import("@ethersproject/hash"),h=c.hash(e,d,t);return await A({hash:h,implementationType:o.implementationType||o.type,chainId:Number(o.chainId),signer:s,address:o.address,ownerAddress:o.ownerAddress,factoryAddress:o.factoryAddress,salt:o.salt})}async exportPrivateKey(){await this.validateAndRefreshToken();const e=await this.ensureSigner();return await e.export()}async setRecoveryMethod(e,t){await this.validateAndRefreshToken();const o=await this.ensureSigner(),d=await s.fromStorage(this.storage);if(!d)throw new i("missing authentication",n.AUTHENTICATION_ERROR);let h,g,y,m;if(e.recoveryMethod===c.PASSKEY){const e=await a.fromStorage(this.storage);if(!e)throw new i("missing account",n.INVALID_CONFIGURATION);const r=e?.recoveryMethodDetails?.passkeyId;if(!r)throw new i("missing passkey id for account",n.INVALID_CONFIGURATION);y={passkeyId:r,passkeyKey:await this.passkeyHandler.deriveAndExportKey({id:r,seed:d.player})}}else if(t.recoveryMethod===c.PASSKEY){const e=await this.passkeyHandler.createPasskey({id:r.randomPasskeyName(),displayName:"Openfort - Embedded Wallet",seed:d.player});y={passkeyId:e.id,passkeyKey:e.key},m={passkeyId:e.id}}if(e.recoveryMethod===c.PASSWORD?h=e.password:t.recoveryMethod===c.PASSWORD&&(h=t.password),e.recoveryMethod===c.AUTOMATIC?g=e.encryptionSession:t.recoveryMethod===c.AUTOMATIC&&(g=t.encryptionSession),!h&&!g)throw new i("Password or encryption session is not provided",n.INVALID_CONFIGURATION);await o.setRecoveryMethod({recoveryMethod:t.recoveryMethod,recoveryPassword:h,encryptionSession:g,passkeyInfo:y});const p=await a.fromStorage(this.storage);p&&new a({...p,recoveryMethod:t.recoveryMethod,recoveryMethodDetails:m}).save(this.storage)}async get(){const e=await a.fromStorage(this.storage);if(!e)throw new i("No signer configured",n.MISSING_SIGNER_ERROR);const r=await s.fromStorage(this.storage);if(!r)throw new i("No access token found",n.NOT_LOGGED_IN_ERROR);return{id:e.id,chainId:e.chainId,user:r.player,address:e.address,ownerAddress:e.ownerAddress,chainType:e.chainType,accountType:e.accountType,implementationType:e.implementationType,createdAt:e.createdAt,recoveryMethod:a.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails}}async list(e){const r={accountType:g.SMART_ACCOUNT,...e},d=t.getInstance();if(!d)throw new i("Configuration not found",n.INVALID_CONFIGURATION);await this.validateAndRefreshToken();const c=await s.fromStorage(this.storage);if(!c)throw new i("No access token found",n.NOT_LOGGED_IN_ERROR);return o(async()=>(await this.backendApiClients.accountsApi.getAccountsV2(r,{headers:{authorization:`Bearer ${d.baseConfiguration.publishableKey}`,"x-player-token":c.token,"x-auth-provider":c.thirdPartyProvider,"x-token-type":c.thirdPartyTokenType}})).data.data.map(e=>({user:e.user,chainType:e.chainType,id:e.id,address:e.address,ownerAddress:e.ownerAddress,accountType:e.accountType,createdAt:e.createdAt,implementationType:e.smartAccount?.implementationType,chainId:e.chainId,recoveryMethod:a.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails})),{default:n.AUTHENTICATION_ERROR})}async getEmbeddedState(){try{if(!await s.fromStorage(this.storage))return y.UNAUTHENTICATED;return await a.fromStorage(this.storage)?y.READY:y.EMBEDDED_SIGNER_NOT_CONFIGURED}catch(e){return m("Failed to get embedded state:",e),y.UNAUTHENTICATED}}async getEthereumProvider(e){await this.ensureInitialized();const r={announceProvider:!0,...e},t=await s.fromStorage(this.storage),i=await a.fromStorage(this.storage);return this.provider?this.provider&&r.policy&&this.provider.updatePolicy(r.policy):(this.provider=new l({storage:this.storage,openfortEventEmitter:this.eventEmitter,ensureSigner:this.ensureSigner.bind(this),account:i||void 0,authentication:t||void 0,backendApiClients:this.backendApiClients,policyId:r.policy,validateAndRefreshSession:this.validateAndRefreshToken.bind(this),chains:r.chains}),r.announceProvider&&f({info:{...u,...r.providerInfo},provider:this.provider})),this.provider}async ping(e){try{e>0&&await new Promise(r=>{setTimeout(r,e)});const r=await this.getIframeManager();if(!r.isLoaded())return!1;const t=await s.fromStorage(this.storage);if(t)try{return await r.getCurrentDevice(t.player),!0}catch(e){return!1}return r.isLoaded()}catch(e){return m("Ping failed:",e),!1}}getURL(){const e=t.getInstance();if(!e)throw new i("Configuration not found",n.INVALID_CONFIGURATION);return e.iframeUrl}async setMessagePoster(e){if(!e||"function"!=typeof e.postMessage)throw new i("Invalid message poster",n.INVALID_CONFIGURATION);this.messagePoster=e,this.messenger&&this.messenger.destroy(),this.iframeManager&&this.iframeManager.destroy(),this.signer=null,this.signerPromise=null,this.iframeManager=null,this.iframeManagerPromise=null,this.messenger=null}async handleLogout(){const e=await this.ensureSigner();await e.disconnect(),this.provider=null,this.messenger=null,this.iframeManager=null,this.iframeManagerPromise=null,this.signer=null,this.signerPromise=null}async onMessage(e){if(!e||"object"!=typeof e)return void m("Invalid message received:",e);m("[HANDSHAKE DEBUG] EmbeddedWalletApi onMessage:",e);const r="penpal"===e.namespace&&"SYN"===e.type||e.penpal&&"string"==typeof e.penpal;if(r&&this.messenger&&this.messagePoster)return m("[HANDSHAKE DEBUG] Passing message directly to existing ReactNativeMessenger"),void this.messenger.handleMessage(e);const t=await this.getIframeManager();m(`[HANDSHAKE DEBUG] IframeManager obtained, isLoaded: ${t.isLoaded()}`),r&&!t.isLoaded()&&m("[HANDSHAKE DEBUG] Received penpal message before connection initialized, setting up connection..."),m("[HANDSHAKE DEBUG] Calling iframeManager.onMessage"),await t.onMessage(e),m("[HANDSHAKE DEBUG] iframeManager.onMessage completed")}isReady(){return this.iframeManager?.isLoaded()||!1}}export{v as EmbeddedWalletApi};
1
+ import{BackendApiClients as e}from"../../../packages/internal/openapi-clients/dist/index.js";import{PasskeyHandler as t}from"../core/configuration/passkey.js";import{SDKConfiguration as r}from"../core/config/config.js";import{Account as s}from"../core/configuration/account.js";import{Authentication as a}from"../core/configuration/authentication.js";import{OpenfortError as i,OpenfortErrorType as n,withOpenfortError as o}from"../core/errors/openfortError.js";import{OpenfortEvents as d,RecoveryMethod as c,ChainTypeEnum as h,AccountTypeEnum as m,EmbeddedState as g}from"../types/types.js";import{debugLog as y}from"../utils/debug.js";import{EmbeddedSigner as l}from"../wallets/embedded.js";import{EvmProvider as p}from"../wallets/evm/evmProvider.js";import"../wallets/evm/types.js";import{announceProvider as f,openfortProviderInfo as A}from"../wallets/evm/provider/eip6963.js";import{signMessage as u}from"../wallets/evm/walletHelpers.js";import{IframeManager as w}from"../wallets/iframeManager.js";import{ReactNativeMessenger as I}from"../wallets/messaging/ReactNativeMessenger.js";import"../wallets/messaging/browserMessenger/backwardCompatibility.js";import v from"../wallets/messaging/browserMessenger/messengers/WindowMessenger.js";class M{storage;validateAndRefreshToken;ensureInitialized;eventEmitter;passkeyHandler;iframeManager=null;iframeManagerPromise=null;signer=null;signerPromise=null;provider=null;messagePoster=null;messenger=null;constructor(e,t,r,s,a){this.storage=e,this.validateAndRefreshToken=t,this.ensureInitialized=r,this.eventEmitter=s,this.passkeyHandler=a,this.eventEmitter.on(d.ON_LOGOUT,()=>{y("Handling logout event in EmbeddedWalletApi"),this.handleLogout()})}get backendApiClients(){const t=r.getInstance();if(!t)throw new i("Configuration not found",n.INVALID_CONFIGURATION);return new e({basePath:t.backendUrl,accessToken:t.baseConfiguration.publishableKey,nativeAppIdentifier:t.nativeAppIdentifier})}async getIframeManager(){if(y("[HANDSHAKE DEBUG] getIframeManager called"),this.iframeManager&&this.iframeManager.hasFailed&&(y("[HANDSHAKE DEBUG] Existing iframeManager has failed, clearing for recreation"),this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null),this.iframeManager)return y("[HANDSHAKE DEBUG] Returning existing iframeManager instance"),this.iframeManager;if(this.iframeManagerPromise)return y("[HANDSHAKE DEBUG] Returning existing iframeManagerPromise"),this.iframeManagerPromise;y("[HANDSHAKE DEBUG] Creating new iframeManager"),this.iframeManagerPromise=this.createIframeManager();try{return y("[HANDSHAKE DEBUG] Awaiting iframeManager creation"),this.iframeManager=await this.iframeManagerPromise,y("[HANDSHAKE DEBUG] IframeManager created successfully"),this.iframeManagerPromise=null,this.iframeManager}catch(e){throw y("[HANDSHAKE DEBUG] Error creating iframeManager:",e),this.iframeManagerPromise=null,this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null,e}}async createIframeManager(){y("[HANDSHAKE DEBUG] createIframeManager starting");const e=r.getInstance();if(!e)throw y("[HANDSHAKE DEBUG] Configuration not found"),new i("Configuration not found",n.INVALID_CONFIGURATION);let t;if(y("[HANDSHAKE DEBUG] Configuration found"),this.messagePoster)y("[HANDSHAKE DEBUG] Creating ReactNativeMessenger with messagePoster"),this.messenger&&(y("[HANDSHAKE DEBUG] Destroying old messenger before creating new one"),this.messenger.destroy()),this.messenger=new I(this.messagePoster),y("[HANDSHAKE DEBUG] Created new ReactNativeMessenger instance"),t=this.messenger;else{y("[HANDSHAKE DEBUG] Creating WindowMessenger for browser mode");const r=this.createIframe(e.iframeUrl),s=new URL(e.iframeUrl).origin;t=new v({remoteWindow:r.contentWindow,allowedOrigins:[s]}),y("[HANDSHAKE DEBUG] Created WindowMessenger")}return y("[HANDSHAKE DEBUG] Creating IframeManager instance"),new w(e,this.storage,t)}async ensureSigner(){if(this.iframeManager&&this.iframeManager.hasFailed&&(y("IframeManager has failed, clearing signer for recreation"),this.signer=null),this.signer)return this.signer;if(this.signerPromise)return this.signerPromise;this.signerPromise=this.createSigner();try{return this.signer=await this.signerPromise,this.signer}catch(e){throw this.signerPromise=null,e}finally{this.signerPromise=null}}async createSigner(){const e=await this.getIframeManager();return new l(e,this.storage,this.backendApiClients,this.passkeyHandler,this.eventEmitter)}createIframe(e){if("undefined"==typeof document)throw new i("Document is not available. Please provide a message poster for non-browser environments.",n.INVALID_CONFIGURATION);const t=document.getElementById("openfort-iframe");t&&t.remove();const r=document.createElement("iframe");return r.style.display="none",r.id="openfort-iframe",r.src=e,document.body.appendChild(r),r}async getPasskeyKey(e){const t=await a.fromStorage(this.storage);return await this.passkeyHandler.deriveAndExportKey({id:e,seed:t.player})}async getEntropy(e){switch(e.recoveryMethod){case c.PASSWORD:return{recoveryPassword:e.password};case c.AUTOMATIC:return{encryptionSession:e.encryptionSession};case c.PASSKEY:return{passkey:e.passkeyInfo?{id:e.passkeyInfo.passkeyId,key:e.passkeyInfo.passkeyKey||await this.getPasskeyKey(e.passkeyInfo.passkeyId)}:{}};default:throw new i("Invalid recovery method",n.INVALID_CONFIGURATION)}}async configure(e){await this.validateAndRefreshToken();const t=e.recoveryParams??{recoveryMethod:c.AUTOMATIC},[r,i,n]=await Promise.all([a.fromStorage(this.storage),this.ensureSigner(),this.getEntropy(t)]),o={chainId:e.chainId,entropy:n,accountType:e.accountType??m.SMART_ACCOUNT,chainType:e.chainType??h.EVM,getPasskeyKeyFn:async e=>this.getPasskeyKey(e)},d=await i.configure(o);return{id:d.id,chainId:d.chainId,user:r.player,address:d.address,ownerAddress:d.ownerAddress,chainType:d.chainType,accountType:d.accountType,implementationType:d.implementationType,factoryAddress:d.factoryAddress,salt:d.salt,createdAt:d.createdAt,implementationAddress:d.implementationAddress,recoveryMethod:s.parseRecoveryMethod(d.recoveryMethod),recoveryMethodDetails:d.recoveryMethodDetails}}async create(e){await this.validateAndRefreshToken();const r=e.recoveryParams??{recoveryMethod:c.AUTOMATIC},o=await a.fromStorage(this.storage);if(!o)throw new i("missing authentication",n.AUTHENTICATION_ERROR);if(r.recoveryMethod===c.PASSKEY){const e=await this.passkeyHandler.createPasskey({id:t.randomPasskeyName(),displayName:"Openfort - Embedded Wallet",seed:o?.player});r.passkeyInfo={passkeyId:e.id,passkeyKey:e.key}}const[h,m]=await Promise.all([this.ensureSigner(),this.getEntropy(r)]),g=await h.create({accountType:e.accountType,chainType:e.chainType,chainId:e.chainId,entropy:m}),y={id:g.id,chainId:g.chainId,user:o.player,address:g.address,ownerAddress:g.ownerAddress,chainType:g.chainType,accountType:g.accountType,implementationType:g.implementationType,factoryAddress:g.factoryAddress,salt:g.salt,createdAt:g.createdAt,implementationAddress:g.implementationAddress,recoveryMethod:s.parseRecoveryMethod(g.recoveryMethod),recoveryMethodDetails:g.recoveryMethodDetails};return this.eventEmitter.emit(d.ON_EMBEDDED_WALLET_CREATED,y),y}async recover(e){await this.validateAndRefreshToken();const t=e.recoveryParams??{recoveryMethod:c.AUTOMATIC};if(t.recoveryMethod===c.PASSKEY){if(!t.passkeyInfo?.passkeyId)throw new i("Passkey ID must be provided for passkey recovery",n.INVALID_CONFIGURATION);t.passkeyInfo={passkeyId:t.passkeyInfo.passkeyId}}const[r,o,h]=await Promise.all([this.ensureSigner(),this.getEntropy(t),a.fromStorage(this.storage)]),m=await r.recover({account:e.account,entropy:o}),g={id:m.id,chainId:m.chainId,implementationAddress:m.implementationAddress,factoryAddress:m.factoryAddress,salt:m.salt,user:h.player,address:m.address,ownerAddress:m.ownerAddress,chainType:m.chainType,accountType:m.accountType,implementationType:m.implementationType,createdAt:m.createdAt,recoveryMethod:s.parseRecoveryMethod(m.recoveryMethod),recoveryMethodDetails:m.recoveryMethodDetails};return this.eventEmitter.emit(d.ON_EMBEDDED_WALLET_RECOVERED,g),g}async signMessage(e,t){await this.validateAndRefreshToken();const r=await this.ensureSigner(),{hashMessage:a=!0,arrayifyMessage:i=!1}=t||{},n=await s.fromStorage(this.storage);return await r.sign(e,i,a,n?.chainType)}async signTypedData(e,t,r){await this.validateAndRefreshToken();const a=await this.ensureSigner(),o=await s.fromStorage(this.storage);if(!o)throw new i("No account found",n.MISSING_SIGNER_ERROR);const d={...t};delete d.EIP712Domain;const{_TypedDataEncoder:c}=await import("@ethersproject/hash"),h=c.hash(e,d,r);return await u({hash:h,implementationType:o.implementationType||o.type,chainId:Number(o.chainId),signer:a,address:o.address,ownerAddress:o.ownerAddress,factoryAddress:o.factoryAddress,salt:o.salt})}async exportPrivateKey(){await this.validateAndRefreshToken();const e=await this.ensureSigner();return await e.export()}async setRecoveryMethod(e,r){await this.validateAndRefreshToken();const o=await this.ensureSigner(),d=await a.fromStorage(this.storage);if(!d)throw new i("missing authentication",n.AUTHENTICATION_ERROR);let h,m,g,y;if(e.recoveryMethod===c.PASSKEY){const e=await s.fromStorage(this.storage);if(!e)throw new i("missing account",n.INVALID_CONFIGURATION);const t=e?.recoveryMethodDetails?.passkeyId;if(!t)throw new i("missing passkey id for account",n.INVALID_CONFIGURATION);g={passkeyId:t,passkeyKey:await this.passkeyHandler.deriveAndExportKey({id:t,seed:d.player})}}else if(r.recoveryMethod===c.PASSKEY){const e=await this.passkeyHandler.createPasskey({id:t.randomPasskeyName(),displayName:"Openfort - Embedded Wallet",seed:d.player});g={passkeyId:e.id,passkeyKey:e.key},y={passkeyId:e.id}}if(e.recoveryMethod===c.PASSWORD?h=e.password:r.recoveryMethod===c.PASSWORD&&(h=r.password),e.recoveryMethod===c.AUTOMATIC?m=e.encryptionSession:r.recoveryMethod===c.AUTOMATIC&&(m=r.encryptionSession),!h&&!m)throw new i("Password or encryption session is not provided",n.INVALID_CONFIGURATION);await o.setRecoveryMethod({recoveryMethod:r.recoveryMethod,recoveryPassword:h,encryptionSession:m,passkeyInfo:g});const l=await s.fromStorage(this.storage);l&&new s({...l,recoveryMethod:r.recoveryMethod,recoveryMethodDetails:y}).save(this.storage)}async get(){const e=await s.fromStorage(this.storage);if(!e)throw new i("No signer configured",n.MISSING_SIGNER_ERROR);const t=await a.fromStorage(this.storage);if(!t)throw new i("No access token found",n.NOT_LOGGED_IN_ERROR);return{id:e.id,chainId:e.chainId,user:t.player,address:e.address,ownerAddress:e.ownerAddress,factoryAddress:e.factoryAddress,salt:e.salt,chainType:e.chainType,accountType:e.accountType,implementationAddress:e.implementationAddress,implementationType:e.implementationType,createdAt:e.createdAt,recoveryMethod:s.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails}}async list(e){const t={accountType:m.SMART_ACCOUNT,...e},d=r.getInstance();if(!d)throw new i("Configuration not found",n.INVALID_CONFIGURATION);await this.validateAndRefreshToken();const c=await a.fromStorage(this.storage);if(!c)throw new i("No access token found",n.NOT_LOGGED_IN_ERROR);return o(async()=>(await this.backendApiClients.accountsApi.getAccountsV2(t,{headers:{authorization:`Bearer ${d.baseConfiguration.publishableKey}`,"x-player-token":c.token,"x-auth-provider":c.thirdPartyProvider,"x-token-type":c.thirdPartyTokenType}})).data.data.map(e=>({user:e.user,chainType:e.chainType,id:e.id,address:e.address,active:e.smartAccount?.active,ownerAddress:e.ownerAddress,factoryAddress:e.smartAccount?.factoryAddress,salt:e.smartAccount?.salt,accountType:e.accountType,implementationAddress:e.smartAccount?.implementationAddress,createdAt:e.createdAt,implementationType:e.smartAccount?.implementationType,chainId:e.chainId,recoveryMethod:s.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails})),{default:n.AUTHENTICATION_ERROR})}async getEmbeddedState(){try{if(!await a.fromStorage(this.storage))return g.UNAUTHENTICATED;return await s.fromStorage(this.storage)?g.READY:g.EMBEDDED_SIGNER_NOT_CONFIGURED}catch(e){return y("Failed to get embedded state:",e),g.UNAUTHENTICATED}}async getEthereumProvider(e){await this.ensureInitialized();const t={announceProvider:!0,...e},r=await a.fromStorage(this.storage),i=await s.fromStorage(this.storage);return this.provider?this.provider&&t.policy&&this.provider.updatePolicy(t.policy):(this.provider=new p({storage:this.storage,openfortEventEmitter:this.eventEmitter,ensureSigner:this.ensureSigner.bind(this),account:i||void 0,authentication:r||void 0,backendApiClients:this.backendApiClients,policyId:t.policy,validateAndRefreshSession:this.validateAndRefreshToken.bind(this),chains:t.chains}),t.announceProvider&&f({info:{...A,...t.providerInfo},provider:this.provider})),this.provider}async ping(e){try{e>0&&await new Promise(t=>{setTimeout(t,e)});const t=await this.getIframeManager();if(!t.isLoaded())return!1;const r=await a.fromStorage(this.storage);if(r)try{return await t.getCurrentDevice(r.player),!0}catch(e){return!1}return t.isLoaded()}catch(e){return y("Ping failed:",e),!1}}getURL(){const e=r.getInstance();if(!e)throw new i("Configuration not found",n.INVALID_CONFIGURATION);return e.iframeUrl}async setMessagePoster(e){if(!e||"function"!=typeof e.postMessage)throw new i("Invalid message poster",n.INVALID_CONFIGURATION);this.messagePoster=e,this.messenger&&this.messenger.destroy(),this.iframeManager&&this.iframeManager.destroy(),this.signer=null,this.signerPromise=null,this.iframeManager=null,this.iframeManagerPromise=null,this.messenger=null}async handleLogout(){const e=await this.ensureSigner();await e.disconnect(),this.provider=null,this.messenger=null,this.iframeManager=null,this.iframeManagerPromise=null,this.signer=null,this.signerPromise=null}async onMessage(e){if(!e||"object"!=typeof e)return void y("Invalid message received:",e);y("[HANDSHAKE DEBUG] EmbeddedWalletApi onMessage:",e);const t="penpal"===e.namespace&&"SYN"===e.type||e.penpal&&"string"==typeof e.penpal;if(t&&this.messenger&&this.messagePoster)return y("[HANDSHAKE DEBUG] Passing message directly to existing ReactNativeMessenger"),void this.messenger.handleMessage(e);const r=await this.getIframeManager();y(`[HANDSHAKE DEBUG] IframeManager obtained, isLoaded: ${r.isLoaded()}`),t&&!r.isLoaded()&&y("[HANDSHAKE DEBUG] Received penpal message before connection initialized, setting up connection..."),y("[HANDSHAKE DEBUG] Calling iframeManager.onMessage"),await r.onMessage(e),y("[HANDSHAKE DEBUG] iframeManager.onMessage completed")}isReady(){return this.iframeManager?.isLoaded()||!1}}export{M as EmbeddedWalletApi};
@@ -1 +1 @@
1
- import{StorageKeys as e}from"../../storage/istorage.js";import"../errors/openfortError.js";import{RecoveryMethod as t}from"../../types/types.js";import"human-id";import"eventemitter3";import"../../wallets/evm/JsonRpcError.js";import"../../wallets/evm/types.js";import"../../wallets/evm/provider/eip6963.js";import"../errors/sentry.js";import"../../wallets/messaging/browserMessenger/backwardCompatibility.js";import"../../wallets/types.js";import"jose";class s{constructor(e){this.user=e.user,this.id=e.id,this.chainType=e.chainType,this.address=e.address,this.accountType=e.accountType,this.chainId=e.chainId,this.createdAt=e.createdAt,this.implementationType=e.implementationType,this.factoryAddress=e.factoryAddress,this.recoveryMethod=e.recoveryMethod,this.recoveryMethodDetails=e.recoveryMethodDetails,this.salt=e.salt,this.ownerAddress=e.ownerAddress,this.type=e.type}user;id;chainType;address;accountType;chainId;ownerAddress;factoryAddress;salt;createdAt;implementationType;recoveryMethod;recoveryMethodDetails;type;save(t){t.save(e.ACCOUNT,JSON.stringify({user:this.user,id:this.id,chainType:this.chainType,address:this.address,accountType:this.accountType,chainId:this.chainId,ownerAddress:this.ownerAddress,createdAt:this.createdAt,implementationType:this.implementationType,factoryAddress:this.factoryAddress,salt:this.salt,recoveryMethod:this.recoveryMethod,recoveryMethodDetails:this.recoveryMethodDetails}))}static parseRecoveryMethod=e=>{switch(e){case"user":case t.PASSWORD:return t.PASSWORD;case"project":case t.AUTOMATIC:return t.AUTOMATIC;case"passkey":case t.PASSKEY:return t.PASSKEY;default:return}};static async fromStorage(t){const r=await t.get(e.ACCOUNT);if(!r)return null;try{const e=JSON.parse(r);return new s(e)}catch{return null}}}export{s as Account};
1
+ import{StorageKeys as e}from"../../storage/istorage.js";import"../errors/openfortError.js";import{RecoveryMethod as t}from"../../types/types.js";import"human-id";import"eventemitter3";import"../../wallets/evm/JsonRpcError.js";import"@ethersproject/keccak256";import"../../wallets/evm/types.js";import"../../wallets/evm/provider/eip6963.js";import"../errors/sentry.js";import"../../wallets/messaging/browserMessenger/backwardCompatibility.js";import"../../wallets/types.js";import"jose";class s{constructor(e){this.user=e.user,this.id=e.id,this.chainType=e.chainType,this.address=e.address,this.accountType=e.accountType,this.chainId=e.chainId,this.createdAt=e.createdAt,this.implementationAddress=e.implementationAddress,this.implementationType=e.implementationType,this.factoryAddress=e.factoryAddress,this.recoveryMethod=e.recoveryMethod,this.recoveryMethodDetails=e.recoveryMethodDetails,this.salt=e.salt,this.ownerAddress=e.ownerAddress,this.type=e.type}user;id;chainType;address;accountType;chainId;ownerAddress;factoryAddress;implementationAddress;salt;createdAt;implementationType;recoveryMethod;recoveryMethodDetails;type;save(t){t.save(e.ACCOUNT,JSON.stringify({user:this.user,id:this.id,chainType:this.chainType,address:this.address,accountType:this.accountType,chainId:this.chainId,ownerAddress:this.ownerAddress,createdAt:this.createdAt,implementationType:this.implementationType,factoryAddress:this.factoryAddress,implementationAddress:this.implementationAddress,salt:this.salt,recoveryMethod:this.recoveryMethod,recoveryMethodDetails:this.recoveryMethodDetails}))}static parseRecoveryMethod=e=>{switch(e){case"user":case t.PASSWORD:return t.PASSWORD;case"project":case t.AUTOMATIC:return t.AUTOMATIC;case"passkey":case t.PASSKEY:return t.PASSKEY;default:return}};static async fromStorage(t){const r=await t.get(e.ACCOUNT);if(!r)return null;try{const e=JSON.parse(r);return new s(e)}catch{return null}}}export{s as Account};
@@ -1 +1 @@
1
- import{Authentication as t}from"./configuration/authentication.js";import{OpenfortError as e,OpenfortErrorType as r}from"./errors/openfortError.js";import{TokenType as o,OpenfortEvents as i}from"../types/types.js";import"human-id";import{SDKConfiguration as s}from"./config/config.js";import"../storage/istorage.js";import{debugLog as a}from"../utils/debug.js";import"eventemitter3";import"../wallets/evm/JsonRpcError.js";import"../wallets/evm/types.js";import"../wallets/evm/provider/eip6963.js";import"./errors/sentry.js";import"../wallets/messaging/browserMessenger/backwardCompatibility.js";import"../wallets/types.js";import"jose";import{singlePromise as n}from"../utils/promiseUtils.js";class h{storage;authManager;eventEmitter;constructor(t,e,r){this.storage=t,this.authManager=e,this.eventEmitter=r}async getThirdPartyAuthToken(){const i=s.getInstance();if(!i?.thirdPartyAuth)throw new e("No third party configuration found",r.INTERNAL_ERROR);const{getAccessToken:a,provider:n}=i.thirdPartyAuth;if(!a||!n)throw new e("Third party is not configured. Please configure getAccessToken and thirdPartyAuthProvider in your Openfort instance",r.INVALID_CONFIGURATION);const h=await a();if(!h)throw new e("Could not get access token",r.AUTHENTICATION_ERROR);let c=(await t.fromStorage(this.storage))?.player;if(!c){const t=await this.authManager.authenticateThirdParty(n,h,o.ID_TOKEN);c=t?.id}return new t("third_party",h,c,null,n,o.ID_TOKEN).save(this.storage),h}async getAccessToken(){if(s.getInstance()?.thirdPartyAuth)return this.getThirdPartyAuthToken();return(await t.fromStorage(this.storage))?.token??null}async validateAndRefreshToken(o){return n(async()=>{if(s.getInstance()?.thirdPartyAuth)return void await this.getThirdPartyAuthToken();const n=await t.fromStorage(this.storage);if(!n)throw new e("Must be logged in to validate and refresh token",r.NOT_LOGGED_IN_ERROR);let h;a("validating credentials...");try{h=await this.authManager.validateCredentials(n,o)}catch(e){throw t.clear(this.storage),this.eventEmitter.emit(i.ON_LOGOUT),e}if(!h.player)throw new e("No user found in credentials",r.INTERNAL_ERROR);h.accessToken!==n.token&&(a("tokens refreshed"),new t("jwt",h.accessToken,h.player,h.refreshToken).save(this.storage))},"openfort.validateAndRefreshToken")}}export{h as OpenfortInternal};
1
+ import{Authentication as t}from"./configuration/authentication.js";import{OpenfortError as e,OpenfortErrorType as r}from"./errors/openfortError.js";import{TokenType as o,OpenfortEvents as i}from"../types/types.js";import"human-id";import{SDKConfiguration as s}from"./config/config.js";import"../storage/istorage.js";import{debugLog as a}from"../utils/debug.js";import"eventemitter3";import"../wallets/evm/JsonRpcError.js";import"@ethersproject/keccak256";import"../wallets/evm/types.js";import"../wallets/evm/provider/eip6963.js";import"./errors/sentry.js";import"../wallets/messaging/browserMessenger/backwardCompatibility.js";import"../wallets/types.js";import"jose";import{singlePromise as n}from"../utils/promiseUtils.js";class h{storage;authManager;eventEmitter;constructor(t,e,r){this.storage=t,this.authManager=e,this.eventEmitter=r}async getThirdPartyAuthToken(){const i=s.getInstance();if(!i?.thirdPartyAuth)throw new e("No third party configuration found",r.INTERNAL_ERROR);const{getAccessToken:a,provider:n}=i.thirdPartyAuth;if(!a||!n)throw new e("Third party is not configured. Please configure getAccessToken and thirdPartyAuthProvider in your Openfort instance",r.INVALID_CONFIGURATION);const h=await a();if(!h)throw new e("Could not get access token",r.AUTHENTICATION_ERROR);let c=(await t.fromStorage(this.storage))?.player;if(!c){const t=await this.authManager.authenticateThirdParty(n,h,o.ID_TOKEN);c=t?.id}return new t("third_party",h,c,null,n,o.ID_TOKEN).save(this.storage),h}async getAccessToken(){if(s.getInstance()?.thirdPartyAuth)return this.getThirdPartyAuthToken();return(await t.fromStorage(this.storage))?.token??null}async validateAndRefreshToken(o){return n(async()=>{if(s.getInstance()?.thirdPartyAuth)return void await this.getThirdPartyAuthToken();const n=await t.fromStorage(this.storage);if(!n)throw new e("Must be logged in to validate and refresh token",r.NOT_LOGGED_IN_ERROR);let h;a("validating credentials...");try{h=await this.authManager.validateCredentials(n,o)}catch(e){throw t.clear(this.storage),this.eventEmitter.emit(i.ON_LOGOUT),e}if(!h.player)throw new e("No user found in credentials",r.INTERNAL_ERROR);h.accessToken!==n.token&&(a("tokens refreshed"),new t("jwt",h.accessToken,h.player,h.refreshToken).save(this.storage))},"openfort.validateAndRefreshToken")}}export{h as OpenfortInternal};
@@ -1 +1 @@
1
- import{Openfort as r}from"./core/openfort.js";export{AuthApi}from"./api/auth.js";export{EmbeddedWalletApi}from"./api/embeddedWallet.js";export{ProxyApi}from"./api/proxy.js";export{UserApi}from"./api/user.js";export{OpenfortConfiguration,SDKConfiguration,ShieldConfiguration}from"./core/config/config.js";export{OpenfortError,OpenfortErrorType}from"./core/errors/openfortError.js";export{OpenfortInternal}from"./core/openfortInternal.js";export{MissingProjectEntropyError,MissingRecoveryPasswordError,NotConfiguredError,OTPRequiredError,WrongRecoveryPasswordError}from"./wallets/iframeManager.js";export{AccountTypeEnum,AuthActionRequiredActions,AuthType,BasicAuthProvider,ChainTypeEnum,EmbeddedState,OAuthProvider,OpenfortEvents,RecoveryMethod,ThirdPartyAuthProvider as ThirdPartyOAuthProvider,TokenType}from"./types/types.js";const o=r.getEventEmitter();export{r as Openfort,o as openfortEvents};
1
+ import{Openfort as r}from"./core/openfort.js";export{AuthApi}from"./api/auth.js";export{EmbeddedWalletApi}from"./api/embeddedWallet.js";export{ProxyApi}from"./api/proxy.js";export{UserApi}from"./api/user.js";export{OpenfortConfiguration,SDKConfiguration,ShieldConfiguration}from"./core/config/config.js";export{OpenfortError,OpenfortErrorType}from"./core/errors/openfortError.js";export{OpenfortInternal}from"./core/openfortInternal.js";export{prepareAndSignAuthorization,serializeSignedAuthorization,signAuthorization}from"./utils/authorization.js";export{MissingProjectEntropyError,MissingRecoveryPasswordError,NotConfiguredError,OTPRequiredError,WrongRecoveryPasswordError}from"./wallets/iframeManager.js";export{AccountTypeEnum,AuthActionRequiredActions,AuthType,BasicAuthProvider,ChainTypeEnum,EmbeddedState,OAuthProvider,OpenfortEvents,RecoveryMethod,ThirdPartyAuthProvider as ThirdPartyOAuthProvider,TokenType}from"./types/types.js";const o=r.getEventEmitter();export{r as Openfort,o as openfortEvents};
@@ -1 +1 @@
1
- var E,A,_,e,n,o,t,T,a,O,C,c,N,R;!function(E){E[E.NONE=0]="NONE",E[E.UNAUTHENTICATED=1]="UNAUTHENTICATED",E[E.EMBEDDED_SIGNER_NOT_CONFIGURED=2]="EMBEDDED_SIGNER_NOT_CONFIGURED",E[E.CREATING_ACCOUNT=3]="CREATING_ACCOUNT",E[E.READY=4]="READY"}(E||(E={})),function(E){E.ON_AUTH_INIT="onAuthInit",E.ON_AUTH_SUCCESS="onAuthSuccess",E.ON_AUTH_FAILURE="onAuthFailure",E.ON_LOGOUT="onLogout",E.ON_SWITCH_ACCOUNT="onSwitchAccount",E.ON_SIGNED_MESSAGE="onSignedMessage",E.ON_EMBEDDED_WALLET_CREATED="onEmbeddedWalletCreated",E.ON_EMBEDDED_WALLET_RECOVERED="onEmbeddedWalletRecovered"}(A||(A={})),function(E){E.PASSWORD="password",E.AUTOMATIC="automatic",E.PASSKEY="passkey"}(_||(_={})),function(E){E.UPGRADEABLE_V4="Upgradeable_v04",E.MANAGED_V4="Managed_v04",E.ERC6551_V4="ERC6551_v04",E.ERC6551_V5="ERC6551_v05",E.RECOVERABLE_V4="Recoverable_v04",E.MANAGED_V5="Managed_v05",E.UPGRADEABLE_V5="Upgradeable_v05",E.UPGRADEABLE_V6="Upgradeable_v06",E.ZKSYNC_UPGRADEABLE_V1="zksync_upgradeable_v1",E.ZKSYNC_UPGRADEABLE_V2="zksync_upgradeable_v2"}(e||(e={})),function(E){E.OPENFORT="openfort",E.THIRD_PARTY="thirdParty"}(n||(n={})),function(E){E.ID_TOKEN="idToken",E.CUSTOM_TOKEN="customToken"}(o||(o={})),function(E){E.ACCELBYTE="accelbyte",E.FIREBASE="firebase",E.BETTER_AUTH="better-auth",E.LOOTLOCKER="lootlocker",E.PLAYFAB="playfab",E.SUPABASE="supabase",E.CUSTOM="custom",E.OIDC="oidc"}(t||(t={})),function(E){E.EMAIL="email",E.WALLET="wallet"}(T||(T={})),function(E){E.GOOGLE="google",E.TWITTER="twitter",E.APPLE="apple",E.FACEBOOK="facebook",E.DISCORD="discord",E.EPIC_GAMES="epic_games",E.LINE="line"}(a||(a={})),function(E){E.ACTION_VERIFY_EMAIL="verify_email"}(O||(O={})),function(E){E.S256="S256"}(C||(C={})),function(E){E.EOA="Externally Owned Account",E.SMART_ACCOUNT="Smart Account"}(c||(c={})),function(E){E.EVM="EVM",E.SVM="SVM"}(N||(N={})),function(E){E.ASC="asc",E.DESC="desc"}(R||(R={}));export{e as AccountType,c as AccountTypeEnum,O as AuthActionRequiredActions,n as AuthType,T as BasicAuthProvider,N as ChainTypeEnum,C as CodeChallengeMethodEnum,E as EmbeddedState,a as OAuthProvider,A as OpenfortEvents,_ as RecoveryMethod,t as ThirdPartyAuthProvider,o as TokenType};
1
+ var E,A,e,n,o,t,T,_,O,C,c,a,N,S;!function(E){E[E.NONE=0]="NONE",E[E.UNAUTHENTICATED=1]="UNAUTHENTICATED",E[E.EMBEDDED_SIGNER_NOT_CONFIGURED=2]="EMBEDDED_SIGNER_NOT_CONFIGURED",E[E.CREATING_ACCOUNT=3]="CREATING_ACCOUNT",E[E.READY=4]="READY"}(E||(E={})),function(E){E.ON_AUTH_INIT="onAuthInit",E.ON_AUTH_SUCCESS="onAuthSuccess",E.ON_AUTH_FAILURE="onAuthFailure",E.ON_LOGOUT="onLogout",E.ON_SWITCH_ACCOUNT="onSwitchAccount",E.ON_SIGNED_MESSAGE="onSignedMessage",E.ON_EMBEDDED_WALLET_CREATED="onEmbeddedWalletCreated",E.ON_EMBEDDED_WALLET_RECOVERED="onEmbeddedWalletRecovered"}(A||(A={})),function(E){E.PASSWORD="password",E.AUTOMATIC="automatic",E.PASSKEY="passkey"}(e||(e={})),function(E){E.ERC6551V1="ERC6551V1",E.UPGRADEABLE_V5="UpgradeableV5",E.UPGRADEABLE_V4="UpgradeableV4",E.UPGRADEABLE_V6="UpgradeableV6",E.ZKSYNC_UPGRADEABLE_V1="ZKSyncUpgradeableV1",E.ZKSYNC_UPGRADEABLE_V2="ZKSyncUpgradeableV2",E.SIMPLE="Simple",E.CALIBUR="Calibur"}(n||(n={})),function(E){E.OPENFORT="openfort",E.THIRD_PARTY="thirdParty"}(o||(o={})),function(E){E.ID_TOKEN="idToken",E.CUSTOM_TOKEN="customToken"}(t||(t={})),function(E){E.ACCELBYTE="accelbyte",E.FIREBASE="firebase",E.BETTER_AUTH="better-auth",E.LOOTLOCKER="lootlocker",E.PLAYFAB="playfab",E.SUPABASE="supabase",E.CUSTOM="custom",E.OIDC="oidc"}(T||(T={})),function(E){E.EMAIL="email",E.WALLET="wallet"}(_||(_={})),function(E){E.GOOGLE="google",E.TWITTER="twitter",E.APPLE="apple",E.FACEBOOK="facebook",E.DISCORD="discord",E.EPIC_GAMES="epic_games",E.LINE="line"}(O||(O={})),function(E){E.ACTION_VERIFY_EMAIL="verify_email"}(C||(C={})),function(E){E.S256="S256"}(c||(c={})),function(E){E.EOA="Externally Owned Account",E.SMART_ACCOUNT="Smart Account",E.DELEGATED_ACCOUNT="Delegated Account"}(a||(a={})),function(E){E.EVM="EVM",E.SVM="SVM"}(N||(N={})),function(E){E.ASC="asc",E.DESC="desc"}(S||(S={}));export{n as AccountType,a as AccountTypeEnum,C as AuthActionRequiredActions,o as AuthType,_ as BasicAuthProvider,N as ChainTypeEnum,c as CodeChallengeMethodEnum,E as EmbeddedState,O as OAuthProvider,A as OpenfortEvents,e as RecoveryMethod,T as ThirdPartyAuthProvider,t as TokenType};
@@ -0,0 +1 @@
1
+ import{keccak256 as t}from"@ethersproject/keccak256";function r(r){const{address:n,chainId:e,nonce:i}=r,o=function(t,r,n){const e=(t,r)=>{if(t<56)return(r+t).toString(16).padStart(2,"0");const n=t.toString(16),e=Math.ceil(n.length/2);return(r+55+e).toString(16).padStart(2,"0")+n.padStart(2*e,"0")},i=[t,r,n].map(t=>{if("number"==typeof t){if(0===t)return"80";t=`0x${t.toString(16)}`}let r=t.startsWith("0x")?t.slice(2):t;return r.length%2!=0&&(r=`0${r}`),0===r.length?"80":2===r.length&&parseInt(r,16)<128?r:e(r.length/2,128)+r}).join(""),o=i.length/2;return`0x${e(o,192)}${i}`}(e,n,i),s=`0x05${o.slice(2)}`;return t(s)}async function n(t){const{authorization:n,signer:e}=t,i=r(n),o=await e.sign(i,!1,!1),s=o.startsWith("0x")?o.slice(2):o,a=`0x${s.slice(0,64)}`,c=`0x${s.slice(64,128)}`,d=s.slice(128,130),h=parseInt(d,16);let u;u=27===h||0===h||"1b"===d?0:28===h||1===h||"1c"===d?1:h>=35?h%2==0?1:0:h%2;const l=0===u?27:28;return{...n,r:a,s:c,v:l,yParity:u}}function e(t){const{r:r,s:n,yParity:e}=t,i=r.startsWith("0x")?r.slice(2):r,o=n.startsWith("0x")?n.slice(2):n;return`0x${i.padStart(64,"0")}${o.padStart(64,"0")}${e.toString(16).padStart(2,"0")}`}async function i(t){const{signer:r,contractAddress:e,chainId:i,nonce:o}=t;if(!e)throw new Error("contractAddress is required");if(void 0===i)throw new Error("chainId is required. Please provide it or fetch it from your RPC provider using eth_chainId");if(void 0===o)throw new Error("nonce is required. Please provide it or fetch it from your RPC provider using eth_getTransactionCount");return n({authorization:{address:e,chainId:i,nonce:o},signer:r})}export{i as prepareAndSignAuthorization,e as serializeSignedAuthorization,n as signAuthorization};
@@ -1 +1 @@
1
- const o="0.10.34",t="@openfort/openfort-js";export{t as PACKAGE,o as VERSION};
1
+ const o="0.10.36",t="@openfort/openfort-js";export{t as PACKAGE,o as VERSION};
@@ -1 +1 @@
1
- import{Authentication as e}from"../core/configuration/authentication.js";import{PasskeyHandler as t}from"../core/configuration/passkey.js";import{OpenfortError as a,OpenfortErrorType as r,withOpenfortError as o}from"../core/errors/openfortError.js";import{OpenfortEvents as s,AccountTypeEnum as n}from"../types/types.js";import{SDKConfiguration as i}from"../core/config/config.js";import{Account as c}from"../core/configuration/account.js";import{StorageKeys as d}from"../storage/istorage.js";import"eventemitter3";import"./evm/JsonRpcError.js";import"./evm/types.js";import"./evm/provider/eip6963.js";import"../core/errors/sentry.js";import"./messaging/browserMessenger/backwardCompatibility.js";import"./types.js";import"jose";class y{iframeManager;storage;backendApiClients;passkeyHandler;eventEmitter;constructor(e,t,a,r,o){this.iframeManager=e,this.storage=t,this.backendApiClients=a,this.passkeyHandler=r,this.eventEmitter=o}async createPasskey(e){const a=await this.passkeyHandler.createPasskey({id:t.randomPasskeyName(),displayName:"Openfort - Embedded Wallet",seed:e});return{id:a.id,key:a.key}}async configure(t){const n=await e.fromStorage(this.storage);if(!n)throw new a("No access token found",r.NOT_LOGGED_IN_ERROR);const d=i.getInstance();if(!d)throw new a("Configuration not found",r.INVALID_CONFIGURATION);const y=await c.fromStorage(this.storage);let p;if(y){const e={account:y.id,...t.entropy&&{entropy:{...t.entropy.recoveryPassword&&{recoveryPassword:t.entropy.recoveryPassword},...t.entropy.encryptionSession&&{encryptionSession:t.entropy.encryptionSession},..."passkey"===y.recoveryMethod&&{passkey:{id:y.recoveryMethodDetails?.passkeyId,env:y.recoveryMethodDetails?.passkeyEnv,key:await t.getPasskeyKeyFn(y.recoveryMethodDetails?.passkeyId)}}}}},a=await this.iframeManager.recover(e);p=a.account}else{const e=await this.backendApiClients.accountsApi.getAccountsV2({user:n.player,accountType:t.accountType,chainType:t.chainType},{headers:{authorization:`Bearer ${d.baseConfiguration.publishableKey}`,"x-player-token":n.token,"x-auth-provider":n.thirdPartyProvider,"x-token-type":n.thirdPartyTokenType}});if(0===e.data.data.length){const e=t.entropy?.passkey?await this.createPasskey(n.player):void 0,a={accountType:t.accountType,chainType:t.chainType,chainId:t.chainId,...t.entropy&&{entropy:{...t.entropy.recoveryPassword&&{recoveryPassword:t.entropy.recoveryPassword},...t.entropy.encryptionSession&&{encryptionSession:t.entropy.encryptionSession},...t.entropy.passkey&&{passkey:e}}}},r=await this.iframeManager.create(a);p=r.account}else{const a=e.data.data,r=a.find(e=>e.chainId===t.chainId),o=r||a[0],s={account:o.id,...t.entropy&&{entropy:{...t.entropy.recoveryPassword&&{recoveryPassword:t.entropy.recoveryPassword},...t.entropy.encryptionSession&&{encryptionSession:t.entropy.encryptionSession},..."passkey"===o.recoveryMethod&&{passkey:{id:o.recoveryMethodDetails?.passkeyId,env:o.recoveryMethodDetails?.passkeyEnv,key:await t.getPasskeyKeyFn(o.recoveryMethodDetails?.passkeyId)}}}}},n=await this.iframeManager.recover(s);if(p=n.account,!r){const e=await this.iframeManager.switchChain(t.chainId);p=e.account}}}return o(async()=>{const e=await this.backendApiClients.accountsApi.getAccountV2({id:p},{headers:{authorization:`Bearer ${d.baseConfiguration.publishableKey}`,"x-player-token":n.token,"x-auth-provider":n.thirdPartyProvider,"x-token-type":n.thirdPartyTokenType}}),t=new c({user:e.data.user,chainType:e.data.chainType,id:e.data.id,address:e.data.address,ownerAddress:e.data.ownerAddress,accountType:e.data.accountType,createdAt:e.data.createdAt,implementationType:e.data.smartAccount?.implementationType,chainId:e.data.chainId,salt:e.data.smartAccount?.salt,factoryAddress:e.data.smartAccount?.factoryAddress,recoveryMethod:c.parseRecoveryMethod(e.data.recoveryMethod),recoveryMethodDetails:e.data.recoveryMethodDetails});return t.save(this.storage),this.eventEmitter.emit(s.ON_SWITCH_ACCOUNT,e.data.address),t},{default:r.AUTHENTICATION_ERROR})}async sign(e,t,a,r){const o=await this.iframeManager.sign(e,t,a,r);return this.eventEmitter.emit(s.ON_SIGNED_MESSAGE,{message:e,signature:o}),o}async export(){return await this.iframeManager.export()}async switchChain({chainId:e}){const t=await c.fromStorage(this.storage);if(t?.accountType===n.EOA)new c({...t,chainId:e}).save(this.storage);else{const a=await this.iframeManager.switchChain(e);new c({...t,id:a.account,chainId:e}).save(this.storage)}}async create(t){const n=await this.iframeManager.create(t),d=await e.fromStorage(this.storage);if(!d)throw new a("No access token found",r.NOT_LOGGED_IN_ERROR);const y=i.getInstance();if(!y)throw new a("Configuration not found",r.INVALID_CONFIGURATION);return o(async()=>{const e=await this.backendApiClients.accountsApi.getAccountV2({id:n.account},{headers:{authorization:`Bearer ${y.baseConfiguration.publishableKey}`,"x-player-token":d.token,"x-auth-provider":d.thirdPartyProvider,"x-token-type":d.thirdPartyTokenType}}),t=new c({user:e.data.user,chainType:e.data.chainType,id:e.data.id,address:e.data.address,ownerAddress:e.data.ownerAddress,accountType:e.data.accountType,createdAt:e.data.createdAt,implementationType:e.data.smartAccount?.implementationType,chainId:e.data.chainId,salt:e.data.smartAccount?.salt,factoryAddress:e.data.smartAccount?.factoryAddress,recoveryMethod:c.parseRecoveryMethod(e.data.recoveryMethod),recoveryMethodDetails:e.data.recoveryMethodDetails});return t.save(this.storage),this.eventEmitter.emit(s.ON_SWITCH_ACCOUNT,e.data.address),t},{default:r.AUTHENTICATION_ERROR})}async recover(t){const n=await this.iframeManager.recover(t),d=await e.fromStorage(this.storage);if(!d)throw new a("No access token found",r.NOT_LOGGED_IN_ERROR);const y=i.getInstance();if(!y)throw new a("Configuration not found",r.INVALID_CONFIGURATION);return o(async()=>{const e=await this.backendApiClients.accountsApi.getAccountV2({id:n.account},{headers:{authorization:`Bearer ${y.baseConfiguration.publishableKey}`,"x-player-token":d.token,"x-auth-provider":d.thirdPartyProvider,"x-token-type":d.thirdPartyTokenType}}),t=new c({user:e.data.user,chainType:e.data.chainType,id:e.data.id,address:e.data.address,ownerAddress:e.data.ownerAddress,accountType:e.data.accountType,createdAt:e.data.createdAt,implementationType:e.data.smartAccount?.implementationType,chainId:e.data.chainId,salt:e.data.smartAccount?.salt,factoryAddress:e.data.smartAccount?.factoryAddress,recoveryMethod:c.parseRecoveryMethod(e.data.recoveryMethod),recoveryMethodDetails:e.data.recoveryMethodDetails});return t.save(this.storage),this.eventEmitter.emit(s.ON_SWITCH_ACCOUNT,e.data.address),t},{default:r.AUTHENTICATION_ERROR})}async setRecoveryMethod({recoveryMethod:e,recoveryPassword:t,encryptionSession:a,passkeyInfo:r}){await this.iframeManager.setRecoveryMethod(e,t,a,r?.passkeyKey,r?.passkeyId)}async disconnect(){await this.iframeManager.disconnect(),this.storage.remove(d.ACCOUNT)}}export{y as EmbeddedSigner};
1
+ import{Authentication as e}from"../core/configuration/authentication.js";import{PasskeyHandler as t}from"../core/configuration/passkey.js";import{OpenfortError as a,OpenfortErrorType as r,withOpenfortError as o}from"../core/errors/openfortError.js";import{OpenfortEvents as s,AccountTypeEnum as n}from"../types/types.js";import{SDKConfiguration as i}from"../core/config/config.js";import{Account as c}from"../core/configuration/account.js";import{StorageKeys as d}from"../storage/istorage.js";import"eventemitter3";import"./evm/JsonRpcError.js";import"@ethersproject/keccak256";import"./evm/types.js";import"./evm/provider/eip6963.js";import"../core/errors/sentry.js";import"./messaging/browserMessenger/backwardCompatibility.js";import"./types.js";import"jose";class y{iframeManager;storage;backendApiClients;passkeyHandler;eventEmitter;constructor(e,t,a,r,o){this.iframeManager=e,this.storage=t,this.backendApiClients=a,this.passkeyHandler=r,this.eventEmitter=o}async createPasskey(e){const a=await this.passkeyHandler.createPasskey({id:t.randomPasskeyName(),displayName:"Openfort - Embedded Wallet",seed:e});return{id:a.id,key:a.key}}async configure(t){const n=await e.fromStorage(this.storage);if(!n)throw new a("No access token found",r.NOT_LOGGED_IN_ERROR);const d=i.getInstance();if(!d)throw new a("Configuration not found",r.INVALID_CONFIGURATION);const y=await c.fromStorage(this.storage);let p;if(y){const e={account:y.id,...t.entropy&&{entropy:{...t.entropy.recoveryPassword&&{recoveryPassword:t.entropy.recoveryPassword},...t.entropy.encryptionSession&&{encryptionSession:t.entropy.encryptionSession},..."passkey"===y.recoveryMethod&&{passkey:{id:y.recoveryMethodDetails?.passkeyId,env:y.recoveryMethodDetails?.passkeyEnv,key:await t.getPasskeyKeyFn(y.recoveryMethodDetails?.passkeyId)}}}}},a=await this.iframeManager.recover(e);p=a.account}else{const e=await this.backendApiClients.accountsApi.getAccountsV2({user:n.player,accountType:t.accountType,chainType:t.chainType},{headers:{authorization:`Bearer ${d.baseConfiguration.publishableKey}`,"x-player-token":n.token,"x-auth-provider":n.thirdPartyProvider,"x-token-type":n.thirdPartyTokenType}});if(0===e.data.data.length){const e=t.entropy?.passkey?await this.createPasskey(n.player):void 0,a={accountType:t.accountType,chainType:t.chainType,chainId:t.chainId,...t.entropy&&{entropy:{...t.entropy.recoveryPassword&&{recoveryPassword:t.entropy.recoveryPassword},...t.entropy.encryptionSession&&{encryptionSession:t.entropy.encryptionSession},...t.entropy.passkey&&{passkey:e}}}},r=await this.iframeManager.create(a);p=r.account}else{const a=e.data.data,r=a.find(e=>e.chainId===t.chainId),o=r||a[0],s={account:o.id,...t.entropy&&{entropy:{...t.entropy.recoveryPassword&&{recoveryPassword:t.entropy.recoveryPassword},...t.entropy.encryptionSession&&{encryptionSession:t.entropy.encryptionSession},..."passkey"===o.recoveryMethod&&{passkey:{id:o.recoveryMethodDetails?.passkeyId,env:o.recoveryMethodDetails?.passkeyEnv,key:await t.getPasskeyKeyFn(o.recoveryMethodDetails?.passkeyId)}}}}},n=await this.iframeManager.recover(s);if(p=n.account,!r){const e=await this.iframeManager.switchChain(t.chainId);p=e.account}}}return o(async()=>{const e=await this.backendApiClients.accountsApi.getAccountV2({id:p},{headers:{authorization:`Bearer ${d.baseConfiguration.publishableKey}`,"x-player-token":n.token,"x-auth-provider":n.thirdPartyProvider,"x-token-type":n.thirdPartyTokenType}}),t=new c({user:e.data.user,chainType:e.data.chainType,id:e.data.id,address:e.data.address,ownerAddress:e.data.ownerAddress,accountType:e.data.accountType,createdAt:e.data.createdAt,implementationAddress:e.data.smartAccount?.implementationAddress,implementationType:e.data.smartAccount?.implementationType,chainId:e.data.chainId,salt:e.data.smartAccount?.salt,factoryAddress:e.data.smartAccount?.factoryAddress,recoveryMethod:c.parseRecoveryMethod(e.data.recoveryMethod),recoveryMethodDetails:e.data.recoveryMethodDetails});return t.save(this.storage),this.eventEmitter.emit(s.ON_SWITCH_ACCOUNT,e.data.address),t},{default:r.AUTHENTICATION_ERROR})}async sign(e,t,a,r){const o=await this.iframeManager.sign(e,t,a,r);return this.eventEmitter.emit(s.ON_SIGNED_MESSAGE,{message:e,signature:o}),o}async export(){return await this.iframeManager.export()}async switchChain({chainId:e}){const t=await c.fromStorage(this.storage);if(t?.accountType===n.EOA)new c({...t,chainId:e}).save(this.storage);else{const a=await this.iframeManager.switchChain(e);new c({...t,id:a.account,chainId:e}).save(this.storage)}}async create(t){const n=await this.iframeManager.create(t),d=await e.fromStorage(this.storage);if(!d)throw new a("No access token found",r.NOT_LOGGED_IN_ERROR);const y=i.getInstance();if(!y)throw new a("Configuration not found",r.INVALID_CONFIGURATION);return o(async()=>{const e=await this.backendApiClients.accountsApi.getAccountV2({id:n.account},{headers:{authorization:`Bearer ${y.baseConfiguration.publishableKey}`,"x-player-token":d.token,"x-auth-provider":d.thirdPartyProvider,"x-token-type":d.thirdPartyTokenType}}),t=new c({user:e.data.user,chainType:e.data.chainType,id:e.data.id,address:e.data.address,ownerAddress:e.data.ownerAddress,accountType:e.data.accountType,createdAt:e.data.createdAt,implementationType:e.data.smartAccount?.implementationType,chainId:e.data.chainId,implementationAddress:e.data.smartAccount?.implementationAddress,salt:e.data.smartAccount?.salt,factoryAddress:e.data.smartAccount?.factoryAddress,recoveryMethod:c.parseRecoveryMethod(e.data.recoveryMethod),recoveryMethodDetails:e.data.recoveryMethodDetails});return t.save(this.storage),this.eventEmitter.emit(s.ON_SWITCH_ACCOUNT,e.data.address),t},{default:r.AUTHENTICATION_ERROR})}async recover(t){const n=await this.iframeManager.recover(t),d=await e.fromStorage(this.storage);if(!d)throw new a("No access token found",r.NOT_LOGGED_IN_ERROR);const y=i.getInstance();if(!y)throw new a("Configuration not found",r.INVALID_CONFIGURATION);return o(async()=>{const e=await this.backendApiClients.accountsApi.getAccountV2({id:n.account},{headers:{authorization:`Bearer ${y.baseConfiguration.publishableKey}`,"x-player-token":d.token,"x-auth-provider":d.thirdPartyProvider,"x-token-type":d.thirdPartyTokenType}}),t=new c({user:e.data.user,chainType:e.data.chainType,id:e.data.id,address:e.data.address,ownerAddress:e.data.ownerAddress,accountType:e.data.accountType,createdAt:e.data.createdAt,implementationAddress:e.data.smartAccount?.implementationAddress,implementationType:e.data.smartAccount?.implementationType,chainId:e.data.chainId,salt:e.data.smartAccount?.salt,factoryAddress:e.data.smartAccount?.factoryAddress,recoveryMethod:c.parseRecoveryMethod(e.data.recoveryMethod),recoveryMethodDetails:e.data.recoveryMethodDetails});return t.save(this.storage),this.eventEmitter.emit(s.ON_SWITCH_ACCOUNT,e.data.address),t},{default:r.AUTHENTICATION_ERROR})}async setRecoveryMethod({recoveryMethod:e,recoveryPassword:t,encryptionSession:a,passkeyInfo:r}){await this.iframeManager.setRecoveryMethod(e,t,a,r?.passkeyKey,r?.passkeyId)}async disconnect(){await this.iframeManager.disconnect(),this.storage.remove(d.ACCOUNT)}}export{y as EmbeddedSigner};