@openfort/openfort-js 1.2.1 → 1.3.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- "use strict";var e=require("axios"),t=require("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 o="https://example.com",i=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,o=s)=>{const i={...e.options,url:(n?.basePath||a.defaults.baseURL||o)+e.url};return a.request(i)}},p=function(t){const n=function(e){return{cancelTransferOwnership:async(t,s,n={})=>{i("cancelTransferOwnership","id",t),i("cancelTransferOwnership","cancelTransferOwnershipRequest",s);const a="/v1/accounts/{id}/cancel_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},completeRecovery:async(t,s,n={})=>{i("completeRecovery","id",t),i("completeRecovery","completeRecoveryRequest",s);const a="/v1/accounts/{id}/complete_recovery".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},createAccount:async(t,s={})=>{i("createAccount","createAccountRequest",t);const n=new URL("/v1/accounts",o);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={})=>{i("deployAccount","id",t),i("deployAccount","deployRequest",s);const a="/v1/accounts/{id}/deploy".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},disableAccount:async(t,s={})=>{i("disableAccount","id",t);const n="/v1/accounts/{id}/disable".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);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={})=>{i("getAccount","id",t);const a="/v1/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},P={};await r(p,e),s&&(P.expand=s),h(c,P);let w=u&&u.headers?u.headers:{};return l.headers={...p,...w,...n.headers},{url:d(c),options:l}},getAccounts:async(t,s,n,a,i,c,u,l={})=>{const p=new URL("/v1/accounts",o);let P;e&&(P=e.baseOptions);const w={method:"GET",...P,...l},y={},g={};await r(y,e),void 0!==t&&(g.limit=t),void 0!==s&&(g.skip=s),void 0!==n&&(g.order=n),void 0!==a&&(g.chainId=a),void 0!==i&&(g.player=i),void 0!==c&&(g.address=c),u&&(g.expand=u),h(p,g);let m=P&&P.headers?P.headers:{};return w.headers={...y,...m,...l.headers},{url:d(p),options:w}},requestTransferOwnership:async(t,s,n={})=>{i("requestTransferOwnership","id",t),i("requestTransferOwnership","transferOwnershipRequest",s);const a="/v1/accounts/{id}/request_transfer_ownership".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},signPayload:async(t,s,n={})=>{i("signPayload","id",t),i("signPayload","signPayloadRequest",s);const a="/v1/accounts/{id}/sign_payload".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},startRecovery:async(t,s,n={})=>{i("startRecovery","id",t),i("startRecovery","startRecoveryRequest",s);const a="/v1/accounts/{id}/start_recovery".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},syncAccount:async(t,s={})=>{i("syncAccount","id",t);const n="/v1/accounts/{id}/sync".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);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,o,i){const r=await n.cancelTransferOwnership(a,o,i);return l(r,e,s,t)},async completeRecovery(a,o,i){const r=await n.completeRecovery(a,o,i);return l(r,e,s,t)},async createAccount(a,o){const i=await n.createAccount(a,o);return l(i,e,s,t)},async deployAccount(a,o,i){const r=await n.deployAccount(a,o,i);return l(r,e,s,t)},async disableAccount(a,o){const i=await n.disableAccount(a,o);return l(i,e,s,t)},async getAccount(a,o,i){const r=await n.getAccount(a,o,i);return l(r,e,s,t)},async getAccounts(a,o,i,r,c,h,u,d){const p=await n.getAccounts(a,o,i,r,c,h,u,d);return l(p,e,s,t)},async requestTransferOwnership(a,o,i){const r=await n.requestTransferOwnership(a,o,i);return l(r,e,s,t)},async signPayload(a,o,i){const r=await n.signPayload(a,o,i);return l(r,e,s,t)},async startRecovery(a,o,i){const r=await n.startRecovery(a,o,i);return l(r,e,s,t)},async syncAccount(a,o){const i=await n.syncAccount(a,o);return l(i,e,s,t)}}};class P 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))}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))}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))}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))}syncAccount(e,t){return p(this.configuration).syncAccount(e.id,t).then(e=>e(this.axios,this.basePath))}}const w=function(t){const n=function(e){return{createAccountV2:async(t,s={})=>{i("createAccountV2","createAccountRequestV2",t);const n=new URL("/v2/accounts",o);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}},getAccountV2:async(t,s={})=>{i("getAccountV2","id",t);const n="/v2/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);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}},getAccountsV2:async(t,s,n,a,i,c,u,l,p,P={})=>{const w=new URL("/v2/accounts",o);let y;e&&(y=e.baseOptions);const g={method:"GET",...y,...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!==i&&(R.user=i),void 0!==c&&(R.chainType=c),void 0!==u&&(R.accountType=u),void 0!==l&&(R.custody=l),void 0!==p&&(R.address=p),h(w,R);let f=y&&y.headers?y.headers:{};return g.headers={...m,...f,...P.headers},{url:d(w),options:g}},getSignerIdByAddress:async(t,s={})=>{i("getSignerIdByAddress","address",t);const n=new URL("/v2/accounts/signer",o);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}},removeAccount:async(t,s={})=>{i("removeAccount","id",t);const n="/v2/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);let c;e&&(c=e.baseOptions);const u={method:"DELETE",...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}},switchChainV2:async(t,s={})=>{i("switchChainV2","switchChainQueriesV2",t);const n=new URL("/v2/accounts/switch-chain",o);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 createAccountV2(a,o){const i=await n.createAccountV2(a,o);return l(i,e,s,t)},async getAccountV2(a,o){const i=await n.getAccountV2(a,o);return l(i,e,s,t)},async getAccountsV2(a,o,i,r,c,h,u,d,p,P){const w=await n.getAccountsV2(a,o,i,r,c,h,u,d,p,P);return l(w,e,s,t)},async getSignerIdByAddress(a,o){const i=await n.getSignerIdByAddress(a,o);return l(i,e,s,t)},async removeAccount(a,o){const i=await n.removeAccount(a,o);return l(i,e,s,t)},async switchChainV2(a,o){const i=await n.switchChainV2(a,o);return l(i,e,s,t)}}};class y extends n{createAccountV2(e,t){return w(this.configuration).createAccountV2(e.createAccountRequestV2,t).then(e=>e(this.axios,this.basePath))}getAccountV2(e,t){return w(this.configuration).getAccountV2(e.id,t).then(e=>e(this.axios,this.basePath))}getAccountsV2(e={},t){return w(this.configuration).getAccountsV2(e.limit,e.skip,e.order,e.chainId,e.user,e.chainType,e.accountType,e.custody,e.address,t).then(e=>e(this.axios,this.basePath))}getSignerIdByAddress(e,t){return w(this.configuration).getSignerIdByAddress(e.address,t).then(e=>e(this.axios,this.basePath))}removeAccount(e,t){return w(this.configuration).removeAccount(e.id,t).then(e=>e(this.axios,this.basePath))}switchChainV2(e,t){return w(this.configuration).switchChainV2(e.switchChainQueriesV2,t).then(e=>e(this.axios,this.basePath))}}const g=function(t){const n=function(e){return{authenticateSIWE:async(t,s={})=>{i("authenticateSIWE","sIWEAuthenticateRequest",t);const n=new URL("/iam/v1/siwe/authenticate",o);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={})=>{i("getJwks","publishableKey",t);const n="/iam/v1/{publishable_key}/jwks.json".replace("{publishable_key}",encodeURIComponent(String(t))),a=new URL(n,o);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={})=>{i("initOAuth","oAuthInitRequest",t);const a=new URL("/iam/v1/oauth/init",o);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 P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},initSIWE:async(t,s,n={})=>{i("initSIWE","sIWERequest",t);const a=new URL("/iam/v1/siwe/init",o);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 P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},linkEmail:async(t,s,n={})=>{i("linkEmail","loginRequest",t);const a=new URL("/iam/v1/password/link",o);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={})=>{i("linkOAuth","oAuthInitRequest",t);const a=new URL("/iam/v1/oauth/init_link",o);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={})=>{i("linkSIWE","sIWEAuthenticateRequest",t);const n=new URL("/iam/v1/siwe/link",o);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={})=>{i("linkThirdParty","thirdPartyLinkRequest",t);const a=new URL("/iam/v1/oauth/link",o);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={})=>{i("loginEmailPassword","loginRequest",t);const a=new URL("/iam/v1/password/login",o);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 P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},loginOIDC:async(t,s,n={})=>{i("loginOIDC","loginOIDCRequest",t);const a=new URL("/iam/v1/oidc/login",o);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 P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},loginWithIdToken:async(t,s={})=>{i("loginWithIdToken","loginWithIdTokenRequest",t);const n=new URL("/iam/v1/oauth/login_id_token",o);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={})=>{i("logout","logoutRequest",t);const n=new URL("/iam/v1/sessions/logout",o);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",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},poolOAuth:async(t,s={})=>{i("poolOAuth","key",t);const n=new URL("/iam/v1/oauth/pool",o);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={})=>{i("refresh","refreshTokenRequest",t);const n=new URL("/iam/v1/sessions",o);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",o);let a;e&&(a=e.baseOptions);const i={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 i.headers={...c,...u,...s.headers},{url:d(n),options:i}},requestEmailVerification:async(t,s={})=>{i("requestEmailVerification","requestVerifyEmailRequest",t);const n=new URL("/iam/v1/password/request_email_verification",o);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={})=>{i("requestResetPassword","requestResetPasswordRequest",t);const n=new URL("/iam/v1/password/request_reset",o);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={})=>{i("resetPassword","resetPasswordRequest",t);const n=new URL("/iam/v1/password/reset",o);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={})=>{i("signupEmailPassword","signupRequest",t);const a=new URL("/iam/v1/password/signup",o);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 P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},thirdParty:async(t,s,n={})=>{i("thirdParty","thirdPartyOAuthRequest",t);const a=new URL("/iam/v1/oauth/third_party",o);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 P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},unlinkEmail:async(t,s={})=>{i("unlinkEmail","unlinkEmailRequest",t);const n=new URL("/iam/v1/password/unlink",o);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={})=>{i("unlinkOAuth","unlinkOAuthRequest",t);const n=new URL("/iam/v1/oauth/unlink",o);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={})=>{i("unlinkSIWE","sIWERequest",t);const n=new URL("/iam/v1/siwe/unlink",o);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={})=>{i("verifyEmail","verifyEmailRequest",t);const n=new URL("/iam/v1/password/verify_email",o);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={})=>{i("verifyOAuthToken","authenticateOAuthRequest",t);const n=new URL("/iam/v1/oauth/verify",o);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,o){const i=await n.authenticateSIWE(a,o);return l(i,e,s,t)},async getJwks(a,o){const i=await n.getJwks(a,o);return l(i,e,s,t)},async initOAuth(a,o,i){const r=await n.initOAuth(a,o,i);return l(r,e,s,t)},async initSIWE(a,o,i){const r=await n.initSIWE(a,o,i);return l(r,e,s,t)},async linkEmail(a,o,i){const r=await n.linkEmail(a,o,i);return l(r,e,s,t)},async linkOAuth(a,o,i){const r=await n.linkOAuth(a,o,i);return l(r,e,s,t)},async linkSIWE(a,o){const i=await n.linkSIWE(a,o);return l(i,e,s,t)},async linkThirdParty(a,o,i){const r=await n.linkThirdParty(a,o,i);return l(r,e,s,t)},async loginEmailPassword(a,o,i){const r=await n.loginEmailPassword(a,o,i);return l(r,e,s,t)},async loginOIDC(a,o,i){const r=await n.loginOIDC(a,o,i);return l(r,e,s,t)},async loginWithIdToken(a,o){const i=await n.loginWithIdToken(a,o);return l(i,e,s,t)},async logout(a,o){const i=await n.logout(a,o);return l(i,e,s,t)},async me(a){const o=await n.me(a);return l(o,e,s,t)},async poolOAuth(a,o){const i=await n.poolOAuth(a,o);return l(i,e,s,t)},async refresh(a,o){const i=await n.refresh(a,o);return l(i,e,s,t)},async registerGuest(a,o){const i=await n.registerGuest(a,o);return l(i,e,s,t)},async requestEmailVerification(a,o){const i=await n.requestEmailVerification(a,o);return l(i,e,s,t)},async requestResetPassword(a,o){const i=await n.requestResetPassword(a,o);return l(i,e,s,t)},async resetPassword(a,o){const i=await n.resetPassword(a,o);return l(i,e,s,t)},async signupEmailPassword(a,o,i){const r=await n.signupEmailPassword(a,o,i);return l(r,e,s,t)},async thirdParty(a,o,i){const r=await n.thirdParty(a,o,i);return l(r,e,s,t)},async unlinkEmail(a,o){const i=await n.unlinkEmail(a,o);return l(i,e,s,t)},async unlinkOAuth(a,o){const i=await n.unlinkOAuth(a,o);return l(i,e,s,t)},async unlinkSIWE(a,o){const i=await n.unlinkSIWE(a,o);return l(i,e,s,t)},async verifyEmail(a,o){const i=await n.verifyEmail(a,o);return l(i,e,s,t)},async verifyOAuthToken(a,o){const i=await n.verifyOAuthToken(a,o);return l(i,e,s,t)}}};class m 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 R=function(t){const n=function(e){return{accountInfoPost:async(t,s={})=>{i("accountInfoPost","accountInfoPostRequest",t);const n=new URL("/account-info",o);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}},changeEmailPost:async(t,s={})=>{i("changeEmailPost","changeEmailPostRequest",t);const n=new URL("/change-email",o);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}},changePasswordPost:async(t,s={})=>{i("changePasswordPost","changePasswordPostRequest",t);const n=new URL("/change-password",o);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}},checkVerificationOtp:async(t,s={})=>{i("checkVerificationOtp","checkVerificationOtpRequest",t);const n=new URL("/email-otp/check-verification-otp",o);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}},emailOtpResetPasswordPost:async(t,s={})=>{i("emailOtpResetPasswordPost","emailOtpResetPasswordPostRequest",t);const n=new URL("/email-otp/reset-password",o);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}},emailOtpSendVerificationOtpPost:async(t,s={})=>{i("emailOtpSendVerificationOtpPost","emailOtpSendVerificationOtpPostRequest",t);const n=new URL("/email-otp/send-verification-otp",o);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}},emailOtpVerifyEmailPost:async(t,s={})=>{i("emailOtpVerifyEmailPost","emailOtpVerifyEmailPostRequest",t);const n=new URL("/email-otp/verify-email",o);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}},forgetPasswordEmailOtpPost:async(t,s={})=>{i("forgetPasswordEmailOtpPost","forgetPasswordEmailOtpPostRequest",t);const n=new URL("/forget-password/email-otp",o);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}},forgetPasswordPost:async(t,s={})=>{i("forgetPasswordPost","forgetPasswordPostRequest",t);const n=new URL("/forget-password",o);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}},getAccessTokenPost:async(t,s={})=>{i("getAccessTokenPost","refreshTokenPostRequest",t);const n=new URL("/get-access-token",o);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}},getSessionGet:async(t,s,n={})=>{const a=new URL("/get-session",o);let i;e&&(i=e.baseOptions);const r={method:"GET",...i,...n},c={},u={};void 0!==s&&(u.disableCookieCache=s),null!=t&&(c["x-project-key"]=String(t)),h(a,u);let l=i&&i.headers?i.headers:{};return r.headers={...c,...l,...n.headers},{url:d(a),options:r}},linkSiweListWalletsGet:async(t={})=>{const s=new URL("/link-siwe/list-wallets",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},linkSiweNoncePost:async(t,s={})=>{i("linkSiweNoncePost","siweNoncePostRequest",t);const n=new URL("/link-siwe/nonce",o);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}},linkSiweUnlinkPost:async(t,s={})=>{i("linkSiweUnlinkPost","linkSiweUnlinkPostRequest",t);const n=new URL("/link-siwe/unlink",o);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}},linkSiweVerifyPost:async(t,s={})=>{i("linkSiweVerifyPost","siweVerifyPostRequest",t);const n=new URL("/link-siwe/verify",o);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}},linkSocialPost:async(t,s={})=>{i("linkSocialPost","linkSocialPostRequest",t);const n=new URL("/link-social",o);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}},listAccountsGet:async(t={})=>{const s=new URL("/list-accounts",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},listSessionsGet:async(t={})=>{const s=new URL("/list-sessions",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},phoneNumberForgetPasswordPost:async(t,s={})=>{i("phoneNumberForgetPasswordPost","phoneNumberForgetPasswordPostRequest",t);const n=new URL("/phone-number/forget-password",o);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}},phoneNumberRequestPasswordResetPost:async(t,s={})=>{i("phoneNumberRequestPasswordResetPost","phoneNumberRequestPasswordResetPostRequest",t);const n=new URL("/phone-number/request-password-reset",o);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}},phoneNumberResetPasswordPost:async(t,s={})=>{i("phoneNumberResetPasswordPost","phoneNumberResetPasswordPostRequest",t);const n=new URL("/phone-number/reset-password",o);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}},phoneNumberSendOtpPost:async(t,s={})=>{i("phoneNumberSendOtpPost","phoneNumberSendOtpPostRequest",t);const n=new URL("/phone-number/send-otp",o);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}},phoneNumberVerifyPost:async(t,s={})=>{i("phoneNumberVerifyPost","phoneNumberVerifyPostRequest",t);const n=new URL("/phone-number/verify",o);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}},refreshTokenPost:async(t,s={})=>{i("refreshTokenPost","refreshTokenPostRequest",t);const n=new URL("/refresh-token",o);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}},requestPasswordResetPost:async(t,s={})=>{i("requestPasswordResetPost","forgetPasswordPostRequest",t);const n=new URL("/request-password-reset",o);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}},resetPasswordPost:async(t,s={})=>{i("resetPasswordPost","resetPasswordPostRequest",t);const n=new URL("/reset-password",o);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}},resetPasswordTokenGet:async(t,s,n={})=>{i("resetPasswordTokenGet","token",t);const a="/reset-password/{token}".replace("{token}",encodeURIComponent(String(t))),r=new URL(a,o);let c;e&&(c=e.baseOptions);const u={method:"GET",...c,...n},l={};void 0!==s&&(l.callbackURL=s),h(r,l);let p=c&&c.headers?c.headers:{};return u.headers={...p,...n.headers},{url:d(r),options:u}},revokeOtherSessionsPost:async(t,s={})=>{const n=new URL("/revoke-other-sessions",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},revokeSessionPost:async(t,s={})=>{const n=new URL("/revoke-session",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},revokeSessionsPost:async(t,s={})=>{const n=new URL("/revoke-sessions",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},sendVerificationEmailPost:async(t,s={})=>{const n=new URL("/send-verification-email",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},signInAnonymousPost:async(t={})=>{const s=new URL("/sign-in/anonymous",o);let n;e&&(n=e.baseOptions);const a={method:"POST",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},signInEmailOtpPost:async(t,s={})=>{i("signInEmailOtpPost","signInEmailOtpPostRequest",t);const n=new URL("/sign-in/email-otp",o);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}},signInEmailPost:async(t,s={})=>{i("signInEmailPost","signInEmailPostRequest",t);const n=new URL("/sign-in/email",o);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}},signInPhoneNumberPost:async(t,s={})=>{i("signInPhoneNumberPost","signInPhoneNumberPostRequest",t);const n=new URL("/sign-in/phone-number",o);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}},signOutPost:async(t,s={})=>{const n=new URL("/sign-out",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},signUpEmailPost:async(t,s={})=>{const n=new URL("/sign-up/email",o);let a;e&&(a=e.baseOptions);const i={method:"POST",...a,...s},r={"Content-Type":"application/json"};h(n,{});let c=a&&a.headers?a.headers:{};return i.headers={...r,...c,...s.headers},i.data=u(t,i,e),{url:d(n),options:i}},siweNoncePost:async(t,s={})=>{i("siweNoncePost","siweNoncePostRequest",t);const n=new URL("/siwe/nonce",o);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}},siweVerifyPost:async(t,s={})=>{i("siweVerifyPost","siweVerifyPostRequest",t);const n=new URL("/siwe/verify",o);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}},socialSignIn:async(t,s={})=>{i("socialSignIn","socialSignInRequest",t);const n=new URL("/sign-in/social",o);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}},unlinkAccountPost:async(t,s={})=>{i("unlinkAccountPost","unlinkAccountPostRequest",t);const n=new URL("/unlink-account",o);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}},verifyEmailGet:async(t,s,n={})=>{i("verifyEmailGet","token",t);const a=new URL("/verify-email",o);let r;e&&(r=e.baseOptions);const c={method:"GET",...r,...n},u={};void 0!==t&&(u.token=t),void 0!==s&&(u.callbackURL=s),h(a,u);let l=r&&r.headers?r.headers:{};return c.headers={...l,...n.headers},{url:d(a),options:c}}}}(t);return{async accountInfoPost(a,o){const i=await n.accountInfoPost(a,o);return l(i,e,s,t)},async changeEmailPost(a,o){const i=await n.changeEmailPost(a,o);return l(i,e,s,t)},async changePasswordPost(a,o){const i=await n.changePasswordPost(a,o);return l(i,e,s,t)},async checkVerificationOtp(a,o){const i=await n.checkVerificationOtp(a,o);return l(i,e,s,t)},async emailOtpResetPasswordPost(a,o){const i=await n.emailOtpResetPasswordPost(a,o);return l(i,e,s,t)},async emailOtpSendVerificationOtpPost(a,o){const i=await n.emailOtpSendVerificationOtpPost(a,o);return l(i,e,s,t)},async emailOtpVerifyEmailPost(a,o){const i=await n.emailOtpVerifyEmailPost(a,o);return l(i,e,s,t)},async forgetPasswordEmailOtpPost(a,o){const i=await n.forgetPasswordEmailOtpPost(a,o);return l(i,e,s,t)},async forgetPasswordPost(a,o){const i=await n.forgetPasswordPost(a,o);return l(i,e,s,t)},async getAccessTokenPost(a,o){const i=await n.getAccessTokenPost(a,o);return l(i,e,s,t)},async getSessionGet(a,o,i){const r=await n.getSessionGet(a,o,i);return l(r,e,s,t)},async linkSiweListWalletsGet(a){const o=await n.linkSiweListWalletsGet(a);return l(o,e,s,t)},async linkSiweNoncePost(a,o){const i=await n.linkSiweNoncePost(a,o);return l(i,e,s,t)},async linkSiweUnlinkPost(a,o){const i=await n.linkSiweUnlinkPost(a,o);return l(i,e,s,t)},async linkSiweVerifyPost(a,o){const i=await n.linkSiweVerifyPost(a,o);return l(i,e,s,t)},async linkSocialPost(a,o){const i=await n.linkSocialPost(a,o);return l(i,e,s,t)},async listAccountsGet(a){const o=await n.listAccountsGet(a);return l(o,e,s,t)},async listSessionsGet(a){const o=await n.listSessionsGet(a);return l(o,e,s,t)},async phoneNumberForgetPasswordPost(a,o){const i=await n.phoneNumberForgetPasswordPost(a,o);return l(i,e,s,t)},async phoneNumberRequestPasswordResetPost(a,o){const i=await n.phoneNumberRequestPasswordResetPost(a,o);return l(i,e,s,t)},async phoneNumberResetPasswordPost(a,o){const i=await n.phoneNumberResetPasswordPost(a,o);return l(i,e,s,t)},async phoneNumberSendOtpPost(a,o){const i=await n.phoneNumberSendOtpPost(a,o);return l(i,e,s,t)},async phoneNumberVerifyPost(a,o){const i=await n.phoneNumberVerifyPost(a,o);return l(i,e,s,t)},async refreshTokenPost(a,o){const i=await n.refreshTokenPost(a,o);return l(i,e,s,t)},async requestPasswordResetPost(a,o){const i=await n.requestPasswordResetPost(a,o);return l(i,e,s,t)},async resetPasswordPost(a,o){const i=await n.resetPasswordPost(a,o);return l(i,e,s,t)},async resetPasswordTokenGet(a,o,i){const r=await n.resetPasswordTokenGet(a,o,i);return l(r,e,s,t)},async revokeOtherSessionsPost(a,o){const i=await n.revokeOtherSessionsPost(a,o);return l(i,e,s,t)},async revokeSessionPost(a,o){const i=await n.revokeSessionPost(a,o);return l(i,e,s,t)},async revokeSessionsPost(a,o){const i=await n.revokeSessionsPost(a,o);return l(i,e,s,t)},async sendVerificationEmailPost(a,o){const i=await n.sendVerificationEmailPost(a,o);return l(i,e,s,t)},async signInAnonymousPost(a){const o=await n.signInAnonymousPost(a);return l(o,e,s,t)},async signInEmailOtpPost(a,o){const i=await n.signInEmailOtpPost(a,o);return l(i,e,s,t)},async signInEmailPost(a,o){const i=await n.signInEmailPost(a,o);return l(i,e,s,t)},async signInPhoneNumberPost(a,o){const i=await n.signInPhoneNumberPost(a,o);return l(i,e,s,t)},async signOutPost(a,o){const i=await n.signOutPost(a,o);return l(i,e,s,t)},async signUpEmailPost(a,o){const i=await n.signUpEmailPost(a,o);return l(i,e,s,t)},async siweNoncePost(a,o){const i=await n.siweNoncePost(a,o);return l(i,e,s,t)},async siweVerifyPost(a,o){const i=await n.siweVerifyPost(a,o);return l(i,e,s,t)},async socialSignIn(a,o){const i=await n.socialSignIn(a,o);return l(i,e,s,t)},async unlinkAccountPost(a,o){const i=await n.unlinkAccountPost(a,o);return l(i,e,s,t)},async verifyEmailGet(a,o,i){const r=await n.verifyEmailGet(a,o,i);return l(r,e,s,t)}}};class f extends n{accountInfoPost(e,t){return R(this.configuration).accountInfoPost(e.accountInfoPostRequest,t).then(e=>e(this.axios,this.basePath))}changeEmailPost(e,t){return R(this.configuration).changeEmailPost(e.changeEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}changePasswordPost(e,t){return R(this.configuration).changePasswordPost(e.changePasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}checkVerificationOtp(e,t){return R(this.configuration).checkVerificationOtp(e.checkVerificationOtpRequest,t).then(e=>e(this.axios,this.basePath))}emailOtpResetPasswordPost(e,t){return R(this.configuration).emailOtpResetPasswordPost(e.emailOtpResetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}emailOtpSendVerificationOtpPost(e,t){return R(this.configuration).emailOtpSendVerificationOtpPost(e.emailOtpSendVerificationOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}emailOtpVerifyEmailPost(e,t){return R(this.configuration).emailOtpVerifyEmailPost(e.emailOtpVerifyEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}forgetPasswordEmailOtpPost(e,t){return R(this.configuration).forgetPasswordEmailOtpPost(e.forgetPasswordEmailOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}forgetPasswordPost(e,t){return R(this.configuration).forgetPasswordPost(e.forgetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}getAccessTokenPost(e,t){return R(this.configuration).getAccessTokenPost(e.refreshTokenPostRequest,t).then(e=>e(this.axios,this.basePath))}getSessionGet(e={},t){return R(this.configuration).getSessionGet(e.xProjectKey,e.disableCookieCache,t).then(e=>e(this.axios,this.basePath))}linkSiweListWalletsGet(e){return R(this.configuration).linkSiweListWalletsGet(e).then(e=>e(this.axios,this.basePath))}linkSiweNoncePost(e,t){return R(this.configuration).linkSiweNoncePost(e.siweNoncePostRequest,t).then(e=>e(this.axios,this.basePath))}linkSiweUnlinkPost(e,t){return R(this.configuration).linkSiweUnlinkPost(e.linkSiweUnlinkPostRequest,t).then(e=>e(this.axios,this.basePath))}linkSiweVerifyPost(e,t){return R(this.configuration).linkSiweVerifyPost(e.siweVerifyPostRequest,t).then(e=>e(this.axios,this.basePath))}linkSocialPost(e,t){return R(this.configuration).linkSocialPost(e.linkSocialPostRequest,t).then(e=>e(this.axios,this.basePath))}listAccountsGet(e){return R(this.configuration).listAccountsGet(e).then(e=>e(this.axios,this.basePath))}listSessionsGet(e){return R(this.configuration).listSessionsGet(e).then(e=>e(this.axios,this.basePath))}phoneNumberForgetPasswordPost(e,t){return R(this.configuration).phoneNumberForgetPasswordPost(e.phoneNumberForgetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberRequestPasswordResetPost(e,t){return R(this.configuration).phoneNumberRequestPasswordResetPost(e.phoneNumberRequestPasswordResetPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberResetPasswordPost(e,t){return R(this.configuration).phoneNumberResetPasswordPost(e.phoneNumberResetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberSendOtpPost(e,t){return R(this.configuration).phoneNumberSendOtpPost(e.phoneNumberSendOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberVerifyPost(e,t){return R(this.configuration).phoneNumberVerifyPost(e.phoneNumberVerifyPostRequest,t).then(e=>e(this.axios,this.basePath))}refreshTokenPost(e,t){return R(this.configuration).refreshTokenPost(e.refreshTokenPostRequest,t).then(e=>e(this.axios,this.basePath))}requestPasswordResetPost(e,t){return R(this.configuration).requestPasswordResetPost(e.forgetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}resetPasswordPost(e,t){return R(this.configuration).resetPasswordPost(e.resetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}resetPasswordTokenGet(e,t){return R(this.configuration).resetPasswordTokenGet(e.token,e.callbackURL,t).then(e=>e(this.axios,this.basePath))}revokeOtherSessionsPost(e={},t){return R(this.configuration).revokeOtherSessionsPost(e.body,t).then(e=>e(this.axios,this.basePath))}revokeSessionPost(e={},t){return R(this.configuration).revokeSessionPost(e.revokeSessionPostRequest,t).then(e=>e(this.axios,this.basePath))}revokeSessionsPost(e={},t){return R(this.configuration).revokeSessionsPost(e.body,t).then(e=>e(this.axios,this.basePath))}sendVerificationEmailPost(e={},t){return R(this.configuration).sendVerificationEmailPost(e.sendVerificationEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}signInAnonymousPost(e){return R(this.configuration).signInAnonymousPost(e).then(e=>e(this.axios,this.basePath))}signInEmailOtpPost(e,t){return R(this.configuration).signInEmailOtpPost(e.signInEmailOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}signInEmailPost(e,t){return R(this.configuration).signInEmailPost(e.signInEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}signInPhoneNumberPost(e,t){return R(this.configuration).signInPhoneNumberPost(e.signInPhoneNumberPostRequest,t).then(e=>e(this.axios,this.basePath))}signOutPost(e={},t){return R(this.configuration).signOutPost(e.body,t).then(e=>e(this.axios,this.basePath))}signUpEmailPost(e={},t){return R(this.configuration).signUpEmailPost(e.signUpEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}siweNoncePost(e,t){return R(this.configuration).siweNoncePost(e.siweNoncePostRequest,t).then(e=>e(this.axios,this.basePath))}siweVerifyPost(e,t){return R(this.configuration).siweVerifyPost(e.siweVerifyPostRequest,t).then(e=>e(this.axios,this.basePath))}socialSignIn(e,t){return R(this.configuration).socialSignIn(e.socialSignInRequest,t).then(e=>e(this.axios,this.basePath))}unlinkAccountPost(e,t){return R(this.configuration).unlinkAccountPost(e.unlinkAccountPostRequest,t).then(e=>e(this.axios,this.basePath))}verifyEmailGet(e,t){return R(this.configuration).verifyEmailGet(e.token,e.callbackURL,t).then(e=>e(this.axios,this.basePath))}}const O=function(t){const n=function(e){return{handleChainRpcRequest:async(t,s,n={})=>{i("handleChainRpcRequest","chainId",t),i("handleChainRpcRequest","jsonRpcRequest",s);const a="/rpc/{chainId}".replace("{chainId}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}},handleRpcRequest:async(t,s={})=>{i("handleRpcRequest","jsonRpcRequest",t);const n=new URL("/rpc",o);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 handleChainRpcRequest(a,o,i){const r=await n.handleChainRpcRequest(a,o,i);return l(r,e,s,t)},async handleRpcRequest(a,o){const i=await n.handleRpcRequest(a,o);return l(i,e,s,t)}}};class b extends n{handleChainRpcRequest(e,t){return O(this.configuration).handleChainRpcRequest(e.chainId,e.jsonRpcRequest,t).then(e=>e(this.axios,this.basePath))}handleRpcRequest(e,t){return O(this.configuration).handleRpcRequest(e.jsonRpcRequest,t).then(e=>e(this.axios,this.basePath))}}const T=function(t){const n=function(e){return{createSession:async(t,s,n={})=>{i("createSession","createSessionRequest",t);const a=new URL("/v1/sessions",o);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 P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},getPlayerSessions:async(t,s,n,a,c,u={})=>{i("getPlayerSessions","player",t);const l=new URL("/v1/sessions",o);let p;e&&(p=e.baseOptions);const P={method:"GET",...p,...u},w={},y={};await r(w,e),void 0!==s&&(y.limit=s),void 0!==n&&(y.skip=n),void 0!==a&&(y.order=a),void 0!==t&&(y.player=t),c&&(y.expand=c),h(l,y);let g=p&&p.headers?p.headers:{};return P.headers={...w,...g,...u.headers},{url:d(l),options:P}},getSession:async(t,s,n={})=>{i("getSession","id",t);const a="/v1/sessions/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},P={};await r(p,e),s&&(P.expand=s),h(c,P);let w=u&&u.headers?u.headers:{};return l.headers={...p,...w,...n.headers},{url:d(c),options:l}},revokeSession:async(t,s,n={})=>{i("revokeSession","revokeSessionRequest",t);const a=new URL("/v1/sessions/revoke",o);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 P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},signatureSession:async(t,s,n={})=>{i("signatureSession","id",t),i("signatureSession","signatureRequest",s);const a="/v1/sessions/{id}/signature".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}}}}(t);return{async createSession(a,o,i){const r=await n.createSession(a,o,i);return l(r,e,s,t)},async getPlayerSessions(a,o,i,r,c,h){const u=await n.getPlayerSessions(a,o,i,r,c,h);return l(u,e,s,t)},async getSession(a,o,i){const r=await n.getSession(a,o,i);return l(r,e,s,t)},async revokeSession(a,o,i){const r=await n.revokeSession(a,o,i);return l(r,e,s,t)},async signatureSession(a,o,i){const r=await n.signatureSession(a,o,i);return l(r,e,s,t)}}};class S extends n{createSession(e,t){return T(this.configuration).createSession(e.createSessionRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}getPlayerSessions(e,t){return T(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 T(this.configuration).getSession(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}revokeSession(e,t){return T(this.configuration).revokeSession(e.revokeSessionRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}signatureSession(e,t){return T(this.configuration).signatureSession(e.id,e.signatureRequest,t).then(e=>e(this.axios,this.basePath))}}const k=function(t){const n=function(e){return{createTransactionIntent:async(t,s,n={})=>{i("createTransactionIntent","createTransactionIntentRequest",t);const a=new URL("/v1/transaction_intents",o);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 P=c&&c.headers?c.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},estimateTransactionIntentCost:async(t,s={})=>{i("estimateTransactionIntentCost","createTransactionIntentRequest",t);const n=new URL("/v1/transaction_intents/estimate_gas_cost",o);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={})=>{i("getTransactionIntent","id",t);const a="/v1/transaction_intents/{id}".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},P={};await r(p,e),s&&(P.expand=s),h(c,P);let w=u&&u.headers?u.headers:{};return l.headers={...p,...w,...n.headers},{url:d(c),options:l}},getTransactionIntents:async(t,s,n,a,i,c,u,l,p,P={})=>{const w=new URL("/v1/transaction_intents",o);let y;e&&(y=e.baseOptions);const g={method:"GET",...y,...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),a&&(R.expand=a),void 0!==i&&(R.chainId=i),c&&(R.account=c),u&&(R.player=u),void 0!==l&&(R.status=l),p&&(R.policy=p),h(w,R);let f=y&&y.headers?y.headers:{};return g.headers={...m,...f,...P.headers},{url:d(w),options:g}},signature:async(t,s,n={})=>{i("signature","id",t),i("signature","signatureRequest",s);const a="/v1/transaction_intents/{id}/signature".replace("{id}",encodeURIComponent(String(t))),c=new URL(a,o);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),await r(P,e),P["Content-Type"]="application/json",h(c,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(c),options:p}}}}(t);return{async createTransactionIntent(a,o,i){const r=await n.createTransactionIntent(a,o,i);return l(r,e,s,t)},async estimateTransactionIntentCost(a,o){const i=await n.estimateTransactionIntentCost(a,o);return l(i,e,s,t)},async getTransactionIntent(a,o,i){const r=await n.getTransactionIntent(a,o,i);return l(r,e,s,t)},async getTransactionIntents(a,o,i,r,c,h,u,d,p,P){const w=await n.getTransactionIntents(a,o,i,r,c,h,u,d,p,P);return l(w,e,s,t)},async signature(a,o,i){const r=await n.signature(a,o,i);return l(r,e,s,t)}}};class v extends n{createTransactionIntent(e,t){return k(this.configuration).createTransactionIntent(e.createTransactionIntentRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}estimateTransactionIntentCost(e,t){return k(this.configuration).estimateTransactionIntentCost(e.createTransactionIntentRequest,t).then(e=>e(this.axios,this.basePath))}getTransactionIntent(e,t){return k(this.configuration).getTransactionIntent(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}getTransactionIntents(e={},t){return k(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 k(this.configuration).signature(e.id,e.signatureRequest,t).then(e=>e(this.axios,this.basePath))}}const q=function(t){const n=function(e){return{deleteUser:async(t,s={})=>{i("deleteUser","id",t);const n="/v2/users/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);let c;e&&(c=e.baseOptions);const u={method:"DELETE",...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}},getAuthUser:async(t,s={})=>{i("getAuthUser","id",t);const n="/v2/users/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);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}},getAuthUsers:async(t,s,n,a,i,c,u,l,p,P={})=>{const w=new URL("/v2/users",o);let y;e&&(y=e.baseOptions);const g={method:"GET",...y,...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.name=a),void 0!==i&&(R.externalUserId=i),void 0!==c&&(R.email=c),void 0!==u&&(R.phoneNumber=u),void 0!==l&&(R.authProviderId=l),void 0!==p&&(R.walletClientType=p),h(w,R);let f=y&&y.headers?y.headers:{};return g.headers={...m,...f,...P.headers},{url:d(w),options:g}},getUserWallet:async(t,s={})=>{i("getUserWallet","id",t);const n="/v2/users/{id}/wallet".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,o);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}},meV2:async(t={})=>{const s=new URL("/iam/v2/me",o);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t};h(s,{});let i=n&&n.headers?n.headers:{};return a.headers={...i,...t.headers},{url:d(s),options:a}},pregenerateUserV2:async(t,s={})=>{i("pregenerateUserV2","pregenerateUserRequestV2",t);const n=new URL("/v2/users/pregenerate",o);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}},thirdPartyV2:async(t,s={})=>{i("thirdPartyV2","thirdPartyOAuthRequest",t);const n=new URL("/iam/v2/user/third_party",o);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 deleteUser(a,o){const i=await n.deleteUser(a,o);return l(i,e,s,t)},async getAuthUser(a,o){const i=await n.getAuthUser(a,o);return l(i,e,s,t)},async getAuthUsers(a,o,i,r,c,h,u,d,p,P){const w=await n.getAuthUsers(a,o,i,r,c,h,u,d,p,P);return l(w,e,s,t)},async getUserWallet(a,o){const i=await n.getUserWallet(a,o);return l(i,e,s,t)},async meV2(a){const o=await n.meV2(a);return l(o,e,s,t)},async pregenerateUserV2(a,o){const i=await n.pregenerateUserV2(a,o);return l(i,e,s,t)},async thirdPartyV2(a,o){const i=await n.thirdPartyV2(a,o);return l(i,e,s,t)}}};class I extends n{deleteUser(e,t){return q(this.configuration).deleteUser(e.id,t).then(e=>e(this.axios,this.basePath))}getAuthUser(e,t){return q(this.configuration).getAuthUser(e.id,t).then(e=>e(this.axios,this.basePath))}getAuthUsers(e={},t){return q(this.configuration).getAuthUsers(e.limit,e.skip,e.order,e.name,e.externalUserId,e.email,e.phoneNumber,e.authProviderId,e.walletClientType,t).then(e=>e(this.axios,this.basePath))}getUserWallet(e,t){return q(this.configuration).getUserWallet(e.id,t).then(e=>e(this.axios,this.basePath))}meV2(e){return q(this.configuration).meV2(e).then(e=>e(this.axios,this.basePath))}pregenerateUserV2(e,t){return q(this.configuration).pregenerateUserV2(e.pregenerateUserRequestV2,t).then(e=>e(this.axios,this.basePath))}thirdPartyV2(e,t){return q(this.configuration).thirdPartyV2(e.thirdPartyOAuthRequest,t).then(e=>e(this.axios,this.basePath))}}class U{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 A=({basePath:e,accessToken:t,nativeAppIdentifier:s})=>{if(!e.trim())throw Error("basePath can not be empty");const n={basePath:e,accessToken:t,baseOptions:{headers:{...s&&{"x-native-app-identifier":s},Cookie:null},withCredentials:!1}};return new U(n)};exports.BackendApiClients=class{config;transactionIntentsApi;accountsApi;accountsV2Api;rpcApi;sessionsApi;authApi;userApi;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:A(n)};const a={basePath:`${s.basePath}/iam/v2/auth`,accessToken:s.accessToken,nativeAppIdentifier:s.nativeAppIdentifier},o=A(a);this.authenticationApi=new m(this.config.backend,void 0,this.axiosInstance),this.authApi=new f(o,void 0,this.axiosInstance),this.userApi=new I(this.config.backend,void 0,this.axiosInstance),this.transactionIntentsApi=new v(this.config.backend,void 0,this.axiosInstance),this.accountsApi=new P(this.config.backend,void 0,this.axiosInstance),this.accountsV2Api=new y(this.config.backend,void 0,this.axiosInstance),this.sessionsApi=new S(this.config.backend,void 0,this.axiosInstance),this.rpcApi=new b(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){}}},exports.createConfig=A;
1
+ "use strict";var e=require("axios"),t=require("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 h(e,t,s=""){null!=t&&("object"==typeof t?Array.isArray(t)?t.forEach(t=>h(e,t,s)):Object.keys(t).forEach(n=>h(e,t[n],`${s}${""!==s?".":""}${n}`)):e.has(s)?e.append(s,t):e.set(s,t))}const c=function(e,...t){const s=new URLSearchParams(e.search);h(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{createAccount:async(t,s={})=>{o("createAccount","createAccountRequest",t);const n=new URL("/v1/accounts",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),await r(l,e),await r(l,e),await r(l,e),await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},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 h;e&&(h=e.baseOptions);const u={method:"POST",...h,...s},l={};await r(l,e),await r(l,e),await r(l,e),await r(l,e),await r(l,e),c(a,{});let p=h&&h.headers?h.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))),h=new URL(a,i);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},P={};await r(p,e),await r(p,e),s&&(P.expand=s),c(h,P);let w=u&&u.headers?u.headers:{};return l.headers={...p,...w,...n.headers},{url:d(h),options:l}},getAccounts:async(t,s,n,a,o,h,u,l={})=>{const p=new URL("/v1/accounts",i);let P;e&&(P=e.baseOptions);const w={method:"GET",...P,...l},g={},m={};await r(g,e),await r(g,e),await r(g,e),await r(g,e),await r(g,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!==h&&(m.address=h),u&&(m.expand=u),c(p,m);let y=P&&P.headers?P.headers:{};return w.headers={...g,...y,...l.headers},{url:d(p),options:w}}}}(t);return{async createAccount(a,i){const o=await n.createAccount(a,i);return l(o,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 getAccounts(a,i,o,r,h,c,u,d){const p=await n.getAccounts(a,i,o,r,h,c,u,d);return l(p,e,s,t)}}};class P extends n{createAccount(e,t){return p(this.configuration).createAccount(e.createAccountRequest,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))}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))}}const w=function(t){const n=function(e){return{createAccountV2:async(t,s={})=>{o("createAccountV2","createAccountRequestV2",t);const n=new URL("/v2/accounts",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},exportAccountShare:async(t,s={})=>{o("exportAccountShare","accountUuid",t);const n="/v2/accounts/{accountUuid}/export-share".replace("{accountUuid}",encodeURIComponent(String(t))),a=new URL(n,i);let h;e&&(h=e.baseOptions);const u={method:"POST",...h,...s},l={};await r(l,e),c(a,{});let p=h&&h.headers?h.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},getAccountV2:async(t,s={})=>{o("getAccountV2","id",t);const n="/v2/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,i);let h;e&&(h=e.baseOptions);const u={method:"GET",...h,...s},l={};await r(l,e),await r(l,e),await r(l,e),await r(l,e),await r(l,e),c(a,{});let p=h&&h.headers?h.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},getAccountsV2:async(t,s,n,a,o,h,u,l,p,P={})=>{const w=new URL("/v2/accounts",i);let g;e&&(g=e.baseOptions);const m={method:"GET",...g,...P},y={},R={};await r(y,e),await r(y,e),await r(y,e),await r(y,e),await r(y,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!==h&&(R.chainType=h),void 0!==u&&(R.accountType=u),void 0!==l&&(R.custody=l),void 0!==p&&(R.address=p),c(w,R);let f=g&&g.headers?g.headers:{};return m.headers={...y,...f,...P.headers},{url:d(w),options:m}},getSignerIdByAddress:async(t,s={})=>{o("getSignerIdByAddress","address",t);const n=new URL("/v2/accounts/signer",i);let a;e&&(a=e.baseOptions);const h={method:"GET",...a,...s},u={},l={};await r(u,e),await r(u,e),await r(u,e),await r(u,e),await r(u,e),void 0!==t&&(l.address=t),c(n,l);let p=a&&a.headers?a.headers:{};return h.headers={...u,...p,...s.headers},{url:d(n),options:h}},removeAccount:async(t,s={})=>{o("removeAccount","id",t);const n="/v2/accounts/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,i);let h;e&&(h=e.baseOptions);const u={method:"DELETE",...h,...s},l={};await r(l,e),await r(l,e),c(a,{});let p=h&&h.headers?h.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},switchChainV2:async(t,s={})=>{o("switchChainV2","switchChainQueriesV2",t);const n=new URL("/v2/accounts/switch-chain",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),await r(l,e),await r(l,e),await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}}}}(t);return{async createAccountV2(a,i){const o=await n.createAccountV2(a,i);return l(o,e,s,t)},async exportAccountShare(a,i){const o=await n.exportAccountShare(a,i);return l(o,e,s,t)},async getAccountV2(a,i){const o=await n.getAccountV2(a,i);return l(o,e,s,t)},async getAccountsV2(a,i,o,r,h,c,u,d,p,P){const w=await n.getAccountsV2(a,i,o,r,h,c,u,d,p,P);return l(w,e,s,t)},async getSignerIdByAddress(a,i){const o=await n.getSignerIdByAddress(a,i);return l(o,e,s,t)},async removeAccount(a,i){const o=await n.removeAccount(a,i);return l(o,e,s,t)},async switchChainV2(a,i){const o=await n.switchChainV2(a,i);return l(o,e,s,t)}}};class g extends n{createAccountV2(e,t){return w(this.configuration).createAccountV2(e.createAccountRequestV2,t).then(e=>e(this.axios,this.basePath))}exportAccountShare(e,t){return w(this.configuration).exportAccountShare(e.accountUuid,t).then(e=>e(this.axios,this.basePath))}getAccountV2(e,t){return w(this.configuration).getAccountV2(e.id,t).then(e=>e(this.axios,this.basePath))}getAccountsV2(e={},t){return w(this.configuration).getAccountsV2(e.limit,e.skip,e.order,e.chainId,e.user,e.chainType,e.accountType,e.custody,e.address,t).then(e=>e(this.axios,this.basePath))}getSignerIdByAddress(e,t){return w(this.configuration).getSignerIdByAddress(e.address,t).then(e=>e(this.axios,this.basePath))}removeAccount(e,t){return w(this.configuration).removeAccount(e.id,t).then(e=>e(this.axios,this.basePath))}switchChainV2(e,t){return w(this.configuration).switchChainV2(e.switchChainQueriesV2,t).then(e=>e(this.axios,this.basePath))}}const m=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 h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},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 h={method:"GET",...r,...s};c(a,{});let u=r&&r.headers?r.headers:{};return h.headers={...u,...s.headers},{url:d(a),options:h}},initOAuth:async(t,s,n={})=>{o("initOAuth","oAuthInitRequest",t);const a=new URL("/iam/v1/oauth/init",i);let h;e&&(h=e.baseOptions);const l={method:"POST",...h,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",c(a,{});let P=h&&h.headers?h.headers:{};return l.headers={...p,...P,...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 h;e&&(h=e.baseOptions);const l={method:"POST",...h,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",c(a,{});let P=h&&h.headers?h.headers:{};return l.headers={...p,...P,...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 h;e&&(h=e.baseOptions);const l={method:"POST",...h,...n},p={};await r(p,e),await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",c(a,{});let P=h&&h.headers?h.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},linkOAuth:async(t,s,n={})=>{o("linkOAuth","oAuthInitRequest",t);const a=new URL("/iam/v1/oauth/init_link",i);let h;e&&(h=e.baseOptions);const l={method:"POST",...h,...n},p={};await r(p,e),await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",c(a,{});let P=h&&h.headers?h.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},linkSIWE:async(t,s={})=>{o("linkSIWE","sIWEAuthenticateRequest",t);const n=new URL("/iam/v1/siwe/link",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},linkThirdParty:async(t,s,n={})=>{o("linkThirdParty","thirdPartyLinkRequest",t);const a=new URL("/iam/v1/oauth/link",i);let h;e&&(h=e.baseOptions);const l={method:"POST",...h,...n},p={};await r(p,e),await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",c(a,{});let P=h&&h.headers?h.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},loginEmailPassword:async(t,s,n={})=>{o("loginEmailPassword","loginRequest",t);const a=new URL("/iam/v1/password/login",i);let h;e&&(h=e.baseOptions);const l={method:"POST",...h,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",c(a,{});let P=h&&h.headers?h.headers:{};return l.headers={...p,...P,...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 h={method:"POST",...a,...s},l={};await r(l,e),await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},logout:async(t,s={})=>{o("logout","logoutRequest",t);const n=new URL("/iam/v1/sessions/logout",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},me:async(t={})=>{const s=new URL("/iam/v1/me",i);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t},o={};await r(o,e),await r(o,e),c(s,{});let h=n&&n.headers?n.headers:{};return a.headers={...o,...h,...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 h={method:"POST",...a,...s},u={},l={};await r(u,e),void 0!==t&&(l.key=t),c(n,l);let p=a&&a.headers?a.headers:{};return h.headers={...u,...p,...s.headers},{url:d(n),options:h}},refresh:async(t,s={})=>{o("refresh","refreshTokenRequest",t);const n=new URL("/iam/v1/sessions",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},registerGuest:async(t,s={})=>{const n=new URL("/iam/v1/guest",i);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...s},h={};await r(h,e),null!=t&&(h["x-game"]=String(t)),c(n,{});let u=a&&a.headers?a.headers:{};return o.headers={...h,...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 h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},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 h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},resetPassword:async(t,s={})=>{o("resetPassword","resetPasswordRequest",t);const n=new URL("/iam/v1/password/reset",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},signupEmailPassword:async(t,s,n={})=>{o("signupEmailPassword","signupRequest",t);const a=new URL("/iam/v1/password/signup",i);let h;e&&(h=e.baseOptions);const l={method:"POST",...h,...n},p={};await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",c(a,{});let P=h&&h.headers?h.headers:{};return l.headers={...p,...P,...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 h;e&&(h=e.baseOptions);const l={method:"POST",...h,...n},p={};await r(p,e),await r(p,e),null!=s&&(p["x-game"]=String(s)),p["Content-Type"]="application/json",c(a,{});let P=h&&h.headers?h.headers:{};return l.headers={...p,...P,...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 h={method:"POST",...a,...s},l={};await r(l,e),await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},unlinkOAuth:async(t,s={})=>{o("unlinkOAuth","unlinkOAuthRequest",t);const n=new URL("/iam/v1/oauth/unlink",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},unlinkSIWE:async(t,s={})=>{o("unlinkSIWE","sIWERequest",t);const n=new URL("/iam/v1/siwe/unlink",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},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 h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},verifyOAuthToken:async(t,s={})=>{o("verifyOAuthToken","authenticateOAuthRequest",t);const n=new URL("/iam/v1/oauth/verify",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}}}}(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 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 y extends n{authenticateSIWE(e,t){return m(this.configuration).authenticateSIWE(e.sIWEAuthenticateRequest,t).then(e=>e(this.axios,this.basePath))}getJwks(e,t){return m(this.configuration).getJwks(e.publishableKey,t).then(e=>e(this.axios,this.basePath))}initOAuth(e,t){return m(this.configuration).initOAuth(e.oAuthInitRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}initSIWE(e,t){return m(this.configuration).initSIWE(e.sIWERequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkEmail(e,t){return m(this.configuration).linkEmail(e.loginRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkOAuth(e,t){return m(this.configuration).linkOAuth(e.oAuthInitRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}linkSIWE(e,t){return m(this.configuration).linkSIWE(e.sIWEAuthenticateRequest,t).then(e=>e(this.axios,this.basePath))}linkThirdParty(e,t){return m(this.configuration).linkThirdParty(e.thirdPartyLinkRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginEmailPassword(e,t){return m(this.configuration).loginEmailPassword(e.loginRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}loginWithIdToken(e,t){return m(this.configuration).loginWithIdToken(e.loginWithIdTokenRequest,t).then(e=>e(this.axios,this.basePath))}logout(e,t){return m(this.configuration).logout(e.logoutRequest,t).then(e=>e(this.axios,this.basePath))}me(e){return m(this.configuration).me(e).then(e=>e(this.axios,this.basePath))}poolOAuth(e,t){return m(this.configuration).poolOAuth(e.key,t).then(e=>e(this.axios,this.basePath))}refresh(e,t){return m(this.configuration).refresh(e.refreshTokenRequest,t).then(e=>e(this.axios,this.basePath))}registerGuest(e={},t){return m(this.configuration).registerGuest(e.xGame,t).then(e=>e(this.axios,this.basePath))}requestEmailVerification(e,t){return m(this.configuration).requestEmailVerification(e.requestVerifyEmailRequest,t).then(e=>e(this.axios,this.basePath))}requestResetPassword(e,t){return m(this.configuration).requestResetPassword(e.requestResetPasswordRequest,t).then(e=>e(this.axios,this.basePath))}resetPassword(e,t){return m(this.configuration).resetPassword(e.resetPasswordRequest,t).then(e=>e(this.axios,this.basePath))}signupEmailPassword(e,t){return m(this.configuration).signupEmailPassword(e.signupRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}thirdParty(e,t){return m(this.configuration).thirdParty(e.thirdPartyOAuthRequest,e.xGame,t).then(e=>e(this.axios,this.basePath))}unlinkEmail(e,t){return m(this.configuration).unlinkEmail(e.unlinkEmailRequest,t).then(e=>e(this.axios,this.basePath))}unlinkOAuth(e,t){return m(this.configuration).unlinkOAuth(e.unlinkOAuthRequest,t).then(e=>e(this.axios,this.basePath))}unlinkSIWE(e,t){return m(this.configuration).unlinkSIWE(e.sIWERequest,t).then(e=>e(this.axios,this.basePath))}verifyEmail(e,t){return m(this.configuration).verifyEmail(e.verifyEmailRequest,t).then(e=>e(this.axios,this.basePath))}verifyOAuthToken(e,t){return m(this.configuration).verifyOAuthToken(e.authenticateOAuthRequest,t).then(e=>e(this.axios,this.basePath))}}const R=function(t){const n=function(e){return{accountInfoPost:async(t,s={})=>{o("accountInfoPost","accountInfoPostRequest",t);const n=new URL("/account-info",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},changeEmailPost:async(t,s={})=>{o("changeEmailPost","changeEmailPostRequest",t);const n=new URL("/change-email",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},changePasswordPost:async(t,s={})=>{o("changePasswordPost","changePasswordPostRequest",t);const n=new URL("/change-password",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},checkVerificationOtp:async(t,s={})=>{o("checkVerificationOtp","checkVerificationOtpRequest",t);const n=new URL("/email-otp/check-verification-otp",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},emailOtpResetPasswordPost:async(t,s={})=>{o("emailOtpResetPasswordPost","emailOtpResetPasswordPostRequest",t);const n=new URL("/email-otp/reset-password",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},emailOtpSendVerificationOtpPost:async(t,s={})=>{o("emailOtpSendVerificationOtpPost","emailOtpSendVerificationOtpPostRequest",t);const n=new URL("/email-otp/send-verification-otp",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},emailOtpVerifyEmailPost:async(t,s={})=>{o("emailOtpVerifyEmailPost","emailOtpVerifyEmailPostRequest",t);const n=new URL("/email-otp/verify-email",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},forgetPasswordEmailOtpPost:async(t,s={})=>{o("forgetPasswordEmailOtpPost","forgetPasswordEmailOtpPostRequest",t);const n=new URL("/forget-password/email-otp",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},forgetPasswordPost:async(t,s={})=>{o("forgetPasswordPost","forgetPasswordPostRequest",t);const n=new URL("/forget-password",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},getAccessTokenPost:async(t,s={})=>{o("getAccessTokenPost","refreshTokenPostRequest",t);const n=new URL("/get-access-token",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},getSessionGet:async(t,s={})=>{const n=new URL("/get-session",i);let a;e&&(a=e.baseOptions);const o={method:"GET",...a,...s},h={},u={};await r(h,e),void 0!==t&&(u.disableCookieCache=t),c(n,u);let l=a&&a.headers?a.headers:{};return o.headers={...h,...l,...s.headers},{url:d(n),options:o}},linkSiweListWalletsGet:async(t={})=>{const s=new URL("/link-siwe/list-wallets",i);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t},o={};await r(o,e),c(s,{});let h=n&&n.headers?n.headers:{};return a.headers={...o,...h,...t.headers},{url:d(s),options:a}},linkSiweNoncePost:async(t,s={})=>{o("linkSiweNoncePost","siweNoncePostRequest",t);const n=new URL("/link-siwe/nonce",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},linkSiweUnlinkPost:async(t,s={})=>{o("linkSiweUnlinkPost","linkSiweUnlinkPostRequest",t);const n=new URL("/link-siwe/unlink",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},linkSiweVerifyPost:async(t,s={})=>{o("linkSiweVerifyPost","siweVerifyPostRequest",t);const n=new URL("/link-siwe/verify",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},linkSocialPost:async(t,s={})=>{o("linkSocialPost","linkSocialPostRequest",t);const n=new URL("/link-social",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},listAccountsGet:async(t={})=>{const s=new URL("/list-accounts",i);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t},o={};await r(o,e),c(s,{});let h=n&&n.headers?n.headers:{};return a.headers={...o,...h,...t.headers},{url:d(s),options:a}},listSessionsGet:async(t={})=>{const s=new URL("/list-sessions",i);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t},o={};await r(o,e),c(s,{});let h=n&&n.headers?n.headers:{};return a.headers={...o,...h,...t.headers},{url:d(s),options:a}},phoneNumberForgetPasswordPost:async(t,s={})=>{o("phoneNumberForgetPasswordPost","phoneNumberForgetPasswordPostRequest",t);const n=new URL("/phone-number/forget-password",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},phoneNumberRequestPasswordResetPost:async(t,s={})=>{o("phoneNumberRequestPasswordResetPost","phoneNumberRequestPasswordResetPostRequest",t);const n=new URL("/phone-number/request-password-reset",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},phoneNumberResetPasswordPost:async(t,s={})=>{o("phoneNumberResetPasswordPost","phoneNumberResetPasswordPostRequest",t);const n=new URL("/phone-number/reset-password",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},phoneNumberSendOtpPost:async(t,s={})=>{o("phoneNumberSendOtpPost","phoneNumberSendOtpPostRequest",t);const n=new URL("/phone-number/send-otp",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},phoneNumberVerifyPost:async(t,s={})=>{o("phoneNumberVerifyPost","phoneNumberVerifyPostRequest",t);const n=new URL("/phone-number/verify",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},refreshTokenPost:async(t,s={})=>{o("refreshTokenPost","refreshTokenPostRequest",t);const n=new URL("/refresh-token",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},requestPasswordResetPost:async(t,s={})=>{o("requestPasswordResetPost","forgetPasswordPostRequest",t);const n=new URL("/request-password-reset",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},resetPasswordPost:async(t,s={})=>{o("resetPasswordPost","resetPasswordPostRequest",t);const n=new URL("/reset-password",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},resetPasswordTokenGet:async(t,s,n={})=>{o("resetPasswordTokenGet","token",t);const a="/reset-password/{token}".replace("{token}",encodeURIComponent(String(t))),h=new URL(a,i);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},P={};await r(p,e),void 0!==s&&(P.callbackURL=s),c(h,P);let w=u&&u.headers?u.headers:{};return l.headers={...p,...w,...n.headers},{url:d(h),options:l}},revokeOtherSessionsPost:async(t,s={})=>{const n=new URL("/revoke-other-sessions",i);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...s},h={};await r(h,e),h["Content-Type"]="application/json",c(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...h,...l,...s.headers},o.data=u(t,o,e),{url:d(n),options:o}},revokeSessionPost:async(t,s={})=>{const n=new URL("/revoke-session",i);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...s},h={};await r(h,e),h["Content-Type"]="application/json",c(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...h,...l,...s.headers},o.data=u(t,o,e),{url:d(n),options:o}},revokeSessionsPost:async(t,s={})=>{const n=new URL("/revoke-sessions",i);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...s},h={};await r(h,e),h["Content-Type"]="application/json",c(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...h,...l,...s.headers},o.data=u(t,o,e),{url:d(n),options:o}},sendVerificationEmailPost:async(t,s={})=>{const n=new URL("/send-verification-email",i);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...s},h={};await r(h,e),h["Content-Type"]="application/json",c(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...h,...l,...s.headers},o.data=u(t,o,e),{url:d(n),options:o}},signInAnonymousPost:async(t={})=>{const s=new URL("/sign-in/anonymous",i);let n;e&&(n=e.baseOptions);const a={method:"POST",...n,...t},o={};await r(o,e),c(s,{});let h=n&&n.headers?n.headers:{};return a.headers={...o,...h,...t.headers},{url:d(s),options:a}},signInEmailOtpPost:async(t,s={})=>{o("signInEmailOtpPost","signInEmailOtpPostRequest",t);const n=new URL("/sign-in/email-otp",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},signInEmailPost:async(t,s={})=>{o("signInEmailPost","signInEmailPostRequest",t);const n=new URL("/sign-in/email",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},signInPhoneNumberPost:async(t,s={})=>{o("signInPhoneNumberPost","signInPhoneNumberPostRequest",t);const n=new URL("/sign-in/phone-number",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},signOutPost:async(t,s={})=>{const n=new URL("/sign-out",i);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...s},h={};await r(h,e),h["Content-Type"]="application/json",c(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...h,...l,...s.headers},o.data=u(t,o,e),{url:d(n),options:o}},signUpEmailPost:async(t,s={})=>{const n=new URL("/sign-up/email",i);let a;e&&(a=e.baseOptions);const o={method:"POST",...a,...s},h={};await r(h,e),h["Content-Type"]="application/json",c(n,{});let l=a&&a.headers?a.headers:{};return o.headers={...h,...l,...s.headers},o.data=u(t,o,e),{url:d(n),options:o}},siweNoncePost:async(t,s={})=>{o("siweNoncePost","siweNoncePostRequest",t);const n=new URL("/siwe/nonce",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},siweVerifyPost:async(t,s={})=>{o("siweVerifyPost","siweVerifyPostRequest",t);const n=new URL("/siwe/verify",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},socialSignIn:async(t,s={})=>{o("socialSignIn","socialSignInRequest",t);const n=new URL("/sign-in/social",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},unlinkAccountPost:async(t,s={})=>{o("unlinkAccountPost","unlinkAccountPostRequest",t);const n=new URL("/unlink-account",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},verifyEmailGet:async(t,s,n={})=>{o("verifyEmailGet","token",t);const a=new URL("/verify-email",i);let h;e&&(h=e.baseOptions);const u={method:"GET",...h,...n},l={},p={};await r(l,e),void 0!==t&&(p.token=t),void 0!==s&&(p.callbackURL=s),c(a,p);let P=h&&h.headers?h.headers:{};return u.headers={...l,...P,...n.headers},{url:d(a),options:u}}}}(t);return{async accountInfoPost(a,i){const o=await n.accountInfoPost(a,i);return l(o,e,s,t)},async changeEmailPost(a,i){const o=await n.changeEmailPost(a,i);return l(o,e,s,t)},async changePasswordPost(a,i){const o=await n.changePasswordPost(a,i);return l(o,e,s,t)},async checkVerificationOtp(a,i){const o=await n.checkVerificationOtp(a,i);return l(o,e,s,t)},async emailOtpResetPasswordPost(a,i){const o=await n.emailOtpResetPasswordPost(a,i);return l(o,e,s,t)},async emailOtpSendVerificationOtpPost(a,i){const o=await n.emailOtpSendVerificationOtpPost(a,i);return l(o,e,s,t)},async emailOtpVerifyEmailPost(a,i){const o=await n.emailOtpVerifyEmailPost(a,i);return l(o,e,s,t)},async forgetPasswordEmailOtpPost(a,i){const o=await n.forgetPasswordEmailOtpPost(a,i);return l(o,e,s,t)},async forgetPasswordPost(a,i){const o=await n.forgetPasswordPost(a,i);return l(o,e,s,t)},async getAccessTokenPost(a,i){const o=await n.getAccessTokenPost(a,i);return l(o,e,s,t)},async getSessionGet(a,i){const o=await n.getSessionGet(a,i);return l(o,e,s,t)},async linkSiweListWalletsGet(a){const i=await n.linkSiweListWalletsGet(a);return l(i,e,s,t)},async linkSiweNoncePost(a,i){const o=await n.linkSiweNoncePost(a,i);return l(o,e,s,t)},async linkSiweUnlinkPost(a,i){const o=await n.linkSiweUnlinkPost(a,i);return l(o,e,s,t)},async linkSiweVerifyPost(a,i){const o=await n.linkSiweVerifyPost(a,i);return l(o,e,s,t)},async linkSocialPost(a,i){const o=await n.linkSocialPost(a,i);return l(o,e,s,t)},async listAccountsGet(a){const i=await n.listAccountsGet(a);return l(i,e,s,t)},async listSessionsGet(a){const i=await n.listSessionsGet(a);return l(i,e,s,t)},async phoneNumberForgetPasswordPost(a,i){const o=await n.phoneNumberForgetPasswordPost(a,i);return l(o,e,s,t)},async phoneNumberRequestPasswordResetPost(a,i){const o=await n.phoneNumberRequestPasswordResetPost(a,i);return l(o,e,s,t)},async phoneNumberResetPasswordPost(a,i){const o=await n.phoneNumberResetPasswordPost(a,i);return l(o,e,s,t)},async phoneNumberSendOtpPost(a,i){const o=await n.phoneNumberSendOtpPost(a,i);return l(o,e,s,t)},async phoneNumberVerifyPost(a,i){const o=await n.phoneNumberVerifyPost(a,i);return l(o,e,s,t)},async refreshTokenPost(a,i){const o=await n.refreshTokenPost(a,i);return l(o,e,s,t)},async requestPasswordResetPost(a,i){const o=await n.requestPasswordResetPost(a,i);return l(o,e,s,t)},async resetPasswordPost(a,i){const o=await n.resetPasswordPost(a,i);return l(o,e,s,t)},async resetPasswordTokenGet(a,i,o){const r=await n.resetPasswordTokenGet(a,i,o);return l(r,e,s,t)},async revokeOtherSessionsPost(a,i){const o=await n.revokeOtherSessionsPost(a,i);return l(o,e,s,t)},async revokeSessionPost(a,i){const o=await n.revokeSessionPost(a,i);return l(o,e,s,t)},async revokeSessionsPost(a,i){const o=await n.revokeSessionsPost(a,i);return l(o,e,s,t)},async sendVerificationEmailPost(a,i){const o=await n.sendVerificationEmailPost(a,i);return l(o,e,s,t)},async signInAnonymousPost(a){const i=await n.signInAnonymousPost(a);return l(i,e,s,t)},async signInEmailOtpPost(a,i){const o=await n.signInEmailOtpPost(a,i);return l(o,e,s,t)},async signInEmailPost(a,i){const o=await n.signInEmailPost(a,i);return l(o,e,s,t)},async signInPhoneNumberPost(a,i){const o=await n.signInPhoneNumberPost(a,i);return l(o,e,s,t)},async signOutPost(a,i){const o=await n.signOutPost(a,i);return l(o,e,s,t)},async signUpEmailPost(a,i){const o=await n.signUpEmailPost(a,i);return l(o,e,s,t)},async siweNoncePost(a,i){const o=await n.siweNoncePost(a,i);return l(o,e,s,t)},async siweVerifyPost(a,i){const o=await n.siweVerifyPost(a,i);return l(o,e,s,t)},async socialSignIn(a,i){const o=await n.socialSignIn(a,i);return l(o,e,s,t)},async unlinkAccountPost(a,i){const o=await n.unlinkAccountPost(a,i);return l(o,e,s,t)},async verifyEmailGet(a,i,o){const r=await n.verifyEmailGet(a,i,o);return l(r,e,s,t)}}};class f extends n{accountInfoPost(e,t){return R(this.configuration).accountInfoPost(e.accountInfoPostRequest,t).then(e=>e(this.axios,this.basePath))}changeEmailPost(e,t){return R(this.configuration).changeEmailPost(e.changeEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}changePasswordPost(e,t){return R(this.configuration).changePasswordPost(e.changePasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}checkVerificationOtp(e,t){return R(this.configuration).checkVerificationOtp(e.checkVerificationOtpRequest,t).then(e=>e(this.axios,this.basePath))}emailOtpResetPasswordPost(e,t){return R(this.configuration).emailOtpResetPasswordPost(e.emailOtpResetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}emailOtpSendVerificationOtpPost(e,t){return R(this.configuration).emailOtpSendVerificationOtpPost(e.emailOtpSendVerificationOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}emailOtpVerifyEmailPost(e,t){return R(this.configuration).emailOtpVerifyEmailPost(e.emailOtpVerifyEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}forgetPasswordEmailOtpPost(e,t){return R(this.configuration).forgetPasswordEmailOtpPost(e.forgetPasswordEmailOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}forgetPasswordPost(e,t){return R(this.configuration).forgetPasswordPost(e.forgetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}getAccessTokenPost(e,t){return R(this.configuration).getAccessTokenPost(e.refreshTokenPostRequest,t).then(e=>e(this.axios,this.basePath))}getSessionGet(e={},t){return R(this.configuration).getSessionGet(e.disableCookieCache,t).then(e=>e(this.axios,this.basePath))}linkSiweListWalletsGet(e){return R(this.configuration).linkSiweListWalletsGet(e).then(e=>e(this.axios,this.basePath))}linkSiweNoncePost(e,t){return R(this.configuration).linkSiweNoncePost(e.siweNoncePostRequest,t).then(e=>e(this.axios,this.basePath))}linkSiweUnlinkPost(e,t){return R(this.configuration).linkSiweUnlinkPost(e.linkSiweUnlinkPostRequest,t).then(e=>e(this.axios,this.basePath))}linkSiweVerifyPost(e,t){return R(this.configuration).linkSiweVerifyPost(e.siweVerifyPostRequest,t).then(e=>e(this.axios,this.basePath))}linkSocialPost(e,t){return R(this.configuration).linkSocialPost(e.linkSocialPostRequest,t).then(e=>e(this.axios,this.basePath))}listAccountsGet(e){return R(this.configuration).listAccountsGet(e).then(e=>e(this.axios,this.basePath))}listSessionsGet(e){return R(this.configuration).listSessionsGet(e).then(e=>e(this.axios,this.basePath))}phoneNumberForgetPasswordPost(e,t){return R(this.configuration).phoneNumberForgetPasswordPost(e.phoneNumberForgetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberRequestPasswordResetPost(e,t){return R(this.configuration).phoneNumberRequestPasswordResetPost(e.phoneNumberRequestPasswordResetPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberResetPasswordPost(e,t){return R(this.configuration).phoneNumberResetPasswordPost(e.phoneNumberResetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberSendOtpPost(e,t){return R(this.configuration).phoneNumberSendOtpPost(e.phoneNumberSendOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}phoneNumberVerifyPost(e,t){return R(this.configuration).phoneNumberVerifyPost(e.phoneNumberVerifyPostRequest,t).then(e=>e(this.axios,this.basePath))}refreshTokenPost(e,t){return R(this.configuration).refreshTokenPost(e.refreshTokenPostRequest,t).then(e=>e(this.axios,this.basePath))}requestPasswordResetPost(e,t){return R(this.configuration).requestPasswordResetPost(e.forgetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}resetPasswordPost(e,t){return R(this.configuration).resetPasswordPost(e.resetPasswordPostRequest,t).then(e=>e(this.axios,this.basePath))}resetPasswordTokenGet(e,t){return R(this.configuration).resetPasswordTokenGet(e.token,e.callbackURL,t).then(e=>e(this.axios,this.basePath))}revokeOtherSessionsPost(e={},t){return R(this.configuration).revokeOtherSessionsPost(e.body,t).then(e=>e(this.axios,this.basePath))}revokeSessionPost(e={},t){return R(this.configuration).revokeSessionPost(e.revokeSessionPostRequest,t).then(e=>e(this.axios,this.basePath))}revokeSessionsPost(e={},t){return R(this.configuration).revokeSessionsPost(e.body,t).then(e=>e(this.axios,this.basePath))}sendVerificationEmailPost(e={},t){return R(this.configuration).sendVerificationEmailPost(e.sendVerificationEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}signInAnonymousPost(e){return R(this.configuration).signInAnonymousPost(e).then(e=>e(this.axios,this.basePath))}signInEmailOtpPost(e,t){return R(this.configuration).signInEmailOtpPost(e.signInEmailOtpPostRequest,t).then(e=>e(this.axios,this.basePath))}signInEmailPost(e,t){return R(this.configuration).signInEmailPost(e.signInEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}signInPhoneNumberPost(e,t){return R(this.configuration).signInPhoneNumberPost(e.signInPhoneNumberPostRequest,t).then(e=>e(this.axios,this.basePath))}signOutPost(e={},t){return R(this.configuration).signOutPost(e.body,t).then(e=>e(this.axios,this.basePath))}signUpEmailPost(e={},t){return R(this.configuration).signUpEmailPost(e.signUpEmailPostRequest,t).then(e=>e(this.axios,this.basePath))}siweNoncePost(e,t){return R(this.configuration).siweNoncePost(e.siweNoncePostRequest,t).then(e=>e(this.axios,this.basePath))}siweVerifyPost(e,t){return R(this.configuration).siweVerifyPost(e.siweVerifyPostRequest,t).then(e=>e(this.axios,this.basePath))}socialSignIn(e,t){return R(this.configuration).socialSignIn(e.socialSignInRequest,t).then(e=>e(this.axios,this.basePath))}unlinkAccountPost(e,t){return R(this.configuration).unlinkAccountPost(e.unlinkAccountPostRequest,t).then(e=>e(this.axios,this.basePath))}verifyEmailGet(e,t){return R(this.configuration).verifyEmailGet(e.token,e.callbackURL,t).then(e=>e(this.axios,this.basePath))}}const b=function(t){const n=function(e){return{handleChainRpcRequest:async(t,s,n={})=>{o("handleChainRpcRequest","chainId",t),o("handleChainRpcRequest","jsonRpcRequest",s);const a="/rpc/{chainId}".replace("{chainId}",encodeURIComponent(String(t))),h=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),P["Content-Type"]="application/json",c(h,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(h),options:p}},handleRpcRequest:async(t,s={})=>{o("handleRpcRequest","jsonRpcRequest",t);const n=new URL("/rpc",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),await r(l,e),await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}}}}(t);return{async handleChainRpcRequest(a,i,o){const r=await n.handleChainRpcRequest(a,i,o);return l(r,e,s,t)},async handleRpcRequest(a,i){const o=await n.handleRpcRequest(a,i);return l(o,e,s,t)}}};class O extends n{handleChainRpcRequest(e,t){return b(this.configuration).handleChainRpcRequest(e.chainId,e.jsonRpcRequest,t).then(e=>e(this.axios,this.basePath))}handleRpcRequest(e,t){return b(this.configuration).handleRpcRequest(e.jsonRpcRequest,t).then(e=>e(this.axios,this.basePath))}}const S=function(t){const n=function(e){return{createSession:async(t,s,n={})=>{o("createSession","createSessionRequest",t);const a=new URL("/v1/sessions",i);let h;e&&(h=e.baseOptions);const l={method:"POST",...h,...n},p={};await r(p,e),await r(p,e),await r(p,e),await r(p,e),null!=s&&(p["X-Behalf-Of-Project"]=String(s)),p["Content-Type"]="application/json",c(a,{});let P=h&&h.headers?h.headers:{};return l.headers={...p,...P,...n.headers},l.data=u(t,l,e),{url:d(a),options:l}},getPlayerSessions:async(t,s,n,a,h,u={})=>{o("getPlayerSessions","player",t);const l=new URL("/v1/sessions",i);let p;e&&(p=e.baseOptions);const P={method:"GET",...p,...u},w={},g={};await r(w,e),await r(w,e),void 0!==s&&(g.limit=s),void 0!==n&&(g.skip=n),void 0!==a&&(g.order=a),void 0!==t&&(g.player=t),h&&(g.expand=h),c(l,g);let m=p&&p.headers?p.headers:{};return P.headers={...w,...m,...u.headers},{url:d(l),options:P}},getSession:async(t,s,n={})=>{o("getSession","id",t);const a="/v1/sessions/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(a,i);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},P={};await r(p,e),await r(p,e),s&&(P.expand=s),c(h,P);let w=u&&u.headers?u.headers:{};return l.headers={...p,...w,...n.headers},{url:d(h),options:l}},revokeSession:async(t,s,n={})=>{o("revokeSession","revokeSessionRequest",t);const a=new URL("/v1/sessions/revoke",i);let h;e&&(h=e.baseOptions);const l={method:"POST",...h,...n},p={};await r(p,e),await r(p,e),await r(p,e),await r(p,e),null!=s&&(p["X-Behalf-Of-Project"]=String(s)),p["Content-Type"]="application/json",c(a,{});let P=h&&h.headers?h.headers:{};return l.headers={...p,...P,...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))),h=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),await r(P,e),await r(P,e),P["Content-Type"]="application/json",c(h,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(h),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,h,c){const u=await n.getPlayerSessions(a,i,o,r,h,c);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 T extends n{createSession(e,t){return S(this.configuration).createSession(e.createSessionRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}getPlayerSessions(e,t){return S(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 S(this.configuration).getSession(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}revokeSession(e,t){return S(this.configuration).revokeSession(e.revokeSessionRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}signatureSession(e,t){return S(this.configuration).signatureSession(e.id,e.signatureRequest,t).then(e=>e(this.axios,this.basePath))}}const k=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 h;e&&(h=e.baseOptions);const l={method:"POST",...h,...n},p={};await r(p,e),await r(p,e),await r(p,e),await r(p,e),null!=s&&(p["X-Behalf-Of-Project"]=String(s)),p["Content-Type"]="application/json",c(a,{});let P=h&&h.headers?h.headers:{};return l.headers={...p,...P,...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 h={method:"POST",...a,...s},l={};await r(l,e),await r(l,e),await r(l,e),await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},getTransactionIntent:async(t,s,n={})=>{o("getTransactionIntent","id",t);const a="/v1/transaction_intents/{id}".replace("{id}",encodeURIComponent(String(t))),h=new URL(a,i);let u;e&&(u=e.baseOptions);const l={method:"GET",...u,...n},p={},P={};await r(p,e),await r(p,e),await r(p,e),await r(p,e),await r(p,e),s&&(P.expand=s),c(h,P);let w=u&&u.headers?u.headers:{};return l.headers={...p,...w,...n.headers},{url:d(h),options:l}},getTransactionIntents:async(t,s,n,a,o,h,u,l,p,P={})=>{const w=new URL("/v1/transaction_intents",i);let g;e&&(g=e.baseOptions);const m={method:"GET",...g,...P},y={},R={};await r(y,e),await r(y,e),void 0!==t&&(R.limit=t),void 0!==s&&(R.skip=s),void 0!==n&&(R.order=n),a&&(R.expand=a),void 0!==o&&(R.chainId=o),h&&(R.account=h),u&&(R.player=u),void 0!==l&&(R.status=l),p&&(R.policy=p),c(w,R);let f=g&&g.headers?g.headers:{};return m.headers={...y,...f,...P.headers},{url:d(w),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))),h=new URL(a,i);let l;e&&(l=e.baseOptions);const p={method:"POST",...l,...n},P={};await r(P,e),await r(P,e),P["Content-Type"]="application/json",c(h,{});let w=l&&l.headers?l.headers:{};return p.headers={...P,...w,...n.headers},p.data=u(s,p,e),{url:d(h),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,h,c,u,d,p,P){const w=await n.getTransactionIntents(a,i,o,r,h,c,u,d,p,P);return l(w,e,s,t)},async signature(a,i,o){const r=await n.signature(a,i,o);return l(r,e,s,t)}}};class v extends n{createTransactionIntent(e,t){return k(this.configuration).createTransactionIntent(e.createTransactionIntentRequest,e.xBehalfOfProject,t).then(e=>e(this.axios,this.basePath))}estimateTransactionIntentCost(e,t){return k(this.configuration).estimateTransactionIntentCost(e.createTransactionIntentRequest,t).then(e=>e(this.axios,this.basePath))}getTransactionIntent(e,t){return k(this.configuration).getTransactionIntent(e.id,e.expand,t).then(e=>e(this.axios,this.basePath))}getTransactionIntents(e={},t){return k(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 k(this.configuration).signature(e.id,e.signatureRequest,t).then(e=>e(this.axios,this.basePath))}}const q=function(t){const n=function(e){return{deleteUser:async(t,s={})=>{o("deleteUser","id",t);const n="/v2/users/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,i);let h;e&&(h=e.baseOptions);const u={method:"DELETE",...h,...s},l={};await r(l,e),await r(l,e),c(a,{});let p=h&&h.headers?h.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},getAuthUser:async(t,s={})=>{o("getAuthUser","id",t);const n="/v2/users/{id}".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,i);let h;e&&(h=e.baseOptions);const u={method:"GET",...h,...s},l={};await r(l,e),await r(l,e),c(a,{});let p=h&&h.headers?h.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},getAuthUsers:async(t,s,n,a,o,h,u,l,p,P={})=>{const w=new URL("/v2/users",i);let g;e&&(g=e.baseOptions);const m={method:"GET",...g,...P},y={},R={};await r(y,e),await r(y,e),void 0!==t&&(R.limit=t),void 0!==s&&(R.skip=s),void 0!==n&&(R.order=n),void 0!==a&&(R.name=a),void 0!==o&&(R.externalUserId=o),void 0!==h&&(R.email=h),void 0!==u&&(R.phoneNumber=u),void 0!==l&&(R.authProviderId=l),void 0!==p&&(R.walletClientType=p),c(w,R);let f=g&&g.headers?g.headers:{};return m.headers={...y,...f,...P.headers},{url:d(w),options:m}},getUserWallet:async(t,s={})=>{o("getUserWallet","id",t);const n="/v2/users/{id}/wallet".replace("{id}",encodeURIComponent(String(t))),a=new URL(n,i);let h;e&&(h=e.baseOptions);const u={method:"GET",...h,...s},l={};await r(l,e),await r(l,e),c(a,{});let p=h&&h.headers?h.headers:{};return u.headers={...l,...p,...s.headers},{url:d(a),options:u}},meV2:async(t={})=>{const s=new URL("/iam/v2/me",i);let n;e&&(n=e.baseOptions);const a={method:"GET",...n,...t},o={};await r(o,e),await r(o,e),c(s,{});let h=n&&n.headers?n.headers:{};return a.headers={...o,...h,...t.headers},{url:d(s),options:a}},pregenerateUserV2:async(t,s={})=>{o("pregenerateUserV2","pregenerateUserRequestV2",t);const n=new URL("/v2/users/pregenerate",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}},thirdPartyV2:async(t,s={})=>{o("thirdPartyV2","thirdPartyOAuthRequest",t);const n=new URL("/iam/v2/user/third_party",i);let a;e&&(a=e.baseOptions);const h={method:"POST",...a,...s},l={};await r(l,e),await r(l,e),l["Content-Type"]="application/json",c(n,{});let p=a&&a.headers?a.headers:{};return h.headers={...l,...p,...s.headers},h.data=u(t,h,e),{url:d(n),options:h}}}}(t);return{async deleteUser(a,i){const o=await n.deleteUser(a,i);return l(o,e,s,t)},async getAuthUser(a,i){const o=await n.getAuthUser(a,i);return l(o,e,s,t)},async getAuthUsers(a,i,o,r,h,c,u,d,p,P){const w=await n.getAuthUsers(a,i,o,r,h,c,u,d,p,P);return l(w,e,s,t)},async getUserWallet(a,i){const o=await n.getUserWallet(a,i);return l(o,e,s,t)},async meV2(a){const i=await n.meV2(a);return l(i,e,s,t)},async pregenerateUserV2(a,i){const o=await n.pregenerateUserV2(a,i);return l(o,e,s,t)},async thirdPartyV2(a,i){const o=await n.thirdPartyV2(a,i);return l(o,e,s,t)}}};class I extends n{deleteUser(e,t){return q(this.configuration).deleteUser(e.id,t).then(e=>e(this.axios,this.basePath))}getAuthUser(e,t){return q(this.configuration).getAuthUser(e.id,t).then(e=>e(this.axios,this.basePath))}getAuthUsers(e={},t){return q(this.configuration).getAuthUsers(e.limit,e.skip,e.order,e.name,e.externalUserId,e.email,e.phoneNumber,e.authProviderId,e.walletClientType,t).then(e=>e(this.axios,this.basePath))}getUserWallet(e,t){return q(this.configuration).getUserWallet(e.id,t).then(e=>e(this.axios,this.basePath))}meV2(e){return q(this.configuration).meV2(e).then(e=>e(this.axios,this.basePath))}pregenerateUserV2(e,t){return q(this.configuration).pregenerateUserV2(e.pregenerateUserRequestV2,t).then(e=>e(this.axios,this.basePath))}thirdPartyV2(e,t){return q(this.configuration).thirdPartyV2(e.thirdPartyOAuthRequest,t).then(e=>e(this.axios,this.basePath))}}class x{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 A=({basePath:e,accessToken:t,nativeAppIdentifier:s})=>{if(!e.trim())throw Error("basePath can not be empty");const n={basePath:e,accessToken:t,baseOptions:{headers:{...s&&{"x-native-app-identifier":s},Cookie:null},withCredentials:!1}};return new x(n)};exports.BackendApiClients=class{config;transactionIntentsApi;accountsApi;accountsV2Api;rpcApi;sessionsApi;authApi;userApi;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:A(n)};const a={basePath:`${s.basePath}/iam/v2/auth`,accessToken:"",nativeAppIdentifier:s.nativeAppIdentifier},i=A(a);this.authenticationApi=new y(this.config.backend,void 0,this.axiosInstance),this.authApi=new f(i,void 0,this.axiosInstance),this.userApi=new I(this.config.backend,void 0,this.axiosInstance),this.transactionIntentsApi=new v(this.config.backend,void 0,this.axiosInstance),this.accountsApi=new P(this.config.backend,void 0,this.axiosInstance),this.accountsV2Api=new g(this.config.backend,void 0,this.axiosInstance),this.sessionsApi=new T(this.config.backend,void 0,this.axiosInstance),this.rpcApi=new O(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){}}},exports.createConfig=A;
@@ -1 +1 @@
1
- "use strict";var e=require("../../../packages/internal/openapi-clients/dist/index.cjs"),r=require("../core/errors/openfortError.cjs"),t=require("../core/passkey/handler.cjs"),s=require("../core/config/config.cjs"),n=require("../core/configuration/account.cjs"),a=require("../core/configuration/authentication.cjs"),i=require("../core/errors/authErrorCodes.cjs"),o=require("../core/errors/withApiError.cjs"),d=require("../types/types.cjs"),c=require("../utils/debug.cjs"),g=require("../utils/observe.cjs"),h=require("../wallets/embedded.cjs"),u=require("../wallets/evm/evmProvider.cjs");require("../wallets/evm/types.cjs");var y=require("../wallets/evm/provider/eip6963.cjs"),l=require("../wallets/evm/walletHelpers.cjs"),m=require("../wallets/iframeManager.cjs"),f=require("../wallets/messaging/ReactNativeMessenger.cjs");require("../wallets/messaging/browserMessenger/backwardCompatibility.cjs");var p=require("../wallets/messaging/browserMessenger/messengers/WindowMessenger.cjs");exports.EmbeddedWalletApi=class{storage;validateAndRefreshToken;ensureInitialized;eventEmitter;passkeyHandler;iframeManager=null;iframeManagerPromise=null;signer=null;signerPromise=null;provider=null;messagePoster=null;messenger=null;constructor(e,r,t,s,n){this.storage=e,this.validateAndRefreshToken=r,this.ensureInitialized=t,this.eventEmitter=s,this.passkeyHandler=n,this.eventEmitter.on(d.OpenfortEvents.ON_LOGOUT,()=>{c.debugLog("Handling logout event in EmbeddedWalletApi"),this.handleLogout()})}get backendApiClients(){const t=s.SDKConfiguration.getInstance();if(!t)throw new r.ConfigurationError("Configuration not found");return new e.BackendApiClients({basePath:t.backendUrl,accessToken:t.baseConfiguration.publishableKey,nativeAppIdentifier:t.nativeAppIdentifier})}async getIframeManager(){if(c.debugLog("[HANDSHAKE DEBUG] getIframeManager called"),this.iframeManager?.hasFailed&&(c.debugLog("[HANDSHAKE DEBUG] Existing iframeManager has failed, clearing for recreation"),this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null),this.iframeManager)return c.debugLog("[HANDSHAKE DEBUG] Returning existing iframeManager instance"),this.iframeManager;if(this.iframeManagerPromise)return c.debugLog("[HANDSHAKE DEBUG] Returning existing iframeManagerPromise"),this.iframeManagerPromise;c.debugLog("[HANDSHAKE DEBUG] Creating new iframeManager"),this.iframeManagerPromise=this.createIframeManager();try{return c.debugLog("[HANDSHAKE DEBUG] Awaiting iframeManager creation"),this.iframeManager=await this.iframeManagerPromise,c.debugLog("[HANDSHAKE DEBUG] IframeManager created successfully"),this.iframeManagerPromise=null,this.iframeManager}catch(e){throw c.debugLog("[HANDSHAKE DEBUG] Error creating iframeManager:",e),this.iframeManagerPromise=null,this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null,e}}async createIframeManager(){c.debugLog("[HANDSHAKE DEBUG] createIframeManager starting");const e=s.SDKConfiguration.getInstance();if(!e)throw c.debugLog("[HANDSHAKE DEBUG] Configuration not found"),new r.ConfigurationError("Configuration not found");let t;if(c.debugLog("[HANDSHAKE DEBUG] Configuration found"),this.messagePoster)c.debugLog("[HANDSHAKE DEBUG] Creating ReactNativeMessenger with messagePoster"),this.messenger&&(c.debugLog("[HANDSHAKE DEBUG] Destroying old messenger before creating new one"),this.messenger.destroy()),this.messenger=new f.ReactNativeMessenger(this.messagePoster),c.debugLog("[HANDSHAKE DEBUG] Created new ReactNativeMessenger instance"),t=this.messenger;else{c.debugLog("[HANDSHAKE DEBUG] Creating WindowMessenger for browser mode");const r=this.createIframe(e.iframeUrl),s=new URL(e.iframeUrl).origin;t=new p({remoteWindow:r.contentWindow,allowedOrigins:[s]}),c.debugLog("[HANDSHAKE DEBUG] Created WindowMessenger")}return c.debugLog("[HANDSHAKE DEBUG] Creating IframeManager instance"),new m.IframeManager(e,this.storage,t)}async ensureSigner(){if(this.iframeManager?.hasFailed&&(c.debugLog("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();await e.initialize();return new h.EmbeddedSigner(e,this.storage,this.backendApiClients,this.passkeyHandler,this.eventEmitter)}createIframe(e){if("undefined"==typeof document)throw new r.ConfigurationError("Document is not available. Please provide a message poster for non-browser environments.");const t=document.getElementById("openfort-iframe");t&&t.remove();const s=document.createElement("iframe");return s.style.display="none",s.id="openfort-iframe",s.src=e,document.body.appendChild(s),s}async getPasskeyKey(e){const t=await a.Authentication.fromStorage(this.storage);if(!t?.userId)throw new r.AuthenticationError("auth","User is required for passkey key derivation. Logout and login again.",401);return this.passkeyHandler.deriveAndExportKey({id:e,seed:t.userId})}async getEntropy(e){switch(e.recoveryMethod){case d.RecoveryMethod.PASSWORD:return{recoveryPassword:e.password};case d.RecoveryMethod.AUTOMATIC:return{encryptionSession:e.encryptionSession};case d.RecoveryMethod.PASSKEY:return{passkey:e.passkeyInfo?{id:e.passkeyInfo.passkeyId,key:e.passkeyInfo.passkeyKey||await this.getPasskeyKey(e.passkeyInfo.passkeyId)}:{}};default:throw new r.ConfigurationError("Invalid recovery method")}}async configure(e){await this.validateAndRefreshToken();const r=e.recoveryParams??{recoveryMethod:d.RecoveryMethod.AUTOMATIC},[t,s]=await Promise.all([this.ensureSigner(),this.getEntropy(r)]),a={chainId:e.chainId,entropy:s,accountType:e.accountType??d.AccountTypeEnum.SMART_ACCOUNT,chainType:e.chainType??d.ChainTypeEnum.EVM,getPasskeyKeyFn:async e=>this.getPasskeyKey(e)},i=await t.configure(a);return{id:i.id,chainId:i.chainId,address:i.address,ownerAddress:i.ownerAddress,chainType:i.chainType,accountType:i.accountType,implementationType:i.implementationType,factoryAddress:i.factoryAddress,salt:i.salt,createdAt:i.createdAt,implementationAddress:i.implementationAddress,recoveryMethod:n.Account.parseRecoveryMethod(i.recoveryMethod),recoveryMethodDetails:i.recoveryMethodDetails}}async create(e){await this.validateAndRefreshToken();const s=e.recoveryParams??{recoveryMethod:d.RecoveryMethod.AUTOMATIC},o=await a.Authentication.fromStorage(this.storage);if(!o)throw new r.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"missing authentication");if(s.recoveryMethod===d.RecoveryMethod.PASSKEY){if(!o.userId)throw new r.ConfigurationError("User ID is required for passkey creation");const e=await this.passkeyHandler.createPasskey({id:t.PasskeyHandler.randomPasskeyName(),seed:o.userId});if(!e.key)throw new r.ConfigurationError("Passkey creation failed: no key material returned");s.passkeyInfo={passkeyId:e.id,passkeyKey:e.key}}const[c,g]=await Promise.all([this.ensureSigner(),this.getEntropy(s)]),h=await c.create({accountType:e.accountType,chainType:e.chainType,chainId:e.chainId,entropy:g}),u={id:h.id,chainId:h.chainId,address:h.address,ownerAddress:h.ownerAddress,chainType:h.chainType,accountType:h.accountType,implementationType:h.implementationType,factoryAddress:h.factoryAddress,salt:h.salt,createdAt:h.createdAt,implementationAddress:h.implementationAddress,recoveryMethod:n.Account.parseRecoveryMethod(h.recoveryMethod),recoveryMethodDetails:h.recoveryMethodDetails};return this.eventEmitter.emit(d.OpenfortEvents.ON_EMBEDDED_WALLET_CREATED,u),u}async recover(e){await this.validateAndRefreshToken();const t=e.recoveryParams??{recoveryMethod:d.RecoveryMethod.AUTOMATIC};if(t.recoveryMethod===d.RecoveryMethod.PASSKEY){if(!t.passkeyInfo?.passkeyId)throw new r.ConfigurationError("Passkey ID must be provided for passkey recovery");t.passkeyInfo={passkeyId:t.passkeyInfo.passkeyId}}const[s,a]=await Promise.all([this.ensureSigner(),this.getEntropy(t)]),i=await s.recover({account:e.account,entropy:a}),o={id:i.id,chainId:i.chainId,implementationAddress:i.implementationAddress,factoryAddress:i.factoryAddress,salt:i.salt,address:i.address,ownerAddress:i.ownerAddress,chainType:i.chainType,accountType:i.accountType,implementationType:i.implementationType,createdAt:i.createdAt,recoveryMethod:n.Account.parseRecoveryMethod(i.recoveryMethod),recoveryMethodDetails:i.recoveryMethodDetails};return this.eventEmitter.emit(d.OpenfortEvents.ON_EMBEDDED_WALLET_RECOVERED,o),o}async signMessage(e,r){await this.validateAndRefreshToken();const t=await this.ensureSigner(),{hashMessage:s=!0,arrayifyMessage:a=!1}=r||{},i=await n.Account.fromStorage(this.storage);return await t.sign(e,a,s,i?.chainType)}async signTypedData(e,t,s){await this.validateAndRefreshToken();const a=await this.ensureSigner(),o=await n.Account.fromStorage(this.storage);if(!o)throw new r.SignerError(i.OPENFORT_AUTH_ERROR_CODES.MISSING_SIGNER,"No account found");const d={...t};delete d.EIP712Domain;const{_TypedDataEncoder:c}=await import("@ethersproject/hash"),g=c.hash(e,d,s);return await l.signMessage({hash:g,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,s){await this.validateAndRefreshToken();const o=await this.ensureSigner(),c=await a.Authentication.fromStorage(this.storage);if(!c)throw new r.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"missing authentication");let g,h,u,y;if(e.recoveryMethod===d.RecoveryMethod.PASSKEY){const e=await n.Account.fromStorage(this.storage);if(!e)throw new r.ConfigurationError("missing account");const t=e?.recoveryMethodDetails?.passkeyId;if(!t)throw new r.ConfigurationError("missing passkey id for account");if(!c.userId)throw new r.ConfigurationError("User ID is required for passkey key derivation");u={passkeyId:t,passkeyKey:await this.passkeyHandler.deriveAndExportKey({id:t,seed:c.userId})}}else if(s.recoveryMethod===d.RecoveryMethod.PASSKEY){if(!c.userId)throw new r.ConfigurationError("User ID is required for passkey creation");const e=await this.passkeyHandler.createPasskey({id:t.PasskeyHandler.randomPasskeyName(),seed:c.userId});if(!e.key)throw new r.ConfigurationError("Passkey creation failed: no key material returned");u={passkeyId:e.id,passkeyKey:e.key},y={passkeyId:e.id}}if(e.recoveryMethod===d.RecoveryMethod.PASSWORD?g=e.password:s.recoveryMethod===d.RecoveryMethod.PASSWORD&&(g=s.password),e.recoveryMethod===d.RecoveryMethod.AUTOMATIC?h=e.encryptionSession:s.recoveryMethod===d.RecoveryMethod.AUTOMATIC&&(h=s.encryptionSession),!g&&!h)throw new r.ConfigurationError("Password or encryption session is not provided");await o.setRecoveryMethod({recoveryMethod:s.recoveryMethod,recoveryPassword:g,encryptionSession:h,passkeyInfo:u});const l=await n.Account.fromStorage(this.storage);l&&new n.Account({...l,recoveryMethod:s.recoveryMethod,recoveryMethodDetails:y}).save(this.storage)}async get(){await this.validateAndRefreshToken();const e=await n.Account.fromStorage(this.storage);if(!e)throw new r.SignerError(i.OPENFORT_AUTH_ERROR_CODES.MISSING_SIGNER,"No signer configured");if(!await a.Authentication.fromStorage(this.storage))throw new r.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No access token found");return{id:e.id,chainId:e.chainId,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:n.Account.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails}}async list(e){await this.validateAndRefreshToken();const t={...e},d=s.SDKConfiguration.getInstance();if(!d)throw new r.ConfigurationError("Configuration not found");const c=await a.Authentication.fromStorage(this.storage);if(!c)throw new r.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No access token found");return await this.validateAndRefreshToken(),o.withApiError(async()=>(await this.backendApiClients.accountsV2Api.getAccountsV2(t,{headers:c.thirdPartyProvider?{authorization:`Bearer ${d.baseConfiguration.publishableKey}`,"x-player-token":c.token,"x-auth-provider":c.thirdPartyProvider,"x-token-type":c.thirdPartyTokenType}:{authorization:`Bearer ${c.token}`,"x-project-key":d.baseConfiguration.publishableKey}})).data.data.map(e=>({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:n.Account.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails})),{context:"list"})}async getEmbeddedState(){try{if(!await a.Authentication.fromStorage(this.storage))return d.EmbeddedState.UNAUTHENTICATED;return await n.Account.fromStorage(this.storage)?d.EmbeddedState.READY:d.EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED}catch(e){return c.debugLog("Failed to get embedded state:",e),d.EmbeddedState.UNAUTHENTICATED}}watchEmbeddedState(e){return g.observe("watchEmbeddedState",{onChange:e.onChange,onError:e.onError},r=>{let t;const s=async()=>{try{const e=await this.getEmbeddedState();t!==e&&(r.onChange?.(e,t),t=e)}catch(e){r.onError?.(e instanceof Error?e:new Error(String(e)))}};s();const n=()=>s(),a=()=>s(),i=()=>s(),o=()=>s();this.eventEmitter.on(d.OpenfortEvents.ON_AUTH_SUCCESS,n),this.eventEmitter.on(d.OpenfortEvents.ON_LOGOUT,a),this.eventEmitter.on(d.OpenfortEvents.ON_EMBEDDED_WALLET_CREATED,i),this.eventEmitter.on(d.OpenfortEvents.ON_EMBEDDED_WALLET_RECOVERED,o);const c=setInterval(s,e.pollingInterval??2e3);return()=>{clearInterval(c),this.eventEmitter.off(d.OpenfortEvents.ON_AUTH_SUCCESS,n),this.eventEmitter.off(d.OpenfortEvents.ON_LOGOUT,a),this.eventEmitter.off(d.OpenfortEvents.ON_EMBEDDED_WALLET_CREATED,i),this.eventEmitter.off(d.OpenfortEvents.ON_EMBEDDED_WALLET_RECOVERED,o)}})}async getEthereumProvider(e){await this.ensureInitialized();const r={announceProvider:!0,...e},t=await a.Authentication.fromStorage(this.storage),s=await n.Account.fromStorage(this.storage);return this.provider?this.provider&&r.policy&&this.provider.updatePolicy(r.policy):(this.provider=new u.EvmProvider({storage:this.storage,openfortEventEmitter:this.eventEmitter,ensureSigner:this.ensureSigner.bind(this),account:s||void 0,authentication:t||void 0,backendApiClients:this.backendApiClients,policyId:r.policy,validateAndRefreshSession:this.validateAndRefreshToken.bind(this),chains:r.chains}),r.announceProvider&&y.announceProvider({info:{...y.openfortProviderInfo,...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 a.Authentication.fromStorage(this.storage);if(t)try{return await r.getCurrentDevice(t.userId),!0}catch(e){return!1}return r.isLoaded()}catch(e){return c.debugLog("Ping failed:",e),!1}}getURL(){const e=s.SDKConfiguration.getInstance();if(!e)throw new r.ConfigurationError("Configuration not found");return e.iframeUrl}async setMessagePoster(e){if(!e||"function"!=typeof e.postMessage)throw new r.ConfigurationError("Invalid message poster");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(){if("undefined"==typeof document&&!this.messagePoster)return c.debugLog("Skipping signer disconnect: no messagePoster available in non-browser environment"),this.provider=null,this.messenger=null,this.iframeManager=null,this.iframeManagerPromise=null,this.signer=null,void(this.signerPromise=null);try{const e=await this.ensureSigner();await e.disconnect()}catch{}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 c.debugLog("Invalid message received:",e);c.debugLog("[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 c.debugLog("[HANDSHAKE DEBUG] Passing message directly to existing ReactNativeMessenger"),void this.messenger.handleMessage(e);const t=await this.getIframeManager();c.debugLog(`[HANDSHAKE DEBUG] IframeManager obtained, isLoaded: ${t.isLoaded()}`),r&&!t.isLoaded()&&c.debugLog("[HANDSHAKE DEBUG] Received penpal message before connection initialized, setting up connection..."),c.debugLog("[HANDSHAKE DEBUG] Calling iframeManager.onMessage"),await t.onMessage(e),c.debugLog("[HANDSHAKE DEBUG] iframeManager.onMessage completed")}isReady(){return this.iframeManager?.isLoaded()||!1}};
1
+ "use strict";var e=require("../../../packages/internal/openapi-clients/dist/index.cjs"),r=require("../core/errors/openfortError.cjs"),t=require("../core/passkey/handler.cjs"),s=require("../core/config/config.cjs"),n=require("../core/configuration/account.cjs"),a=require("../core/configuration/authentication.cjs"),i=require("../core/errors/authErrorCodes.cjs"),o=require("../core/errors/withApiError.cjs"),d=require("../types/types.cjs"),c=require("../utils/debug.cjs"),g=require("../utils/observe.cjs"),h=require("../wallets/embedded.cjs"),u=require("../wallets/evm/evmProvider.cjs");require("../wallets/evm/types.cjs");var y=require("../wallets/evm/provider/eip6963.cjs"),l=require("../wallets/evm/walletHelpers.cjs"),m=require("../wallets/iframeManager.cjs"),f=require("../wallets/messaging/ReactNativeMessenger.cjs");require("../wallets/messaging/browserMessenger/backwardCompatibility.cjs");var p=require("../wallets/messaging/browserMessenger/messengers/WindowMessenger.cjs");exports.EmbeddedWalletApi=class{storage;validateAndRefreshToken;ensureInitialized;eventEmitter;passkeyHandler;iframeManager=null;iframeManagerPromise=null;signer=null;signerPromise=null;provider=null;messagePoster=null;messenger=null;constructor(e,r,t,s,n){this.storage=e,this.validateAndRefreshToken=r,this.ensureInitialized=t,this.eventEmitter=s,this.passkeyHandler=n,this.eventEmitter.on(d.OpenfortEvents.ON_LOGOUT,()=>{c.debugLog("Handling logout event in EmbeddedWalletApi"),this.handleLogout()})}get backendApiClients(){const t=s.SDKConfiguration.getInstance();if(!t)throw new r.ConfigurationError("Configuration not found");return new e.BackendApiClients({basePath:t.backendUrl,accessToken:t.baseConfiguration.publishableKey,nativeAppIdentifier:t.nativeAppIdentifier})}async getIframeManager(){if(c.debugLog("[HANDSHAKE DEBUG] getIframeManager called"),this.iframeManager?.hasFailed&&(c.debugLog("[HANDSHAKE DEBUG] Existing iframeManager has failed, clearing for recreation"),this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null),this.iframeManager)return c.debugLog("[HANDSHAKE DEBUG] Returning existing iframeManager instance"),this.iframeManager;if(this.iframeManagerPromise)return c.debugLog("[HANDSHAKE DEBUG] Returning existing iframeManagerPromise"),this.iframeManagerPromise;c.debugLog("[HANDSHAKE DEBUG] Creating new iframeManager"),this.iframeManagerPromise=this.createIframeManager();try{return c.debugLog("[HANDSHAKE DEBUG] Awaiting iframeManager creation"),this.iframeManager=await this.iframeManagerPromise,c.debugLog("[HANDSHAKE DEBUG] IframeManager created successfully"),this.iframeManagerPromise=null,this.iframeManager}catch(e){throw c.debugLog("[HANDSHAKE DEBUG] Error creating iframeManager:",e),this.iframeManagerPromise=null,this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null,e}}async createIframeManager(){c.debugLog("[HANDSHAKE DEBUG] createIframeManager starting");const e=s.SDKConfiguration.getInstance();if(!e)throw c.debugLog("[HANDSHAKE DEBUG] Configuration not found"),new r.ConfigurationError("Configuration not found");let t;if(c.debugLog("[HANDSHAKE DEBUG] Configuration found"),this.messagePoster)c.debugLog("[HANDSHAKE DEBUG] Creating ReactNativeMessenger with messagePoster"),this.messenger&&(c.debugLog("[HANDSHAKE DEBUG] Destroying old messenger before creating new one"),this.messenger.destroy()),this.messenger=new f.ReactNativeMessenger(this.messagePoster),c.debugLog("[HANDSHAKE DEBUG] Created new ReactNativeMessenger instance"),t=this.messenger;else{c.debugLog("[HANDSHAKE DEBUG] Creating WindowMessenger for browser mode");const r=this.createIframe(e.iframeUrl),s=new URL(e.iframeUrl).origin;t=new p({remoteWindow:r.contentWindow,allowedOrigins:[s]}),c.debugLog("[HANDSHAKE DEBUG] Created WindowMessenger")}return c.debugLog("[HANDSHAKE DEBUG] Creating IframeManager instance"),new m.IframeManager(e,this.storage,t)}async ensureSigner(){if(this.iframeManager?.hasFailed&&(c.debugLog("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();await e.initialize();return new h.EmbeddedSigner(e,this.storage,this.backendApiClients,this.passkeyHandler,this.eventEmitter)}createIframe(e){if("undefined"==typeof document)throw new r.ConfigurationError("Document is not available. Please provide a message poster for non-browser environments.");const t=document.getElementById("openfort-iframe");t&&t.remove();const s=document.createElement("iframe");return s.style.display="none",s.id="openfort-iframe",s.src=e,document.body.appendChild(s),s}async getPasskeyKey(e){const t=await a.Authentication.fromStorage(this.storage);if(!t?.userId)throw new r.AuthenticationError("auth","User is required for passkey key derivation. Logout and login again.",401);return this.passkeyHandler.deriveAndExportKey({id:e,seed:t.userId})}async getEntropy(e){switch(e.recoveryMethod){case d.RecoveryMethod.PASSWORD:return{recoveryPassword:e.password};case d.RecoveryMethod.AUTOMATIC:return{encryptionSession:e.encryptionSession};case d.RecoveryMethod.PASSKEY:return{passkey:e.passkeyInfo?{id:e.passkeyInfo.passkeyId,key:e.passkeyInfo.passkeyKey||await this.getPasskeyKey(e.passkeyInfo.passkeyId)}:{}};default:throw new r.ConfigurationError("Invalid recovery method")}}async configure(e){await this.validateAndRefreshToken();const r=e.recoveryParams??{recoveryMethod:d.RecoveryMethod.AUTOMATIC},[t,s]=await Promise.all([this.ensureSigner(),this.getEntropy(r)]),a={chainId:e.chainId,entropy:s,accountType:e.accountType??d.AccountTypeEnum.SMART_ACCOUNT,chainType:e.chainType??d.ChainTypeEnum.EVM,getPasskeyKeyFn:async e=>this.getPasskeyKey(e)},i=await t.configure(a);return{id:i.id,chainId:i.chainId,address:i.address,ownerAddress:i.ownerAddress,chainType:i.chainType,accountType:i.accountType,implementationType:i.implementationType,factoryAddress:i.factoryAddress,salt:i.salt,createdAt:i.createdAt,implementationAddress:i.implementationAddress,recoveryMethod:n.Account.parseRecoveryMethod(i.recoveryMethod),recoveryMethodDetails:i.recoveryMethodDetails}}async create(e){await this.validateAndRefreshToken();const s=e.recoveryParams??{recoveryMethod:d.RecoveryMethod.AUTOMATIC},o=await a.Authentication.fromStorage(this.storage);if(!o)throw new r.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"missing authentication");if(s.recoveryMethod===d.RecoveryMethod.PASSKEY){if(!o.userId)throw new r.ConfigurationError("User ID is required for passkey creation");const e=await this.passkeyHandler.createPasskey({id:t.PasskeyHandler.randomPasskeyName(),seed:o.userId});if(!e.key)throw new r.ConfigurationError("Passkey creation failed: no key material returned");s.passkeyInfo={passkeyId:e.id,passkeyKey:e.key}}const[c,g]=await Promise.all([this.ensureSigner(),this.getEntropy(s)]),h=await c.create({accountType:e.accountType,chainType:e.chainType,chainId:e.chainId,entropy:g}),u={id:h.id,chainId:h.chainId,address:h.address,ownerAddress:h.ownerAddress,chainType:h.chainType,accountType:h.accountType,implementationType:h.implementationType,factoryAddress:h.factoryAddress,salt:h.salt,createdAt:h.createdAt,implementationAddress:h.implementationAddress,recoveryMethod:n.Account.parseRecoveryMethod(h.recoveryMethod),recoveryMethodDetails:h.recoveryMethodDetails};return this.eventEmitter.emit(d.OpenfortEvents.ON_EMBEDDED_WALLET_CREATED,u),u}async recover(e){await this.validateAndRefreshToken();const t=e.recoveryParams??{recoveryMethod:d.RecoveryMethod.AUTOMATIC};if(t.recoveryMethod===d.RecoveryMethod.PASSKEY){if(!t.passkeyInfo?.passkeyId)throw new r.ConfigurationError("Passkey ID must be provided for passkey recovery");t.passkeyInfo={passkeyId:t.passkeyInfo.passkeyId}}const[s,a]=await Promise.all([this.ensureSigner(),this.getEntropy(t)]),i=await s.recover({account:e.account,entropy:a}),o={id:i.id,chainId:i.chainId,implementationAddress:i.implementationAddress,factoryAddress:i.factoryAddress,salt:i.salt,address:i.address,ownerAddress:i.ownerAddress,chainType:i.chainType,accountType:i.accountType,implementationType:i.implementationType,createdAt:i.createdAt,recoveryMethod:n.Account.parseRecoveryMethod(i.recoveryMethod),recoveryMethodDetails:i.recoveryMethodDetails};return this.eventEmitter.emit(d.OpenfortEvents.ON_EMBEDDED_WALLET_RECOVERED,o),o}async signMessage(e,r){await this.validateAndRefreshToken();const t=await this.ensureSigner(),{hashMessage:s=!0,arrayifyMessage:a=!1}=r||{},i=await n.Account.fromStorage(this.storage);return await t.sign(e,a,s,i?.chainType)}async signTypedData(e,t,s){await this.validateAndRefreshToken();const a=await this.ensureSigner(),o=await n.Account.fromStorage(this.storage);if(!o)throw new r.SignerError(i.OPENFORT_AUTH_ERROR_CODES.MISSING_SIGNER,"No account found");const d={...t};delete d.EIP712Domain;const{_TypedDataEncoder:c}=await import("@ethersproject/hash"),g=c.hash(e,d,s);return await l.signMessage({hash:g,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,s){await this.validateAndRefreshToken();const o=await this.ensureSigner(),c=await a.Authentication.fromStorage(this.storage);if(!c)throw new r.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"missing authentication");let g,h,u,y;if(e.recoveryMethod===d.RecoveryMethod.PASSKEY){const e=await n.Account.fromStorage(this.storage);if(!e)throw new r.ConfigurationError("missing account");const t=e?.recoveryMethodDetails?.passkeyId;if(!t)throw new r.ConfigurationError("missing passkey id for account");if(!c.userId)throw new r.ConfigurationError("User ID is required for passkey key derivation");u={passkeyId:t,passkeyKey:await this.passkeyHandler.deriveAndExportKey({id:t,seed:c.userId})}}else if(s.recoveryMethod===d.RecoveryMethod.PASSKEY){if(!c.userId)throw new r.ConfigurationError("User ID is required for passkey creation");const e=await this.passkeyHandler.createPasskey({id:t.PasskeyHandler.randomPasskeyName(),seed:c.userId});if(!e.key)throw new r.ConfigurationError("Passkey creation failed: no key material returned");u={passkeyId:e.id,passkeyKey:e.key},y={passkeyId:e.id}}if(e.recoveryMethod===d.RecoveryMethod.PASSWORD?g=e.password:s.recoveryMethod===d.RecoveryMethod.PASSWORD&&(g=s.password),e.recoveryMethod===d.RecoveryMethod.AUTOMATIC?h=e.encryptionSession:s.recoveryMethod===d.RecoveryMethod.AUTOMATIC&&(h=s.encryptionSession),!g&&!h)throw new r.ConfigurationError("Password or encryption session is not provided");await o.setRecoveryMethod({recoveryMethod:s.recoveryMethod,recoveryPassword:g,encryptionSession:h,passkeyInfo:u});const l=await n.Account.fromStorage(this.storage);l&&new n.Account({...l,recoveryMethod:s.recoveryMethod,recoveryMethodDetails:y}).save(this.storage)}async get(){await this.validateAndRefreshToken();const e=await n.Account.fromStorage(this.storage);if(!e)throw new r.SignerError(i.OPENFORT_AUTH_ERROR_CODES.MISSING_SIGNER,"No signer configured");if(!await a.Authentication.fromStorage(this.storage))throw new r.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No access token found");return{id:e.id,chainId:e.chainId,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:n.Account.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails}}async list(e){await this.validateAndRefreshToken();const t={...e},d=s.SDKConfiguration.getInstance();if(!d)throw new r.ConfigurationError("Configuration not found");const c=await a.Authentication.fromStorage(this.storage);if(!c)throw new r.SessionError(i.OPENFORT_AUTH_ERROR_CODES.NOT_LOGGED_IN,"No access token found");return await this.validateAndRefreshToken(),o.withApiError(async()=>(await this.backendApiClients.accountsV2Api.getAccountsV2(t,{headers:c.thirdPartyProvider?{authorization:`Bearer ${d.baseConfiguration.publishableKey}`,"x-player-token":c.token,"x-auth-provider":c.thirdPartyProvider,"x-token-type":c.thirdPartyTokenType}:{authorization:`Bearer ${c.token}`,"x-project-key":d.baseConfiguration.publishableKey}})).data.data.map(e=>({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:n.Account.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails})),{context:"list"})}async getEmbeddedState(){try{if(!await a.Authentication.fromStorage(this.storage))return d.EmbeddedState.UNAUTHENTICATED;return await n.Account.fromStorage(this.storage)?d.EmbeddedState.READY:d.EmbeddedState.EMBEDDED_SIGNER_NOT_CONFIGURED}catch(e){return c.debugLog("Failed to get embedded state:",e),d.EmbeddedState.UNAUTHENTICATED}}watchEmbeddedState(e){return g.observe("watchEmbeddedState",{onChange:e.onChange,onError:e.onError},r=>{let t;const s=async()=>{try{const e=await this.getEmbeddedState();t!==e&&(r.onChange?.(e,t),t=e)}catch(e){r.onError?.(e instanceof Error?e:new Error(String(e)))}};s();const n=()=>s(),a=()=>s(),i=()=>s(),o=()=>s();this.eventEmitter.on(d.OpenfortEvents.ON_AUTH_SUCCESS,n),this.eventEmitter.on(d.OpenfortEvents.ON_LOGOUT,a),this.eventEmitter.on(d.OpenfortEvents.ON_EMBEDDED_WALLET_CREATED,i),this.eventEmitter.on(d.OpenfortEvents.ON_EMBEDDED_WALLET_RECOVERED,o);const c=setInterval(s,e.pollingInterval??2e3);return()=>{clearInterval(c),this.eventEmitter.off(d.OpenfortEvents.ON_AUTH_SUCCESS,n),this.eventEmitter.off(d.OpenfortEvents.ON_LOGOUT,a),this.eventEmitter.off(d.OpenfortEvents.ON_EMBEDDED_WALLET_CREATED,i),this.eventEmitter.off(d.OpenfortEvents.ON_EMBEDDED_WALLET_RECOVERED,o)}})}async getEthereumProvider(e){await this.ensureInitialized();const r={announceProvider:!0,...e},t=await a.Authentication.fromStorage(this.storage),s=await n.Account.fromStorage(this.storage);return this.provider?this.provider&&r.feeSponsorship&&this.provider.updateFeeSponsorship(r.feeSponsorship):(this.provider=new u.EvmProvider({storage:this.storage,openfortEventEmitter:this.eventEmitter,ensureSigner:this.ensureSigner.bind(this),account:s||void 0,authentication:t||void 0,backendApiClients:this.backendApiClients,feeSponsorshipId:r.feeSponsorship,validateAndRefreshSession:this.validateAndRefreshToken.bind(this),chains:r.chains}),r.announceProvider&&y.announceProvider({info:{...y.openfortProviderInfo,...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 a.Authentication.fromStorage(this.storage);if(t)try{return await r.getCurrentDevice(t.userId),!0}catch(e){return!1}return r.isLoaded()}catch(e){return c.debugLog("Ping failed:",e),!1}}getURL(){const e=s.SDKConfiguration.getInstance();if(!e)throw new r.ConfigurationError("Configuration not found");return e.iframeUrl}async setMessagePoster(e){if(!e||"function"!=typeof e.postMessage)throw new r.ConfigurationError("Invalid message poster");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(){if("undefined"==typeof document&&!this.messagePoster)return c.debugLog("Skipping signer disconnect: no messagePoster available in non-browser environment"),this.provider=null,this.messenger=null,this.iframeManager=null,this.iframeManagerPromise=null,this.signer=null,void(this.signerPromise=null);try{const e=await this.ensureSigner();await e.disconnect()}catch{}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 c.debugLog("Invalid message received:",e);c.debugLog("[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 c.debugLog("[HANDSHAKE DEBUG] Passing message directly to existing ReactNativeMessenger"),void this.messenger.handleMessage(e);const t=await this.getIframeManager();c.debugLog(`[HANDSHAKE DEBUG] IframeManager obtained, isLoaded: ${t.isLoaded()}`),r&&!t.isLoaded()&&c.debugLog("[HANDSHAKE DEBUG] Received penpal message before connection initialized, setting up connection..."),c.debugLog("[HANDSHAKE DEBUG] Calling iframeManager.onMessage"),await t.onMessage(e),c.debugLog("[HANDSHAKE DEBUG] iframeManager.onMessage completed")}isReady(){return this.iframeManager?.isLoaded()||!1}};
@@ -1 +1 @@
1
- "use strict";exports.PACKAGE="@openfort/openfort-js",exports.VERSION="1.2.1";
1
+ "use strict";exports.PACKAGE="@openfort/openfort-js",exports.VERSION="1.3.1";
@@ -1 +1 @@
1
- "use strict";var t=require("../../core/errors/withApiError.cjs"),r=require("./JsonRpcError.cjs");exports.estimateGas=async({params:e,account:a,authentication:o,backendClient:n,policyId:i})=>{const c=await(async(e,a,o,n,i)=>{const c=e.map(t=>{if(!t.to)throw new r.JsonRpcError(r.RpcErrorCode.INVALID_PARAMS,'eth_estimateGas requires a "to" field');return{to:String(t.to),data:t.data?String(t.data):void 0,value:t.value?String(t.value):void 0}});return t.withApiError(async()=>(await a.transactionIntentsApi.estimateTransactionIntentCost({createTransactionIntentRequest:{policy:i,chainId:o.chainId,interactions:c}},{headers:n.thirdPartyProvider?{authorization:`Bearer ${a.config.backend.accessToken}`,"x-player-token":n.token,"x-auth-provider":n.thirdPartyProvider,"x-token-type":n.thirdPartyTokenType}:{authorization:`Bearer ${n.token}`,"x-project-key":String(a.config.backend.accessToken)}})).data,{context:"operation"})})(e,n,a,o,i).catch(t=>{throw new r.JsonRpcError(r.RpcErrorCode.TRANSACTION_REJECTED,t.message)});return c.estimatedTXGas};
1
+ "use strict";var t=require("../../core/errors/withApiError.cjs"),r=require("./JsonRpcError.cjs");exports.estimateGas=async({params:e,account:a,authentication:o,backendClient:n,feeSponsorshipId:i})=>{const s=await(async(e,a,o,n,i)=>{const s=e.map(t=>{if(!t.to)throw new r.JsonRpcError(r.RpcErrorCode.INVALID_PARAMS,'eth_estimateGas requires a "to" field');return{to:String(t.to),data:t.data?String(t.data):void 0,value:t.value?String(t.value):void 0}});return t.withApiError(async()=>(await a.transactionIntentsApi.estimateTransactionIntentCost({createTransactionIntentRequest:{policy:i,chainId:o.chainId,interactions:s}},{headers:n.thirdPartyProvider?{authorization:`Bearer ${a.config.backend.accessToken}`,"x-player-token":n.token,"x-auth-provider":n.thirdPartyProvider,"x-token-type":n.thirdPartyTokenType}:{authorization:`Bearer ${n.token}`,"x-project-key":String(a.config.backend.accessToken)}})).data,{context:"operation"})})(e,n,a,o,i).catch(t=>{throw new r.JsonRpcError(r.RpcErrorCode.TRANSACTION_REJECTED,t.message)});return s.estimatedTXGas};
@@ -1 +1 @@
1
- "use strict";var e=require("../../core/configuration/account.cjs"),t=require("../../core/configuration/authentication.cjs"),r=require("../../types/types.cjs"),a=require("../../utils/chains/index.cjs"),i=require("../../utils/crypto.cjs"),s=require("../../utils/typedEventEmitter.cjs"),o=require("./addEthereumChain.cjs"),n=require("./estimateGas.cjs"),c=require("./getAssets.cjs"),h=require("./getCallsStatus.cjs"),d=require("./JsonRpcError.cjs"),u=require("./personalSign.cjs"),p=require("./registerSession.cjs"),l=require("./revokeSession.cjs"),w=require("./sendCallSync.cjs"),m=require("./sendCalls.cjs"),g=require("./signTypedDataV4.cjs"),E=require("./types.cjs"),A=require("./walletHelpers.cjs");exports.EvmProvider=class{#e;#t;#r;#a;updatePolicy(e){this.#t=e}#i;#s;#o=null;#n;isOpenfort=!0;#c;constructor({storage:e,backendApiClients:t,openfortEventEmitter:a,policyId:i,ensureSigner:o,chains:n,validateAndRefreshSession:c}){this.#c=o,this.#e=e,this.#r=n,this.#t=i,this.#i=c,this.#n=t,this.#s=new s,a.on(r.OpenfortEvents.ON_LOGOUT,this.#h),a.on(r.OpenfortEvents.ON_SWITCH_ACCOUNT,this.#d)}#u=async()=>(this.#a||(this.#a=await this.#c()),this.#a);#h=async()=>{this.#a=void 0,this.#s.emit(E.ProviderEvent.DISCONNECT,{code:4900,message:"Disconnected"}),this.#s.emit(E.ProviderEvent.ACCOUNTS_CHANGED,[])};#d=async e=>{this.#s.emit(E.ProviderEvent.ACCOUNTS_CHANGED,[e])};async getRpcProvider(){if(!this.#o){const t=await e.Account.fromStorage(this.#e),r=t?.chainId||8453;await import("@ethersproject/providers").then(e=>{const t=this.#r?this.#r[r]:void 0;this.#o=new e.StaticJsonRpcProvider(t??a.defaultChainRpcs[r])})}if(!this.#o)throw new Error("RPC provider not initialized");return this.#o}async#p(s){switch(s.method){case"eth_accounts":{const t=await e.Account.fromStorage(this.#e);return t?[t.address]:[]}case"eth_requestAccounts":{const t=await e.Account.fromStorage(this.#e);if(t){const e=await this.getRpcProvider(),{chainId:r}=await e.detectNetwork();return this.#s.emit(E.ProviderEvent.ACCOUNTS_CONNECT,{chainId:i.numberToHex(r)}),[t.address]}throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer.")}case"eth_signTransaction":{const r=await e.Account.fromStorage(this.#e),a=await this.#u(),i=await t.Authentication.fromStorage(this.#e);if(!r||!i)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");const o=await this.getRpcProvider(),{chainId:n}=await o.detectNetwork(),[c]=s.params||[];c.chainId||(c.chainId=n.toString());const h=A.parseTransactionRequest(c),{serialize:u}=await import("@ethersproject/transactions"),p=e=>({legacy:0,eip2930:1,eip1559:2}[e]),{gas:l,...w}=h,m={...w,gasLimit:l,to:h.to??void 0,type:p(h.type)},g=u(m),{keccak256:E}=await import("@ethersproject/keccak256"),R=E(g);await this.#i();const v=await a.sign(R,!1,!1),{splitSignature:f}=await import("@ethersproject/bytes");return u(m,f(v))}case"eth_sendTransaction":{const[a,i,o]=await Promise.all([e.Account.fromStorage(this.#e),this.#u(),t.Authentication.fromStorage(this.#e)]);if(!a||!o)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");if(await this.#i(),a?.accountType===r.AccountTypeEnum.EOA){const[e]=s.params||[],t=await this.getRpcProvider(),r=await A.prepareEOATransaction(e,t,a.address),i=await this.#p({method:"eth_signTransaction",params:[r]});return this.#p({method:"eth_sendRawTransaction",params:[i]})}return(await w.sendCallsSync({params:s.params||[],signer:i,account:a,authentication:o,backendClient:this.#n,rpcProvider:await this.getRpcProvider(),policyId:this.#t})).receipt.transactionHash}case"eth_sendRawTransactionSync":{const[a,i,o]=await Promise.all([e.Account.fromStorage(this.#e),this.#u(),t.Authentication.fromStorage(this.#e)]);if(!a||!o)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");if(a?.accountType===r.AccountTypeEnum.EOA)throw new d.JsonRpcError(d.ProviderErrorCode.UNSUPPORTED_METHOD,`${s.method}: Method not supported`);return await this.#i(),await w.sendCallsSync({params:s.params||[],signer:i,account:a,authentication:o,backendClient:this.#n,rpcProvider:await this.getRpcProvider(),policyId:this.#t})}case"eth_estimateGas":{const r=await e.Account.fromStorage(this.#e),a=await t.Authentication.fromStorage(this.#e);if(!r||!a)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#i(),await n.estimateGas({params:s.params||[],account:r,authentication:a,backendClient:this.#n,policyId:this.#t})}case"eth_signTypedData":case"eth_signTypedData_v4":{const t=await e.Account.fromStorage(this.#e),r=await this.#u();if(!t)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");await this.#i();const a=await this.getRpcProvider();return await g.signTypedDataV4({method:s.method,params:s.params||[],signer:r,implementationType:t.implementationType||t.type,rpcProvider:a,account:t})}case"personal_sign":{const t=await e.Account.fromStorage(this.#e);if(!t)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");const r=await this.#u();return await this.#i(),await u.personalSign({params:s.params||[],signer:r,account:t})}case"eth_chainId":{const e=await this.getRpcProvider(),{chainId:t}=await e.detectNetwork();return i.numberToHex(t)}case"wallet_switchEthereumChain":{const e=await this.#u();if(!s.params||!Array.isArray(s.params)||0===s.params.length)throw new d.JsonRpcError(d.RpcErrorCode.INVALID_PARAMS,"Invalid parameters for wallet_switchEthereumChain");await this.#i();try{const t=parseInt(s.params[0].chainId,16);await e.switchChain({chainId:t}),await import("@ethersproject/providers").then(e=>{const r=this.#r?this.#r[t]:void 0;this.#o=new e.StaticJsonRpcProvider(r??a.defaultChainRpcs[t])}),this.#s.emit(E.ProviderEvent.CHAIN_CHANGED,i.numberToHex(t))}catch(e){const t=e;throw new d.JsonRpcError(d.RpcErrorCode.INTERNAL_ERROR,`Failed to switch chain: ${t.message}`)}return null}case"wallet_addEthereumChain":{await this.#u();const e=await this.getRpcProvider();return await o.addEthereumChain({params:s.params||[],rpcProvider:e,storage:this.#e})}case"wallet_showCallsStatus":return null;case"wallet_getCallsStatus":{const a=await e.Account.fromStorage(this.#e);if(a?.accountType===r.AccountTypeEnum.EOA)throw new d.JsonRpcError(d.ProviderErrorCode.UNSUPPORTED_METHOD,`${s.method}: Method not supported`);const i=await t.Authentication.fromStorage(this.#e);if(!a||!i)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#i(),await h.getCallStatus({params:s.params||{},authentication:i,backendClient:this.#n})}case"wallet_sendCalls":{const[a,i,o]=await Promise.all([e.Account.fromStorage(this.#e),this.#u(),t.Authentication.fromStorage(this.#e)]);if(a?.accountType===r.AccountTypeEnum.EOA)throw new d.JsonRpcError(d.ProviderErrorCode.UNSUPPORTED_METHOD,`${s.method}: Method not supported`);if(!a||!o)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");await this.#i();return await m.sendCalls({params:s.params?s.params[0].calls:[],signer:i,account:a,authentication:o,backendClient:this.#n,rpcProvider:await this.getRpcProvider(),policyId:this.#t})}case"wallet_grantPermissions":{const a=await e.Account.fromStorage(this.#e);if(a?.accountType===r.AccountTypeEnum.EOA)throw new d.JsonRpcError(d.ProviderErrorCode.UNSUPPORTED_METHOD,`${s.method}: Method not supported`);const i=await this.#u(),o=await t.Authentication.fromStorage(this.#e);if(!a||!o)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#i(),await p.registerSession({params:s.params||[],signer:i,account:a,authentication:o,backendClient:this.#n,policyId:this.#t})}case"wallet_revokePermissions":{const r=await e.Account.fromStorage(this.#e),a=await this.#u(),i=await t.Authentication.fromStorage(this.#e);if(!r||!i)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#i(),await l.revokeSession({params:s.params||[],signer:a,account:r,authentication:i,backendClient:this.#n,policyId:this.#t})}case"wallet_getCapabilities":{const t=await e.Account.fromStorage(this.#e);if(t?.accountType===r.AccountTypeEnum.EOA)throw new d.JsonRpcError(d.ProviderErrorCode.UNSUPPORTED_METHOD,`${s.method}: Method not supported`);const a=await this.getRpcProvider(),{chainId:o}=await a.detectNetwork();return{[i.numberToHex(o)]:{permissions:{supported:!0,signerTypes:["account","key"],keyTypes:["secp256k1"],permissionTypes:["contract-calls"]},paymasterService:{supported:!0},atomicBatch:{supported:!0}}}}case"wallet_getAssets":{const r=await e.Account.fromStorage(this.#e),a=await t.Authentication.fromStorage(this.#e);if(!r||!a)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#i(),await c.getAssets({params:s.params?.[0],account:r,authentication:a,backendClient:this.#n})}case"eth_gasPrice":case"eth_getBalance":case"eth_sendRawTransaction":case"eth_getCode":case"eth_getStorageAt":case"eth_call":case"eth_blockNumber":case"eth_getBlockByHash":case"eth_getBlockByNumber":case"eth_getTransactionByHash":case"eth_getTransactionReceipt":case"eth_getTransactionCount":return(await this.getRpcProvider()).send(s.method,s.params||[]);default:throw new d.JsonRpcError(d.ProviderErrorCode.UNSUPPORTED_METHOD,`${s.method}: Method not supported`)}}async request(e){try{return this.#p(e)}catch(e){if(e instanceof d.JsonRpcError)throw e;if(e instanceof Error)throw new d.JsonRpcError(d.RpcErrorCode.INTERNAL_ERROR,e.message);throw new d.JsonRpcError(d.RpcErrorCode.INTERNAL_ERROR,"Internal error")}}on(e,t){this.#s.on(e,t)}removeListener(e,t){this.#s.off(e,t)}};
1
+ "use strict";var e=require("../../core/configuration/account.cjs"),t=require("../../core/configuration/authentication.cjs"),r=require("../../types/types.cjs"),s=require("../../utils/chains/index.cjs"),a=require("../../utils/crypto.cjs"),i=require("../../utils/typedEventEmitter.cjs"),o=require("./addEthereumChain.cjs"),n=require("./estimateGas.cjs"),c=require("./getAssets.cjs"),h=require("./getCallsStatus.cjs"),d=require("./JsonRpcError.cjs"),p=require("./personalSign.cjs"),u=require("./registerSession.cjs"),w=require("./revokeSession.cjs"),l=require("./sendCallSync.cjs"),m=require("./sendCalls.cjs"),g=require("./signTypedDataV4.cjs"),E=require("./types.cjs"),A=require("./walletHelpers.cjs");exports.EvmProvider=class{#e;#t;#r;#s;updateFeeSponsorship(e){this.#t=e}#a;#i;#o=null;#n;isOpenfort=!0;#c;constructor({storage:e,backendApiClients:t,openfortEventEmitter:s,feeSponsorshipId:a,ensureSigner:o,chains:n,validateAndRefreshSession:c}){this.#c=o,this.#e=e,this.#r=n,this.#t=a,this.#a=c,this.#n=t,this.#i=new i,s.on(r.OpenfortEvents.ON_LOGOUT,this.#h),s.on(r.OpenfortEvents.ON_SWITCH_ACCOUNT,this.#d)}#p=async()=>(this.#s||(this.#s=await this.#c()),this.#s);#h=async()=>{this.#s=void 0,this.#i.emit(E.ProviderEvent.DISCONNECT,{code:4900,message:"Disconnected"}),this.#i.emit(E.ProviderEvent.ACCOUNTS_CHANGED,[])};#d=async e=>{this.#i.emit(E.ProviderEvent.ACCOUNTS_CHANGED,[e])};async getRpcProvider(){if(!this.#o){const t=await e.Account.fromStorage(this.#e),r=t?.chainId||(this.#r?Number(Object.keys(this.#r)[0]):void 0)||8453;await import("@ethersproject/providers").then(e=>{const t=this.#r?this.#r[r]:void 0;this.#o=new e.StaticJsonRpcProvider(t??s.defaultChainRpcs[r])})}if(!this.#o)throw new Error("RPC provider not initialized");return this.#o}async#u(i){switch(i.method){case"eth_accounts":{const t=await e.Account.fromStorage(this.#e);return t?[t.address]:[]}case"eth_requestAccounts":{const t=await e.Account.fromStorage(this.#e);if(t){const e=await this.getRpcProvider(),{chainId:r}=await e.detectNetwork();return this.#i.emit(E.ProviderEvent.ACCOUNTS_CONNECT,{chainId:a.numberToHex(r)}),[t.address]}throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer.")}case"eth_signTransaction":{const r=await e.Account.fromStorage(this.#e),s=await this.#p(),a=await t.Authentication.fromStorage(this.#e);if(!r||!a)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");const o=await this.getRpcProvider(),{chainId:n}=await o.detectNetwork(),[c]=i.params||[];c.chainId||(c.chainId=n.toString());const h=A.parseTransactionRequest(c),{serialize:p}=await import("@ethersproject/transactions"),u=e=>({legacy:0,eip2930:1,eip1559:2}[e]),{gas:w,...l}=h,m={...l,gasLimit:w,to:h.to??void 0,type:u(h.type)},g=p(m),{keccak256:E}=await import("@ethersproject/keccak256"),f=E(g);await this.#a();const S=await s.sign(f,!1,!1),{splitSignature:R}=await import("@ethersproject/bytes");return p(m,R(S))}case"eth_sendTransaction":{const[s,a,o]=await Promise.all([e.Account.fromStorage(this.#e),this.#p(),t.Authentication.fromStorage(this.#e)]);if(!s||!o)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");if(await this.#a(),s?.accountType===r.AccountTypeEnum.EOA){const[e]=i.params||[],t=await this.getRpcProvider(),r=await A.prepareEOATransaction(e,t,s.address),a=await this.#u({method:"eth_signTransaction",params:[r]});return this.#u({method:"eth_sendRawTransaction",params:[a]})}return(await l.sendCallsSync({params:i.params||[],signer:a,account:s,authentication:o,backendClient:this.#n,rpcProvider:await this.getRpcProvider(),feeSponsorshipId:this.#t})).receipt.transactionHash}case"eth_sendRawTransactionSync":{const[s,a,o]=await Promise.all([e.Account.fromStorage(this.#e),this.#p(),t.Authentication.fromStorage(this.#e)]);if(!s||!o)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");if(s?.accountType===r.AccountTypeEnum.EOA)throw new d.JsonRpcError(d.ProviderErrorCode.UNSUPPORTED_METHOD,`${i.method}: Method not supported`);return await this.#a(),await l.sendCallsSync({params:i.params||[],signer:a,account:s,authentication:o,backendClient:this.#n,rpcProvider:await this.getRpcProvider(),feeSponsorshipId:this.#t})}case"eth_estimateGas":{const r=await e.Account.fromStorage(this.#e),s=await t.Authentication.fromStorage(this.#e);if(!r||!s)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#a(),await n.estimateGas({params:i.params||[],account:r,authentication:s,backendClient:this.#n,feeSponsorshipId:this.#t})}case"eth_signTypedData":case"eth_signTypedData_v4":{const t=await e.Account.fromStorage(this.#e),r=await this.#p();if(!t)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");await this.#a();const s=await this.getRpcProvider();return await g.signTypedDataV4({method:i.method,params:i.params||[],signer:r,implementationType:t.implementationType||t.type,rpcProvider:s,account:t})}case"personal_sign":{const t=await e.Account.fromStorage(this.#e);if(!t)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");const r=await this.#p();return await this.#a(),await p.personalSign({params:i.params||[],signer:r,account:t})}case"eth_chainId":{const e=await this.getRpcProvider(),{chainId:t}=await e.detectNetwork();return a.numberToHex(t)}case"wallet_switchEthereumChain":{const e=await this.#p();if(!i.params||!Array.isArray(i.params)||0===i.params.length)throw new d.JsonRpcError(d.RpcErrorCode.INVALID_PARAMS,"Invalid parameters for wallet_switchEthereumChain");await this.#a();try{const t=parseInt(i.params[0].chainId,16);await e.switchChain({chainId:t}),await import("@ethersproject/providers").then(e=>{const r=this.#r?this.#r[t]:void 0;this.#o=new e.StaticJsonRpcProvider(r??s.defaultChainRpcs[t])}),this.#i.emit(E.ProviderEvent.CHAIN_CHANGED,a.numberToHex(t))}catch(e){const t=e;throw new d.JsonRpcError(d.RpcErrorCode.INTERNAL_ERROR,`Failed to switch chain: ${t.message}`)}return null}case"wallet_addEthereumChain":{await this.#p();const e=await this.getRpcProvider();return await o.addEthereumChain({params:i.params||[],rpcProvider:e,storage:this.#e})}case"wallet_showCallsStatus":return null;case"wallet_getCallsStatus":{const s=await e.Account.fromStorage(this.#e);if(s?.accountType===r.AccountTypeEnum.EOA)throw new d.JsonRpcError(d.ProviderErrorCode.UNSUPPORTED_METHOD,`${i.method}: Method not supported`);const a=await t.Authentication.fromStorage(this.#e);if(!s||!a)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#a(),await h.getCallStatus({params:i.params||{},authentication:a,backendClient:this.#n})}case"wallet_sendCalls":{const[s,a,o]=await Promise.all([e.Account.fromStorage(this.#e),this.#p(),t.Authentication.fromStorage(this.#e)]);if(s?.accountType===r.AccountTypeEnum.EOA)throw new d.JsonRpcError(d.ProviderErrorCode.UNSUPPORTED_METHOD,`${i.method}: Method not supported`);if(!s||!o)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");await this.#a();return await m.sendCalls({params:i.params?i.params[0].calls:[],signer:a,account:s,authentication:o,backendClient:this.#n,rpcProvider:await this.getRpcProvider(),feeSponsorshipId:this.#t})}case"wallet_grantPermissions":{const s=await e.Account.fromStorage(this.#e);if(s?.accountType===r.AccountTypeEnum.EOA)throw new d.JsonRpcError(d.ProviderErrorCode.UNSUPPORTED_METHOD,`${i.method}: Method not supported`);const a=await this.#p(),o=await t.Authentication.fromStorage(this.#e);if(!s||!o)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#a(),await u.registerSession({params:i.params||[],signer:a,account:s,authentication:o,backendClient:this.#n,feeSponsorshipId:this.#t})}case"wallet_revokePermissions":{const r=await e.Account.fromStorage(this.#e),s=await this.#p(),a=await t.Authentication.fromStorage(this.#e);if(!r||!a)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#a(),await w.revokeSession({params:i.params||[],signer:s,account:r,authentication:a,backendClient:this.#n,feeSponsorshipId:this.#t})}case"wallet_getCapabilities":{const t=await e.Account.fromStorage(this.#e);if(t?.accountType===r.AccountTypeEnum.EOA)throw new d.JsonRpcError(d.ProviderErrorCode.UNSUPPORTED_METHOD,`${i.method}: Method not supported`);const s=await this.getRpcProvider(),{chainId:o}=await s.detectNetwork();return{[a.numberToHex(o)]:{permissions:{supported:!0,signerTypes:["account","key"],keyTypes:["secp256k1"],permissionTypes:["contract-calls"]},paymasterService:{supported:!0},atomicBatch:{supported:!0}}}}case"wallet_getAssets":{const r=await e.Account.fromStorage(this.#e),s=await t.Authentication.fromStorage(this.#e);if(!r||!s)throw new d.JsonRpcError(d.ProviderErrorCode.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#a(),await c.getAssets({params:i.params?.[0],account:r,authentication:s,backendClient:this.#n})}case"eth_gasPrice":case"eth_getBalance":case"eth_sendRawTransaction":case"eth_getCode":case"eth_getStorageAt":case"eth_call":case"eth_blockNumber":case"eth_getBlockByHash":case"eth_getBlockByNumber":case"eth_getTransactionByHash":case"eth_getTransactionReceipt":case"eth_getTransactionCount":return(await this.getRpcProvider()).send(i.method,i.params||[]);default:throw new d.JsonRpcError(d.ProviderErrorCode.UNSUPPORTED_METHOD,`${i.method}: Method not supported`)}}async request(e){try{return this.#u(e)}catch(e){if(e instanceof d.JsonRpcError)throw e;if(e instanceof Error)throw new d.JsonRpcError(d.RpcErrorCode.INTERNAL_ERROR,e.message);throw new d.JsonRpcError(d.RpcErrorCode.INTERNAL_ERROR,"Internal error")}}on(e,t){this.#i.on(e,t)}removeListener(e,t){this.#i.off(e,t)}};
@@ -1 +1 @@
1
- "use strict";var t=require("../../core/errors/withApiError.cjs"),e=require("../../types/types.cjs"),i=require("./JsonRpcError.cjs");function r(t){return{data:(()=>{if("token-allowance"===t.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"token-allowance policy is not supported with this account implementation.");if("gas-limit"===t.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"gas-limit policy is not supported with this account implementation.");if("rate-limit"===t.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"rate-limit policy is not supported with this account implementation.");return t.data})(),type:t.type.custom}}function o(t){if("native-token-transfer"===t.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"native-token-transfer permission is not supported with this account implementation.");if("rate-limit"===t.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"rate-limit permission is not supported with this account implementation.");if("gas-limit"===t.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"gas-limit permission is not supported with this account implementation.");return{...t,policies:t?.policies?.map(r),required:t.required??!1,type:"string"==typeof t.type?t.type:t.type.custom}}function n(t){return{expiry:t.validUntil?Number(t.validUntil):0,grantedPermissions:t.whitelist?t.whitelist.map(e=>({type:"contract-call",data:{address:e,calls:[]},policies:[{data:{limit:t.limit},type:{custom:"usage-limit"}}]})):[],permissionsContext:t.id}}exports.registerSession=async({params:r,signer:s,account:a,authentication:c,backendClient:p,policyId:l})=>{const d=await(async(e,r,n,s,a)=>{const c=e[0],p=Math.floor(Date.now()/1e3),l=Math.floor(new Date(Date.now()+1e3*c.expiry).getTime()/1e3),d=c.permissions.map(o),u=d.filter(t=>"contract-call"===t.type||"erc20-token-transfer"===t.type||"erc721-token-transfer"===t.type||"erc1155-token-transfer"===t.type).map(t=>t.data.address);let m,y=d.find(t=>"call-limit"===t.type)?.data;if(y=d[0]?.policies?.find(t=>"call-limit"===t.type)?.data?.limit,"signer"in c&&c.signer){if("keys"===c.signer.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"Multi-key signers are not supported for session creation");"key"!==c.signer.type&&"account"!==c.signer.type||(m=c.signer.data.id)}else"account"in c&&c.account&&(m=c.account);if(!m)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"Failed to request permissions - missing session address");const h=((t,e,i,r,o,n=!1,s,a,c)=>{const p={address:t,chainId:e,validAfter:i,validUntil:r,optimistic:n,whitelist:s,account:c};return o&&(p.policy=o),a&&(p.limit=a),p})(m,n.chainId,p,l,a,!1,u,y,n.id);return t.withApiError(async()=>(await r.sessionsApi.createSession({createSessionRequest:h},{headers:s.thirdPartyProvider?{authorization:`Bearer ${r.config.backend.accessToken}`,"x-player-token":s.token,"x-auth-provider":s.thirdPartyProvider,"x-token-type":s.thirdPartyTokenType}:{authorization:`Bearer ${s.token}`,"x-project-key":String(r.config.backend.accessToken)}})).data,{context:"operation"})})(r,p,a,c,l).catch(t=>{throw new i.JsonRpcError(i.RpcErrorCode.TRANSACTION_REJECTED,t.message)});if(d?.nextAction?.payload?.signableHash){let r;r=[300,324].includes(a.chainId)||a.implementationType&&[e.AccountType.CALIBUR].includes(a.implementationType)?await s.sign(d.nextAction.payload.signableHash,!1,!1):await s.sign(d.nextAction.payload.signableHash);return n(await t.withApiError(async()=>(await p.sessionsApi.signatureSession({id:d.id,signatureRequest:{signature:r}})).data,{context:"operation"}).catch(t=>{throw new i.JsonRpcError(i.RpcErrorCode.TRANSACTION_REJECTED,t.message)}))}if(!1===d.isActive)throw new i.JsonRpcError(i.RpcErrorCode.TRANSACTION_REJECTED,"Failed to grant permissions");return n(d)};
1
+ "use strict";var t=require("../../core/errors/withApiError.cjs"),e=require("../../types/types.cjs"),i=require("./JsonRpcError.cjs");function r(t){return{data:(()=>{if("token-allowance"===t.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"token-allowance policy is not supported with this account implementation.");if("gas-limit"===t.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"gas-limit policy is not supported with this account implementation.");if("rate-limit"===t.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"rate-limit policy is not supported with this account implementation.");return t.data})(),type:t.type.custom}}function o(t){if("native-token-transfer"===t.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"native-token-transfer permission is not supported with this account implementation.");if("rate-limit"===t.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"rate-limit permission is not supported with this account implementation.");if("gas-limit"===t.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"gas-limit permission is not supported with this account implementation.");return{...t,policies:t?.policies?.map(r),required:t.required??!1,type:"string"==typeof t.type?t.type:t.type.custom}}function n(t){return{expiry:t.validUntil?Number(t.validUntil):0,grantedPermissions:t.whitelist?t.whitelist.map(e=>({type:"contract-call",data:{address:e,calls:[]},policies:[{data:{limit:t.limit},type:{custom:"usage-limit"}}]})):[],permissionsContext:t.id}}exports.registerSession=async({params:r,signer:s,account:a,authentication:c,backendClient:p,feeSponsorshipId:l})=>{const d=await(async(e,r,n,s,a)=>{const c=e[0],p=Math.floor(Date.now()/1e3),l=Math.floor(new Date(Date.now()+1e3*c.expiry).getTime()/1e3),d=c.permissions.map(o),u=d.filter(t=>"contract-call"===t.type||"erc20-token-transfer"===t.type||"erc721-token-transfer"===t.type||"erc1155-token-transfer"===t.type).map(t=>t.data.address);let m,y=d.find(t=>"call-limit"===t.type)?.data;if(y=d[0]?.policies?.find(t=>"call-limit"===t.type)?.data?.limit,"signer"in c&&c.signer){if("keys"===c.signer.type)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"Multi-key signers are not supported for session creation");"key"!==c.signer.type&&"account"!==c.signer.type||(m=c.signer.data.id)}else"account"in c&&c.account&&(m=c.account);if(!m)throw new i.JsonRpcError(i.RpcErrorCode.INVALID_PARAMS,"Failed to request permissions - missing session address");const h=((t,e,i,r,o,n=!1,s,a,c)=>{const p={address:t,chainId:e,validAfter:i,validUntil:r,optimistic:n,whitelist:s,account:c};return o&&(p.policy=o),a&&(p.limit=a),p})(m,n.chainId,p,l,a,!1,u,y,n.id);return t.withApiError(async()=>(await r.sessionsApi.createSession({createSessionRequest:h},{headers:s.thirdPartyProvider?{authorization:`Bearer ${r.config.backend.accessToken}`,"x-player-token":s.token,"x-auth-provider":s.thirdPartyProvider,"x-token-type":s.thirdPartyTokenType}:{authorization:`Bearer ${s.token}`,"x-project-key":String(r.config.backend.accessToken)}})).data,{context:"operation"})})(r,p,a,c,l).catch(t=>{throw new i.JsonRpcError(i.RpcErrorCode.TRANSACTION_REJECTED,t.message)});if(d?.nextAction?.payload?.signableHash){let r;r=[300,324].includes(a.chainId)||a.implementationType&&[e.AccountType.CALIBUR].includes(a.implementationType)?await s.sign(d.nextAction.payload.signableHash,!1,!1):await s.sign(d.nextAction.payload.signableHash);return n(await t.withApiError(async()=>(await p.sessionsApi.signatureSession({id:d.id,signatureRequest:{signature:r}})).data,{context:"operation"}).catch(t=>{throw new i.JsonRpcError(i.RpcErrorCode.TRANSACTION_REJECTED,t.message)}))}if(!1===d.isActive)throw new i.JsonRpcError(i.RpcErrorCode.TRANSACTION_REJECTED,"Failed to grant permissions");return n(d)};
@@ -1 +1 @@
1
- "use strict";var e=require("../../core/errors/withApiError.cjs"),r=require("../../types/types.cjs"),t=require("./JsonRpcError.cjs");exports.revokeSession=async({params:n,signer:i,account:a,authentication:o,backendClient:s,policyId:c})=>{const p=n[0];if(!p.permissionContext)return await i.disconnect(),{};const d=await(async(r,t,n,i,a)=>{const o=((e,r,t,n)=>{const i={address:e,chainId:r,account:n};return t&&(i.policy=t),i})(r.permissionContext,n.chainId,a,n.id);return e.withApiError(async()=>(await t.sessionsApi.revokeSession({revokeSessionRequest:o},{headers:i.thirdPartyProvider?{authorization:`Bearer ${t.config.backend.accessToken}`,"x-player-token":i.token,"x-auth-provider":i.thirdPartyProvider,"x-token-type":i.thirdPartyTokenType}:{authorization:`Bearer ${i.token}`,"x-project-key":String(t.config.backend.accessToken)}})).data,{context:"operation"})})(p,s,a,o,c).catch(e=>{throw new t.JsonRpcError(t.RpcErrorCode.TRANSACTION_REJECTED,e.message)});if(d?.nextAction?.payload?.signableHash){let e;e=[300,324].includes(a.chainId)||a.implementationType&&[r.AccountType.CALIBUR].includes(a.implementationType)?await i.sign(d.nextAction.payload.signableHash,!1,!1):await i.sign(d.nextAction.payload.signableHash);return(await s.sessionsApi.signatureSession({id:d.id,signatureRequest:{signature:e}}).catch(e=>{throw new t.JsonRpcError(t.RpcErrorCode.TRANSACTION_REJECTED,e.message)})).data}return d};
1
+ "use strict";var e=require("../../core/errors/withApiError.cjs"),r=require("../../types/types.cjs"),n=require("./JsonRpcError.cjs");exports.revokeSession=async({params:t,signer:i,account:o,authentication:s,backendClient:a,feeSponsorshipId:c})=>{const p=t[0];if(!p.permissionContext)return await i.disconnect(),{};const d=await(async(r,n,t,i,o)=>{const s=((e,r,n,t)=>{const i={address:e,chainId:r,account:t};return n&&(i.policy=n),i})(r.permissionContext,t.chainId,o,t.id);return e.withApiError(async()=>(await n.sessionsApi.revokeSession({revokeSessionRequest:s},{headers:i.thirdPartyProvider?{authorization:`Bearer ${n.config.backend.accessToken}`,"x-player-token":i.token,"x-auth-provider":i.thirdPartyProvider,"x-token-type":i.thirdPartyTokenType}:{authorization:`Bearer ${i.token}`,"x-project-key":String(n.config.backend.accessToken)}})).data,{context:"operation"})})(p,a,o,s,c).catch(e=>{throw new n.JsonRpcError(n.RpcErrorCode.TRANSACTION_REJECTED,e.message)});if(d?.nextAction?.payload?.signableHash){let e;e=[300,324].includes(o.chainId)||o.implementationType&&[r.AccountType.CALIBUR].includes(o.implementationType)?await i.sign(d.nextAction.payload.signableHash,!1,!1):await i.sign(d.nextAction.payload.signableHash);return(await a.sessionsApi.signatureSession({id:d.id,signatureRequest:{signature:e}}).catch(e=>{throw new n.JsonRpcError(n.RpcErrorCode.TRANSACTION_REJECTED,e.message)})).data}return d};
@@ -1 +1 @@
1
- "use strict";var e=require("../../core/errors/withApiError.cjs"),r=require("../../types/types.cjs"),t=require("../../utils/authorization.cjs"),o=require("./JsonRpcError.cjs");const a=e=>{const r=e?.logs?.[0];return{blockHash:r?.blockHash,blockNumber:e?.blockNumber?.toString(),contractAddress:void 0,cumulativeGasUsed:e?.gasUsed,effectiveGasPrice:e?.gasFee,from:void 0,gasUsed:e?.gasUsed,logs:e?.logs||[],logsBloom:void 0,status:1===e?.status?"success":0===e?.status?"reverted":void 0,to:e?.to,transactionHash:e?.transactionHash,transactionIndex:r?.transactionIndex,type:"eip1559",blobGasPrice:void 0,blobGasUsed:void 0,root:void 0}};async function n(e,r){try{const t=await e.getCode(r);return"0x"!==t&&t.length>2}catch{return!1}}exports.sendCallsSync=async({params:s,signer:i,account:c,authentication:d,backendClient:p,rpcProvider:u,policyId:l})=>{const E=s[0]?.capabilities?.paymasterService?.policy??l;let h;if(c.accountType===r.AccountTypeEnum.DELEGATED_ACCOUNT){const[e,r]=await Promise.all([n(u,c.address),u.getTransactionCount(c.address)]);if(!e){const e=await t.prepareAndSignAuthorization({signer:i,accountAddress:c.address,contractAddress:c.implementationAddress,chainId:c.chainId,nonce:r});h=t.serializeSignedAuthorization(e)}}const A=await(async(r,t,a,n,s,i)=>{const c=r.map(e=>{if(!e.to)throw new o.JsonRpcError(o.RpcErrorCode.INVALID_PARAMS,'wallet_sendCalls requires a "to" field');return{to:String(e.to),data:e.data?String(e.data):void 0,value:e.value?String(e.value):void 0}});return e.withApiError(async()=>(await t.transactionIntentsApi.createTransactionIntent({createTransactionIntentRequest:{account:a.id,policy:s,signedAuthorization:i,chainId:a.chainId,interactions:c}},{headers:n.thirdPartyProvider?{authorization:`Bearer ${t.config.backend.accessToken}`,"x-player-token":n.token,"x-auth-provider":n.thirdPartyProvider,"x-token-type":n.thirdPartyTokenType}:{authorization:`Bearer ${n.token}`,"x-project-key":String(t.config.backend.accessToken)}})).data,{context:"operation"})})(s,p,c,d,E,h).catch(e=>{throw new o.JsonRpcError(o.RpcErrorCode.TRANSACTION_REJECTED,e.message)});if(A.response?.error.reason)throw new o.JsonRpcError(o.RpcErrorCode.TRANSACTION_REJECTED,A.response?.error.reason);if(A?.nextAction?.payload?.signableHash){let t;t=[300,324].includes(c.chainId)||c.implementationType&&[r.AccountType.CALIBUR].includes(c.implementationType)?await i.sign(A.nextAction.payload.signableHash,!1,!1):await i.sign(A.nextAction.payload.signableHash);const n=await e.withApiError(async()=>await p.transactionIntentsApi.signature({id:A.id,signatureRequest:{signature:t}}),{context:"operation"}).catch(e=>{throw new o.JsonRpcError(o.RpcErrorCode.TRANSACTION_REJECTED,e.message)});if(0===n.data.response?.status)throw new o.JsonRpcError(o.RpcErrorCode.TRANSACTION_REJECTED,n.data.response?.error.reason);if(!n.data.response)throw new o.JsonRpcError(o.RpcErrorCode.TRANSACTION_REJECTED,"No transaction response received");return{id:A.id,receipt:a(n.data.response)}}if(!A.response)throw new o.JsonRpcError(o.RpcErrorCode.TRANSACTION_REJECTED,"No transaction response received");return{id:A.id,receipt:a(A.response)}};
1
+ "use strict";var e=require("../../core/errors/withApiError.cjs"),r=require("../../types/types.cjs"),t=require("../../utils/authorization.cjs"),o=require("./JsonRpcError.cjs");const a=e=>{const r=e?.logs?.[0];return{blockHash:r?.blockHash,blockNumber:e?.blockNumber?.toString(),contractAddress:void 0,cumulativeGasUsed:e?.gasUsed,effectiveGasPrice:e?.gasFee,from:void 0,gasUsed:e?.gasUsed,logs:e?.logs||[],logsBloom:void 0,status:1===e?.status?"success":0===e?.status?"reverted":void 0,to:e?.to,transactionHash:e?.transactionHash,transactionIndex:r?.transactionIndex,type:"eip1559",blobGasPrice:void 0,blobGasUsed:void 0,root:void 0}};async function n(e,r){try{const t=await e.getCode(r);return"0x"!==t&&t.length>2}catch{return!1}}exports.sendCallsSync=async({params:s,signer:i,account:c,authentication:d,backendClient:p,rpcProvider:u,feeSponsorshipId:l})=>{const E=s[0]?.capabilities?.paymasterService?.policy??l;let h;if(c.accountType===r.AccountTypeEnum.DELEGATED_ACCOUNT){const[e,r]=await Promise.all([n(u,c.address),u.getTransactionCount(c.address)]);if(!e){const e=await t.prepareAndSignAuthorization({signer:i,accountAddress:c.address,contractAddress:c.implementationAddress,chainId:c.chainId,nonce:r});h=t.serializeSignedAuthorization(e)}}const A=await(async(r,t,a,n,s,i)=>{const c=r.map(e=>{if(!e.to)throw new o.JsonRpcError(o.RpcErrorCode.INVALID_PARAMS,'wallet_sendCalls requires a "to" field');return{to:String(e.to),data:e.data?String(e.data):void 0,value:e.value?String(e.value):void 0}});return e.withApiError(async()=>(await t.transactionIntentsApi.createTransactionIntent({createTransactionIntentRequest:{account:a.id,policy:s,signedAuthorization:i,chainId:a.chainId,interactions:c}},{headers:n.thirdPartyProvider?{authorization:`Bearer ${t.config.backend.accessToken}`,"x-player-token":n.token,"x-auth-provider":n.thirdPartyProvider,"x-token-type":n.thirdPartyTokenType}:{authorization:`Bearer ${n.token}`,"x-project-key":String(t.config.backend.accessToken)}})).data,{context:"operation"})})(s,p,c,d,E,h).catch(e=>{throw new o.JsonRpcError(o.RpcErrorCode.TRANSACTION_REJECTED,e.message)});if(A.response?.error?.reason)throw new o.JsonRpcError(o.RpcErrorCode.TRANSACTION_REJECTED,A.response.error.reason);if(A?.nextAction?.payload?.signableHash){let t;t=[300,324].includes(c.chainId)||c.implementationType&&[r.AccountType.CALIBUR].includes(c.implementationType)?await i.sign(A.nextAction.payload.signableHash,!1,!1):await i.sign(A.nextAction.payload.signableHash);const n=await e.withApiError(async()=>await p.transactionIntentsApi.signature({id:A.id,signatureRequest:{signature:t}}),{context:"operation"}).catch(e=>{throw new o.JsonRpcError(o.RpcErrorCode.TRANSACTION_REJECTED,e.message)});if(0===n.data.response?.status)throw new o.JsonRpcError(o.RpcErrorCode.TRANSACTION_REJECTED,n.data.response?.error?.reason??"");if(!n.data.response)throw new o.JsonRpcError(o.RpcErrorCode.TRANSACTION_REJECTED,"No transaction response received");return{id:A.id,receipt:a(n.data.response)}}if(!A.response)throw new o.JsonRpcError(o.RpcErrorCode.TRANSACTION_REJECTED,"No transaction response received");return{id:A.id,receipt:a(A.response)}};
@@ -1 +1 @@
1
- "use strict";var a=require("./sendCallSync.cjs");exports.sendCalls=async({params:n,signer:c,account:e,authentication:i,backendClient:r,rpcProvider:s,policyId:t})=>(await a.sendCallsSync({params:n,signer:c,account:e,authentication:i,backendClient:r,rpcProvider:s,policyId:t})).id;
1
+ "use strict";var e=require("./sendCallSync.cjs");exports.sendCalls=async({params:n,signer:a,account:s,authentication:r,backendClient:i,rpcProvider:c,feeSponsorshipId:t})=>(await e.sendCallsSync({params:n,signer:a,account:s,authentication:r,backendClient:i,rpcProvider:c,feeSponsorshipId:t})).id;