@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.
- package/dist/cjs/packages/internal/openapi-clients/dist/index.cjs +1 -1
- package/dist/cjs/sdk/src/api/embeddedWallet.cjs +1 -1
- package/dist/cjs/sdk/src/version.cjs +1 -1
- package/dist/cjs/sdk/src/wallets/evm/estimateGas.cjs +1 -1
- package/dist/cjs/sdk/src/wallets/evm/evmProvider.cjs +1 -1
- package/dist/cjs/sdk/src/wallets/evm/registerSession.cjs +1 -1
- package/dist/cjs/sdk/src/wallets/evm/revokeSession.cjs +1 -1
- package/dist/cjs/sdk/src/wallets/evm/sendCallSync.cjs +1 -1
- package/dist/cjs/sdk/src/wallets/evm/sendCalls.cjs +1 -1
- package/dist/index.d.cts +280 -653
- package/dist/index.d.ts +280 -653
- package/dist/packages/internal/openapi-clients/dist/index.js +1 -1
- package/dist/sdk/src/api/embeddedWallet.js +1 -1
- package/dist/sdk/src/version.js +1 -1
- package/dist/sdk/src/wallets/evm/estimateGas.js +1 -1
- package/dist/sdk/src/wallets/evm/evmProvider.js +1 -1
- package/dist/sdk/src/wallets/evm/registerSession.js +1 -1
- package/dist/sdk/src/wallets/evm/revokeSession.js +1 -1
- package/dist/sdk/src/wallets/evm/sendCallSync.js +1 -1
- package/dist/sdk/src/wallets/evm/sendCalls.js +1 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"axios";import t from"axios-retry";const s="https://api.openfort.io".replace(/\/+$/,"");class n{basePath;axios;configuration;constructor(t,n=s,a=e){this.basePath=n,this.axios=a,t&&(this.configuration=t,this.basePath=t.basePath||this.basePath)}}class a extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const 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)};class x{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){}}}export{x as BackendApiClients,A as createConfig};
|
|
1
|
+
import e from"axios";import t from"axios-retry";const s="https://api.openfort.io".replace(/\/+$/,"");class n{basePath;axios;configuration;constructor(t,n=s,a=e){this.basePath=n,this.axios=a,t&&(this.configuration=t,this.basePath=t.basePath||this.basePath)}}class a extends Error{field;constructor(e,t){super(t),this.field=e,this.name="RequiredError"}}const i="https://example.com",o=function(e,t,s){if(null==s)throw new a(t,`Required parameter ${t} was null or undefined when calling ${e}.`)},r=async function(e,t){if(t&&t.accessToken){const s="function"==typeof t.accessToken?await t.accessToken():await t.accessToken;e.Authorization="Bearer "+s}};function 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)};class U{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){}}}export{U as BackendApiClients,A as createConfig};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{BackendApiClients as e}from"../../../packages/internal/openapi-clients/dist/index.js";import{ConfigurationError as t,AuthenticationError as r,SessionError as s,SignerError as a}from"../core/errors/openfortError.js";import{PasskeyHandler as i}from"../core/passkey/handler.js";import{SDKConfiguration as n}from"../core/config/config.js";import{Account as o}from"../core/configuration/account.js";import{Authentication as d}from"../core/configuration/authentication.js";import{OPENFORT_AUTH_ERROR_CODES as c}from"../core/errors/authErrorCodes.js";import{withApiError as h}from"../core/errors/withApiError.js";import{OpenfortEvents as m,RecoveryMethod as g,ChainTypeEnum as y,AccountTypeEnum as l,EmbeddedState as p}from"../types/types.js";import{debugLog as f}from"../utils/debug.js";import{observe as u}from"../utils/observe.js";import{EmbeddedSigner as w}from"../wallets/embedded.js";import{EvmProvider as A}from"../wallets/evm/evmProvider.js";import"../wallets/evm/types.js";import{announceProvider as E,openfortProviderInfo as v}from"../wallets/evm/provider/eip6963.js";import{signMessage as M}from"../wallets/evm/walletHelpers.js";import{IframeManager as D}from"../wallets/iframeManager.js";import{ReactNativeMessenger as I}from"../wallets/messaging/ReactNativeMessenger.js";import"../wallets/messaging/browserMessenger/backwardCompatibility.js";import T from"../wallets/messaging/browserMessenger/messengers/WindowMessenger.js";class S{storage;validateAndRefreshToken;ensureInitialized;eventEmitter;passkeyHandler;iframeManager=null;iframeManagerPromise=null;signer=null;signerPromise=null;provider=null;messagePoster=null;messenger=null;constructor(e,t,r,s,a){this.storage=e,this.validateAndRefreshToken=t,this.ensureInitialized=r,this.eventEmitter=s,this.passkeyHandler=a,this.eventEmitter.on(m.ON_LOGOUT,()=>{f("Handling logout event in EmbeddedWalletApi"),this.handleLogout()})}get backendApiClients(){const r=n.getInstance();if(!r)throw new t("Configuration not found");return new e({basePath:r.backendUrl,accessToken:r.baseConfiguration.publishableKey,nativeAppIdentifier:r.nativeAppIdentifier})}async getIframeManager(){if(f("[HANDSHAKE DEBUG] getIframeManager called"),this.iframeManager?.hasFailed&&(f("[HANDSHAKE DEBUG] Existing iframeManager has failed, clearing for recreation"),this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null),this.iframeManager)return f("[HANDSHAKE DEBUG] Returning existing iframeManager instance"),this.iframeManager;if(this.iframeManagerPromise)return f("[HANDSHAKE DEBUG] Returning existing iframeManagerPromise"),this.iframeManagerPromise;f("[HANDSHAKE DEBUG] Creating new iframeManager"),this.iframeManagerPromise=this.createIframeManager();try{return f("[HANDSHAKE DEBUG] Awaiting iframeManager creation"),this.iframeManager=await this.iframeManagerPromise,f("[HANDSHAKE DEBUG] IframeManager created successfully"),this.iframeManagerPromise=null,this.iframeManager}catch(e){throw f("[HANDSHAKE DEBUG] Error creating iframeManager:",e),this.iframeManagerPromise=null,this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null,e}}async createIframeManager(){f("[HANDSHAKE DEBUG] createIframeManager starting");const e=n.getInstance();if(!e)throw f("[HANDSHAKE DEBUG] Configuration not found"),new t("Configuration not found");let r;if(f("[HANDSHAKE DEBUG] Configuration found"),this.messagePoster)f("[HANDSHAKE DEBUG] Creating ReactNativeMessenger with messagePoster"),this.messenger&&(f("[HANDSHAKE DEBUG] Destroying old messenger before creating new one"),this.messenger.destroy()),this.messenger=new I(this.messagePoster),f("[HANDSHAKE DEBUG] Created new ReactNativeMessenger instance"),r=this.messenger;else{f("[HANDSHAKE DEBUG] Creating WindowMessenger for browser mode");const t=this.createIframe(e.iframeUrl),s=new URL(e.iframeUrl).origin;r=new T({remoteWindow:t.contentWindow,allowedOrigins:[s]}),f("[HANDSHAKE DEBUG] Created WindowMessenger")}return f("[HANDSHAKE DEBUG] Creating IframeManager instance"),new D(e,this.storage,r)}async ensureSigner(){if(this.iframeManager?.hasFailed&&(f("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 w(e,this.storage,this.backendApiClients,this.passkeyHandler,this.eventEmitter)}createIframe(e){if("undefined"==typeof document)throw new t("Document is not available. Please provide a message poster for non-browser environments.");const r=document.getElementById("openfort-iframe");r&&r.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 d.fromStorage(this.storage);if(!t?.userId)throw new r("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 g.PASSWORD:return{recoveryPassword:e.password};case g.AUTOMATIC:return{encryptionSession:e.encryptionSession};case g.PASSKEY:return{passkey:e.passkeyInfo?{id:e.passkeyInfo.passkeyId,key:e.passkeyInfo.passkeyKey||await this.getPasskeyKey(e.passkeyInfo.passkeyId)}:{}};default:throw new t("Invalid recovery method")}}async configure(e){await this.validateAndRefreshToken();const t=e.recoveryParams??{recoveryMethod:g.AUTOMATIC},[r,s]=await Promise.all([this.ensureSigner(),this.getEntropy(t)]),a={chainId:e.chainId,entropy:s,accountType:e.accountType??l.SMART_ACCOUNT,chainType:e.chainType??y.EVM,getPasskeyKeyFn:async e=>this.getPasskeyKey(e)},i=await r.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:o.parseRecoveryMethod(i.recoveryMethod),recoveryMethodDetails:i.recoveryMethodDetails}}async create(e){await this.validateAndRefreshToken();const r=e.recoveryParams??{recoveryMethod:g.AUTOMATIC},a=await d.fromStorage(this.storage);if(!a)throw new s(c.NOT_LOGGED_IN,"missing authentication");if(r.recoveryMethod===g.PASSKEY){if(!a.userId)throw new t("User ID is required for passkey creation");const e=await this.passkeyHandler.createPasskey({id:i.randomPasskeyName(),seed:a.userId});if(!e.key)throw new t("Passkey creation failed: no key material returned");r.passkeyInfo={passkeyId:e.id,passkeyKey:e.key}}const[n,h]=await Promise.all([this.ensureSigner(),this.getEntropy(r)]),y=await n.create({accountType:e.accountType,chainType:e.chainType,chainId:e.chainId,entropy:h}),l={id:y.id,chainId:y.chainId,address:y.address,ownerAddress:y.ownerAddress,chainType:y.chainType,accountType:y.accountType,implementationType:y.implementationType,factoryAddress:y.factoryAddress,salt:y.salt,createdAt:y.createdAt,implementationAddress:y.implementationAddress,recoveryMethod:o.parseRecoveryMethod(y.recoveryMethod),recoveryMethodDetails:y.recoveryMethodDetails};return this.eventEmitter.emit(m.ON_EMBEDDED_WALLET_CREATED,l),l}async recover(e){await this.validateAndRefreshToken();const r=e.recoveryParams??{recoveryMethod:g.AUTOMATIC};if(r.recoveryMethod===g.PASSKEY){if(!r.passkeyInfo?.passkeyId)throw new t("Passkey ID must be provided for passkey recovery");r.passkeyInfo={passkeyId:r.passkeyInfo.passkeyId}}const[s,a]=await Promise.all([this.ensureSigner(),this.getEntropy(r)]),i=await s.recover({account:e.account,entropy:a}),n={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:o.parseRecoveryMethod(i.recoveryMethod),recoveryMethodDetails:i.recoveryMethodDetails};return this.eventEmitter.emit(m.ON_EMBEDDED_WALLET_RECOVERED,n),n}async signMessage(e,t){await this.validateAndRefreshToken();const r=await this.ensureSigner(),{hashMessage:s=!0,arrayifyMessage:a=!1}=t||{},i=await o.fromStorage(this.storage);return await r.sign(e,a,s,i?.chainType)}async signTypedData(e,t,r){await this.validateAndRefreshToken();const s=await this.ensureSigner(),i=await o.fromStorage(this.storage);if(!i)throw new a(c.MISSING_SIGNER,"No account found");const n={...t};delete n.EIP712Domain;const{_TypedDataEncoder:d}=await import("@ethersproject/hash"),h=d.hash(e,n,r);return await M({hash:h,implementationType:i.implementationType||i.type,chainId:Number(i.chainId),signer:s,address:i.address,ownerAddress:i.ownerAddress,factoryAddress:i.factoryAddress,salt:i.salt})}async exportPrivateKey(){await this.validateAndRefreshToken();const e=await this.ensureSigner();return await e.export()}async setRecoveryMethod(e,r){await this.validateAndRefreshToken();const a=await this.ensureSigner(),n=await d.fromStorage(this.storage);if(!n)throw new s(c.NOT_LOGGED_IN,"missing authentication");let h,m,y,l;if(e.recoveryMethod===g.PASSKEY){const e=await o.fromStorage(this.storage);if(!e)throw new t("missing account");const r=e?.recoveryMethodDetails?.passkeyId;if(!r)throw new t("missing passkey id for account");if(!n.userId)throw new t("User ID is required for passkey key derivation");y={passkeyId:r,passkeyKey:await this.passkeyHandler.deriveAndExportKey({id:r,seed:n.userId})}}else if(r.recoveryMethod===g.PASSKEY){if(!n.userId)throw new t("User ID is required for passkey creation");const e=await this.passkeyHandler.createPasskey({id:i.randomPasskeyName(),seed:n.userId});if(!e.key)throw new t("Passkey creation failed: no key material returned");y={passkeyId:e.id,passkeyKey:e.key},l={passkeyId:e.id}}if(e.recoveryMethod===g.PASSWORD?h=e.password:r.recoveryMethod===g.PASSWORD&&(h=r.password),e.recoveryMethod===g.AUTOMATIC?m=e.encryptionSession:r.recoveryMethod===g.AUTOMATIC&&(m=r.encryptionSession),!h&&!m)throw new t("Password or encryption session is not provided");await a.setRecoveryMethod({recoveryMethod:r.recoveryMethod,recoveryPassword:h,encryptionSession:m,passkeyInfo:y});const p=await o.fromStorage(this.storage);p&&new o({...p,recoveryMethod:r.recoveryMethod,recoveryMethodDetails:l}).save(this.storage)}async get(){await this.validateAndRefreshToken();const e=await o.fromStorage(this.storage);if(!e)throw new a(c.MISSING_SIGNER,"No signer configured");if(!await d.fromStorage(this.storage))throw new s(c.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:o.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails}}async list(e){await this.validateAndRefreshToken();const r={...e},a=n.getInstance();if(!a)throw new t("Configuration not found");const i=await d.fromStorage(this.storage);if(!i)throw new s(c.NOT_LOGGED_IN,"No access token found");return await this.validateAndRefreshToken(),h(async()=>(await this.backendApiClients.accountsV2Api.getAccountsV2(r,{headers:i.thirdPartyProvider?{authorization:`Bearer ${a.baseConfiguration.publishableKey}`,"x-player-token":i.token,"x-auth-provider":i.thirdPartyProvider,"x-token-type":i.thirdPartyTokenType}:{authorization:`Bearer ${i.token}`,"x-project-key":a.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:o.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails})),{context:"list"})}async getEmbeddedState(){try{if(!await d.fromStorage(this.storage))return p.UNAUTHENTICATED;return await o.fromStorage(this.storage)?p.READY:p.EMBEDDED_SIGNER_NOT_CONFIGURED}catch(e){return f("Failed to get embedded state:",e),p.UNAUTHENTICATED}}watchEmbeddedState(e){return u("watchEmbeddedState",{onChange:e.onChange,onError:e.onError},t=>{let r;const s=async()=>{try{const e=await this.getEmbeddedState();r!==e&&(t.onChange?.(e,r),r=e)}catch(e){t.onError?.(e instanceof Error?e:new Error(String(e)))}};s();const a=()=>s(),i=()=>s(),n=()=>s(),o=()=>s();this.eventEmitter.on(m.ON_AUTH_SUCCESS,a),this.eventEmitter.on(m.ON_LOGOUT,i),this.eventEmitter.on(m.ON_EMBEDDED_WALLET_CREATED,n),this.eventEmitter.on(m.ON_EMBEDDED_WALLET_RECOVERED,o);const d=setInterval(s,e.pollingInterval??2e3);return()=>{clearInterval(d),this.eventEmitter.off(m.ON_AUTH_SUCCESS,a),this.eventEmitter.off(m.ON_LOGOUT,i),this.eventEmitter.off(m.ON_EMBEDDED_WALLET_CREATED,n),this.eventEmitter.off(m.ON_EMBEDDED_WALLET_RECOVERED,o)}})}async getEthereumProvider(e){await this.ensureInitialized();const t={announceProvider:!0,...e},r=await d.fromStorage(this.storage),s=await o.fromStorage(this.storage);return this.provider?this.provider&&t.policy&&this.provider.updatePolicy(t.policy):(this.provider=new A({storage:this.storage,openfortEventEmitter:this.eventEmitter,ensureSigner:this.ensureSigner.bind(this),account:s||void 0,authentication:r||void 0,backendApiClients:this.backendApiClients,policyId:t.policy,validateAndRefreshSession:this.validateAndRefreshToken.bind(this),chains:t.chains}),t.announceProvider&&E({info:{...v,...t.providerInfo},provider:this.provider})),this.provider}async ping(e){try{e>0&&await new Promise(t=>{setTimeout(t,e)});const t=await this.getIframeManager();if(!t.isLoaded())return!1;const r=await d.fromStorage(this.storage);if(r)try{return await t.getCurrentDevice(r.userId),!0}catch(e){return!1}return t.isLoaded()}catch(e){return f("Ping failed:",e),!1}}getURL(){const e=n.getInstance();if(!e)throw new t("Configuration not found");return e.iframeUrl}async setMessagePoster(e){if(!e||"function"!=typeof e.postMessage)throw new t("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 f("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 f("Invalid message received:",e);f("[HANDSHAKE DEBUG] EmbeddedWalletApi onMessage:",e);const t="penpal"===e.namespace&&"SYN"===e.type||e.penpal&&"string"==typeof e.penpal;if(t&&this.messenger&&this.messagePoster)return f("[HANDSHAKE DEBUG] Passing message directly to existing ReactNativeMessenger"),void this.messenger.handleMessage(e);const r=await this.getIframeManager();f(`[HANDSHAKE DEBUG] IframeManager obtained, isLoaded: ${r.isLoaded()}`),t&&!r.isLoaded()&&f("[HANDSHAKE DEBUG] Received penpal message before connection initialized, setting up connection..."),f("[HANDSHAKE DEBUG] Calling iframeManager.onMessage"),await r.onMessage(e),f("[HANDSHAKE DEBUG] iframeManager.onMessage completed")}isReady(){return this.iframeManager?.isLoaded()||!1}}export{S as EmbeddedWalletApi};
|
|
1
|
+
import{BackendApiClients as e}from"../../../packages/internal/openapi-clients/dist/index.js";import{ConfigurationError as t,AuthenticationError as r,SessionError as s,SignerError as a}from"../core/errors/openfortError.js";import{PasskeyHandler as i}from"../core/passkey/handler.js";import{SDKConfiguration as n}from"../core/config/config.js";import{Account as o}from"../core/configuration/account.js";import{Authentication as d}from"../core/configuration/authentication.js";import{OPENFORT_AUTH_ERROR_CODES as c}from"../core/errors/authErrorCodes.js";import{withApiError as h}from"../core/errors/withApiError.js";import{OpenfortEvents as m,RecoveryMethod as g,ChainTypeEnum as y,AccountTypeEnum as l,EmbeddedState as p}from"../types/types.js";import{debugLog as f}from"../utils/debug.js";import{observe as u}from"../utils/observe.js";import{EmbeddedSigner as w}from"../wallets/embedded.js";import{EvmProvider as A}from"../wallets/evm/evmProvider.js";import"../wallets/evm/types.js";import{announceProvider as E,openfortProviderInfo as v}from"../wallets/evm/provider/eip6963.js";import{signMessage as M}from"../wallets/evm/walletHelpers.js";import{IframeManager as D}from"../wallets/iframeManager.js";import{ReactNativeMessenger as I}from"../wallets/messaging/ReactNativeMessenger.js";import"../wallets/messaging/browserMessenger/backwardCompatibility.js";import S from"../wallets/messaging/browserMessenger/messengers/WindowMessenger.js";class T{storage;validateAndRefreshToken;ensureInitialized;eventEmitter;passkeyHandler;iframeManager=null;iframeManagerPromise=null;signer=null;signerPromise=null;provider=null;messagePoster=null;messenger=null;constructor(e,t,r,s,a){this.storage=e,this.validateAndRefreshToken=t,this.ensureInitialized=r,this.eventEmitter=s,this.passkeyHandler=a,this.eventEmitter.on(m.ON_LOGOUT,()=>{f("Handling logout event in EmbeddedWalletApi"),this.handleLogout()})}get backendApiClients(){const r=n.getInstance();if(!r)throw new t("Configuration not found");return new e({basePath:r.backendUrl,accessToken:r.baseConfiguration.publishableKey,nativeAppIdentifier:r.nativeAppIdentifier})}async getIframeManager(){if(f("[HANDSHAKE DEBUG] getIframeManager called"),this.iframeManager?.hasFailed&&(f("[HANDSHAKE DEBUG] Existing iframeManager has failed, clearing for recreation"),this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null),this.iframeManager)return f("[HANDSHAKE DEBUG] Returning existing iframeManager instance"),this.iframeManager;if(this.iframeManagerPromise)return f("[HANDSHAKE DEBUG] Returning existing iframeManagerPromise"),this.iframeManagerPromise;f("[HANDSHAKE DEBUG] Creating new iframeManager"),this.iframeManagerPromise=this.createIframeManager();try{return f("[HANDSHAKE DEBUG] Awaiting iframeManager creation"),this.iframeManager=await this.iframeManagerPromise,f("[HANDSHAKE DEBUG] IframeManager created successfully"),this.iframeManagerPromise=null,this.iframeManager}catch(e){throw f("[HANDSHAKE DEBUG] Error creating iframeManager:",e),this.iframeManagerPromise=null,this.messenger&&(this.messenger.destroy(),this.messenger=null),this.iframeManager=null,e}}async createIframeManager(){f("[HANDSHAKE DEBUG] createIframeManager starting");const e=n.getInstance();if(!e)throw f("[HANDSHAKE DEBUG] Configuration not found"),new t("Configuration not found");let r;if(f("[HANDSHAKE DEBUG] Configuration found"),this.messagePoster)f("[HANDSHAKE DEBUG] Creating ReactNativeMessenger with messagePoster"),this.messenger&&(f("[HANDSHAKE DEBUG] Destroying old messenger before creating new one"),this.messenger.destroy()),this.messenger=new I(this.messagePoster),f("[HANDSHAKE DEBUG] Created new ReactNativeMessenger instance"),r=this.messenger;else{f("[HANDSHAKE DEBUG] Creating WindowMessenger for browser mode");const t=this.createIframe(e.iframeUrl),s=new URL(e.iframeUrl).origin;r=new S({remoteWindow:t.contentWindow,allowedOrigins:[s]}),f("[HANDSHAKE DEBUG] Created WindowMessenger")}return f("[HANDSHAKE DEBUG] Creating IframeManager instance"),new D(e,this.storage,r)}async ensureSigner(){if(this.iframeManager?.hasFailed&&(f("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 w(e,this.storage,this.backendApiClients,this.passkeyHandler,this.eventEmitter)}createIframe(e){if("undefined"==typeof document)throw new t("Document is not available. Please provide a message poster for non-browser environments.");const r=document.getElementById("openfort-iframe");r&&r.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 d.fromStorage(this.storage);if(!t?.userId)throw new r("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 g.PASSWORD:return{recoveryPassword:e.password};case g.AUTOMATIC:return{encryptionSession:e.encryptionSession};case g.PASSKEY:return{passkey:e.passkeyInfo?{id:e.passkeyInfo.passkeyId,key:e.passkeyInfo.passkeyKey||await this.getPasskeyKey(e.passkeyInfo.passkeyId)}:{}};default:throw new t("Invalid recovery method")}}async configure(e){await this.validateAndRefreshToken();const t=e.recoveryParams??{recoveryMethod:g.AUTOMATIC},[r,s]=await Promise.all([this.ensureSigner(),this.getEntropy(t)]),a={chainId:e.chainId,entropy:s,accountType:e.accountType??l.SMART_ACCOUNT,chainType:e.chainType??y.EVM,getPasskeyKeyFn:async e=>this.getPasskeyKey(e)},i=await r.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:o.parseRecoveryMethod(i.recoveryMethod),recoveryMethodDetails:i.recoveryMethodDetails}}async create(e){await this.validateAndRefreshToken();const r=e.recoveryParams??{recoveryMethod:g.AUTOMATIC},a=await d.fromStorage(this.storage);if(!a)throw new s(c.NOT_LOGGED_IN,"missing authentication");if(r.recoveryMethod===g.PASSKEY){if(!a.userId)throw new t("User ID is required for passkey creation");const e=await this.passkeyHandler.createPasskey({id:i.randomPasskeyName(),seed:a.userId});if(!e.key)throw new t("Passkey creation failed: no key material returned");r.passkeyInfo={passkeyId:e.id,passkeyKey:e.key}}const[n,h]=await Promise.all([this.ensureSigner(),this.getEntropy(r)]),y=await n.create({accountType:e.accountType,chainType:e.chainType,chainId:e.chainId,entropy:h}),l={id:y.id,chainId:y.chainId,address:y.address,ownerAddress:y.ownerAddress,chainType:y.chainType,accountType:y.accountType,implementationType:y.implementationType,factoryAddress:y.factoryAddress,salt:y.salt,createdAt:y.createdAt,implementationAddress:y.implementationAddress,recoveryMethod:o.parseRecoveryMethod(y.recoveryMethod),recoveryMethodDetails:y.recoveryMethodDetails};return this.eventEmitter.emit(m.ON_EMBEDDED_WALLET_CREATED,l),l}async recover(e){await this.validateAndRefreshToken();const r=e.recoveryParams??{recoveryMethod:g.AUTOMATIC};if(r.recoveryMethod===g.PASSKEY){if(!r.passkeyInfo?.passkeyId)throw new t("Passkey ID must be provided for passkey recovery");r.passkeyInfo={passkeyId:r.passkeyInfo.passkeyId}}const[s,a]=await Promise.all([this.ensureSigner(),this.getEntropy(r)]),i=await s.recover({account:e.account,entropy:a}),n={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:o.parseRecoveryMethod(i.recoveryMethod),recoveryMethodDetails:i.recoveryMethodDetails};return this.eventEmitter.emit(m.ON_EMBEDDED_WALLET_RECOVERED,n),n}async signMessage(e,t){await this.validateAndRefreshToken();const r=await this.ensureSigner(),{hashMessage:s=!0,arrayifyMessage:a=!1}=t||{},i=await o.fromStorage(this.storage);return await r.sign(e,a,s,i?.chainType)}async signTypedData(e,t,r){await this.validateAndRefreshToken();const s=await this.ensureSigner(),i=await o.fromStorage(this.storage);if(!i)throw new a(c.MISSING_SIGNER,"No account found");const n={...t};delete n.EIP712Domain;const{_TypedDataEncoder:d}=await import("@ethersproject/hash"),h=d.hash(e,n,r);return await M({hash:h,implementationType:i.implementationType||i.type,chainId:Number(i.chainId),signer:s,address:i.address,ownerAddress:i.ownerAddress,factoryAddress:i.factoryAddress,salt:i.salt})}async exportPrivateKey(){await this.validateAndRefreshToken();const e=await this.ensureSigner();return await e.export()}async setRecoveryMethod(e,r){await this.validateAndRefreshToken();const a=await this.ensureSigner(),n=await d.fromStorage(this.storage);if(!n)throw new s(c.NOT_LOGGED_IN,"missing authentication");let h,m,y,l;if(e.recoveryMethod===g.PASSKEY){const e=await o.fromStorage(this.storage);if(!e)throw new t("missing account");const r=e?.recoveryMethodDetails?.passkeyId;if(!r)throw new t("missing passkey id for account");if(!n.userId)throw new t("User ID is required for passkey key derivation");y={passkeyId:r,passkeyKey:await this.passkeyHandler.deriveAndExportKey({id:r,seed:n.userId})}}else if(r.recoveryMethod===g.PASSKEY){if(!n.userId)throw new t("User ID is required for passkey creation");const e=await this.passkeyHandler.createPasskey({id:i.randomPasskeyName(),seed:n.userId});if(!e.key)throw new t("Passkey creation failed: no key material returned");y={passkeyId:e.id,passkeyKey:e.key},l={passkeyId:e.id}}if(e.recoveryMethod===g.PASSWORD?h=e.password:r.recoveryMethod===g.PASSWORD&&(h=r.password),e.recoveryMethod===g.AUTOMATIC?m=e.encryptionSession:r.recoveryMethod===g.AUTOMATIC&&(m=r.encryptionSession),!h&&!m)throw new t("Password or encryption session is not provided");await a.setRecoveryMethod({recoveryMethod:r.recoveryMethod,recoveryPassword:h,encryptionSession:m,passkeyInfo:y});const p=await o.fromStorage(this.storage);p&&new o({...p,recoveryMethod:r.recoveryMethod,recoveryMethodDetails:l}).save(this.storage)}async get(){await this.validateAndRefreshToken();const e=await o.fromStorage(this.storage);if(!e)throw new a(c.MISSING_SIGNER,"No signer configured");if(!await d.fromStorage(this.storage))throw new s(c.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:o.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails}}async list(e){await this.validateAndRefreshToken();const r={...e},a=n.getInstance();if(!a)throw new t("Configuration not found");const i=await d.fromStorage(this.storage);if(!i)throw new s(c.NOT_LOGGED_IN,"No access token found");return await this.validateAndRefreshToken(),h(async()=>(await this.backendApiClients.accountsV2Api.getAccountsV2(r,{headers:i.thirdPartyProvider?{authorization:`Bearer ${a.baseConfiguration.publishableKey}`,"x-player-token":i.token,"x-auth-provider":i.thirdPartyProvider,"x-token-type":i.thirdPartyTokenType}:{authorization:`Bearer ${i.token}`,"x-project-key":a.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:o.parseRecoveryMethod(e.recoveryMethod),recoveryMethodDetails:e.recoveryMethodDetails})),{context:"list"})}async getEmbeddedState(){try{if(!await d.fromStorage(this.storage))return p.UNAUTHENTICATED;return await o.fromStorage(this.storage)?p.READY:p.EMBEDDED_SIGNER_NOT_CONFIGURED}catch(e){return f("Failed to get embedded state:",e),p.UNAUTHENTICATED}}watchEmbeddedState(e){return u("watchEmbeddedState",{onChange:e.onChange,onError:e.onError},t=>{let r;const s=async()=>{try{const e=await this.getEmbeddedState();r!==e&&(t.onChange?.(e,r),r=e)}catch(e){t.onError?.(e instanceof Error?e:new Error(String(e)))}};s();const a=()=>s(),i=()=>s(),n=()=>s(),o=()=>s();this.eventEmitter.on(m.ON_AUTH_SUCCESS,a),this.eventEmitter.on(m.ON_LOGOUT,i),this.eventEmitter.on(m.ON_EMBEDDED_WALLET_CREATED,n),this.eventEmitter.on(m.ON_EMBEDDED_WALLET_RECOVERED,o);const d=setInterval(s,e.pollingInterval??2e3);return()=>{clearInterval(d),this.eventEmitter.off(m.ON_AUTH_SUCCESS,a),this.eventEmitter.off(m.ON_LOGOUT,i),this.eventEmitter.off(m.ON_EMBEDDED_WALLET_CREATED,n),this.eventEmitter.off(m.ON_EMBEDDED_WALLET_RECOVERED,o)}})}async getEthereumProvider(e){await this.ensureInitialized();const t={announceProvider:!0,...e},r=await d.fromStorage(this.storage),s=await o.fromStorage(this.storage);return this.provider?this.provider&&t.feeSponsorship&&this.provider.updateFeeSponsorship(t.feeSponsorship):(this.provider=new A({storage:this.storage,openfortEventEmitter:this.eventEmitter,ensureSigner:this.ensureSigner.bind(this),account:s||void 0,authentication:r||void 0,backendApiClients:this.backendApiClients,feeSponsorshipId:t.feeSponsorship,validateAndRefreshSession:this.validateAndRefreshToken.bind(this),chains:t.chains}),t.announceProvider&&E({info:{...v,...t.providerInfo},provider:this.provider})),this.provider}async ping(e){try{e>0&&await new Promise(t=>{setTimeout(t,e)});const t=await this.getIframeManager();if(!t.isLoaded())return!1;const r=await d.fromStorage(this.storage);if(r)try{return await t.getCurrentDevice(r.userId),!0}catch(e){return!1}return t.isLoaded()}catch(e){return f("Ping failed:",e),!1}}getURL(){const e=n.getInstance();if(!e)throw new t("Configuration not found");return e.iframeUrl}async setMessagePoster(e){if(!e||"function"!=typeof e.postMessage)throw new t("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 f("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 f("Invalid message received:",e);f("[HANDSHAKE DEBUG] EmbeddedWalletApi onMessage:",e);const t="penpal"===e.namespace&&"SYN"===e.type||e.penpal&&"string"==typeof e.penpal;if(t&&this.messenger&&this.messagePoster)return f("[HANDSHAKE DEBUG] Passing message directly to existing ReactNativeMessenger"),void this.messenger.handleMessage(e);const r=await this.getIframeManager();f(`[HANDSHAKE DEBUG] IframeManager obtained, isLoaded: ${r.isLoaded()}`),t&&!r.isLoaded()&&f("[HANDSHAKE DEBUG] Received penpal message before connection initialized, setting up connection..."),f("[HANDSHAKE DEBUG] Calling iframeManager.onMessage"),await r.onMessage(e),f("[HANDSHAKE DEBUG] iframeManager.onMessage completed")}isReady(){return this.iframeManager?.isLoaded()||!1}}export{T as EmbeddedWalletApi};
|
package/dist/sdk/src/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
const o="1.
|
|
1
|
+
const o="1.3.1",t="@openfort/openfort-js";export{t as PACKAGE,o as VERSION};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withApiError as t}from"../../core/errors/withApiError.js";import{JsonRpcError as e,RpcErrorCode as a}from"./JsonRpcError.js";const r=async({params:r,account:n,authentication:o,backendClient:i,
|
|
1
|
+
import{withApiError as t}from"../../core/errors/withApiError.js";import{JsonRpcError as e,RpcErrorCode as a}from"./JsonRpcError.js";const r=async({params:r,account:n,authentication:o,backendClient:i,feeSponsorshipId:s})=>{const c=await(async(r,n,o,i,s)=>{const c=r.map(t=>{if(!t.to)throw new e(a.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(async()=>(await n.transactionIntentsApi.estimateTransactionIntentCost({createTransactionIntentRequest:{policy:s,chainId:o.chainId,interactions:c}},{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"})})(r,i,n,o,s).catch(t=>{throw new e(a.TRANSACTION_REJECTED,t.message)});return c.estimatedTXGas};export{r as estimateGas};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{Account as t}from"../../core/configuration/account.js";import{Authentication as e}from"../../core/configuration/authentication.js";import{OpenfortEvents as
|
|
1
|
+
import{Account as t}from"../../core/configuration/account.js";import{Authentication as e}from"../../core/configuration/authentication.js";import{OpenfortEvents as s,AccountTypeEnum as a}from"../../types/types.js";import{defaultChainRpcs as i}from"../../utils/chains/index.js";import{numberToHex as r}from"../../utils/crypto.js";import o from"../../utils/typedEventEmitter.js";import{addEthereumChain as n}from"./addEthereumChain.js";import{estimateGas as h}from"./estimateGas.js";import{getAssets as c}from"./getAssets.js";import{getCallStatus as p}from"./getCallsStatus.js";import{JsonRpcError as d,ProviderErrorCode as m,RpcErrorCode as w}from"./JsonRpcError.js";import{personalSign as u}from"./personalSign.js";import{registerSession as l}from"./registerSession.js";import{revokeSession as g}from"./revokeSession.js";import{sendCallsSync as f}from"./sendCallSync.js";import{sendCalls as S}from"./sendCalls.js";import{signTypedDataV4 as A}from"./signTypedDataV4.js";import{ProviderEvent as R}from"./types.js";import{prepareEOATransaction as v,parseTransactionRequest as _}from"./walletHelpers.js";class E{#t;#e;#s;#a;updateFeeSponsorship(t){this.#e=t}#i;#r;#o=null;#n;isOpenfort=!0;#h;constructor({storage:t,backendApiClients:e,openfortEventEmitter:a,feeSponsorshipId:i,ensureSigner:r,chains:n,validateAndRefreshSession:h}){this.#h=r,this.#t=t,this.#s=n,this.#e=i,this.#i=h,this.#n=e,this.#r=new o,a.on(s.ON_LOGOUT,this.#c),a.on(s.ON_SWITCH_ACCOUNT,this.#p)}#d=async()=>(this.#a||(this.#a=await this.#h()),this.#a);#c=async()=>{this.#a=void 0,this.#r.emit(R.DISCONNECT,{code:4900,message:"Disconnected"}),this.#r.emit(R.ACCOUNTS_CHANGED,[])};#p=async t=>{this.#r.emit(R.ACCOUNTS_CHANGED,[t])};async getRpcProvider(){if(!this.#o){const e=await t.fromStorage(this.#t),s=e?.chainId||(this.#s?Number(Object.keys(this.#s)[0]):void 0)||8453;await import("@ethersproject/providers").then(t=>{const e=this.#s?this.#s[s]:void 0;this.#o=new t.StaticJsonRpcProvider(e??i[s])})}if(!this.#o)throw new Error("RPC provider not initialized");return this.#o}async#m(s){switch(s.method){case"eth_accounts":{const e=await t.fromStorage(this.#t);return e?[e.address]:[]}case"eth_requestAccounts":{const e=await t.fromStorage(this.#t);if(e){const t=await this.getRpcProvider(),{chainId:s}=await t.detectNetwork();return this.#r.emit(R.ACCOUNTS_CONNECT,{chainId:r(s)}),[e.address]}throw new d(m.UNAUTHORIZED,"Unauthorized - must be authenticated and configured with a signer.")}case"eth_signTransaction":{const a=await t.fromStorage(this.#t),i=await this.#d(),r=await e.fromStorage(this.#t);if(!a||!r)throw new d(m.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");const o=await this.getRpcProvider(),{chainId:n}=await o.detectNetwork(),[h]=s.params||[];h.chainId||(h.chainId=n.toString());const c=_(h),{serialize:p}=await import("@ethersproject/transactions"),w=t=>({legacy:0,eip2930:1,eip1559:2}[t]),{gas:u,...l}=c,g={...l,gasLimit:u,to:c.to??void 0,type:w(c.type)},f=p(g),{keccak256:S}=await import("@ethersproject/keccak256"),A=S(f);await this.#i();const R=await i.sign(A,!1,!1),{splitSignature:v}=await import("@ethersproject/bytes");return p(g,v(R))}case"eth_sendTransaction":{const[i,r,o]=await Promise.all([t.fromStorage(this.#t),this.#d(),e.fromStorage(this.#t)]);if(!i||!o)throw new d(m.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");if(await this.#i(),i?.accountType===a.EOA){const[t]=s.params||[],e=await this.getRpcProvider(),a=await v(t,e,i.address),r=await this.#m({method:"eth_signTransaction",params:[a]});return this.#m({method:"eth_sendRawTransaction",params:[r]})}return(await f({params:s.params||[],signer:r,account:i,authentication:o,backendClient:this.#n,rpcProvider:await this.getRpcProvider(),feeSponsorshipId:this.#e})).receipt.transactionHash}case"eth_sendRawTransactionSync":{const[i,r,o]=await Promise.all([t.fromStorage(this.#t),this.#d(),e.fromStorage(this.#t)]);if(!i||!o)throw new d(m.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");if(i?.accountType===a.EOA)throw new d(m.UNSUPPORTED_METHOD,`${s.method}: Method not supported`);return await this.#i(),await f({params:s.params||[],signer:r,account:i,authentication:o,backendClient:this.#n,rpcProvider:await this.getRpcProvider(),feeSponsorshipId:this.#e})}case"eth_estimateGas":{const a=await t.fromStorage(this.#t),i=await e.fromStorage(this.#t);if(!a||!i)throw new d(m.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#i(),await h({params:s.params||[],account:a,authentication:i,backendClient:this.#n,feeSponsorshipId:this.#e})}case"eth_signTypedData":case"eth_signTypedData_v4":{const e=await t.fromStorage(this.#t),a=await this.#d();if(!e)throw new d(m.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");await this.#i();const i=await this.getRpcProvider();return await A({method:s.method,params:s.params||[],signer:a,implementationType:e.implementationType||e.type,rpcProvider:i,account:e})}case"personal_sign":{const e=await t.fromStorage(this.#t);if(!e)throw new d(m.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");const a=await this.#d();return await this.#i(),await u({params:s.params||[],signer:a,account:e})}case"eth_chainId":{const t=await this.getRpcProvider(),{chainId:e}=await t.detectNetwork();return r(e)}case"wallet_switchEthereumChain":{const t=await this.#d();if(!s.params||!Array.isArray(s.params)||0===s.params.length)throw new d(w.INVALID_PARAMS,"Invalid parameters for wallet_switchEthereumChain");await this.#i();try{const e=parseInt(s.params[0].chainId,16);await t.switchChain({chainId:e}),await import("@ethersproject/providers").then(t=>{const s=this.#s?this.#s[e]:void 0;this.#o=new t.StaticJsonRpcProvider(s??i[e])}),this.#r.emit(R.CHAIN_CHANGED,r(e))}catch(t){const e=t;throw new d(w.INTERNAL_ERROR,`Failed to switch chain: ${e.message}`)}return null}case"wallet_addEthereumChain":{await this.#d();const t=await this.getRpcProvider();return await n({params:s.params||[],rpcProvider:t,storage:this.#t})}case"wallet_showCallsStatus":return null;case"wallet_getCallsStatus":{const i=await t.fromStorage(this.#t);if(i?.accountType===a.EOA)throw new d(m.UNSUPPORTED_METHOD,`${s.method}: Method not supported`);const r=await e.fromStorage(this.#t);if(!i||!r)throw new d(m.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#i(),await p({params:s.params||{},authentication:r,backendClient:this.#n})}case"wallet_sendCalls":{const[i,r,o]=await Promise.all([t.fromStorage(this.#t),this.#d(),e.fromStorage(this.#t)]);if(i?.accountType===a.EOA)throw new d(m.UNSUPPORTED_METHOD,`${s.method}: Method not supported`);if(!i||!o)throw new d(m.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");await this.#i();return await S({params:s.params?s.params[0].calls:[],signer:r,account:i,authentication:o,backendClient:this.#n,rpcProvider:await this.getRpcProvider(),feeSponsorshipId:this.#e})}case"wallet_grantPermissions":{const i=await t.fromStorage(this.#t);if(i?.accountType===a.EOA)throw new d(m.UNSUPPORTED_METHOD,`${s.method}: Method not supported`);const r=await this.#d(),o=await e.fromStorage(this.#t);if(!i||!o)throw new d(m.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#i(),await l({params:s.params||[],signer:r,account:i,authentication:o,backendClient:this.#n,feeSponsorshipId:this.#e})}case"wallet_revokePermissions":{const a=await t.fromStorage(this.#t),i=await this.#d(),r=await e.fromStorage(this.#t);if(!a||!r)throw new d(m.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#i(),await g({params:s.params||[],signer:i,account:a,authentication:r,backendClient:this.#n,feeSponsorshipId:this.#e})}case"wallet_getCapabilities":{const e=await t.fromStorage(this.#t);if(e?.accountType===a.EOA)throw new d(m.UNSUPPORTED_METHOD,`${s.method}: Method not supported`);const i=await this.getRpcProvider(),{chainId:o}=await i.detectNetwork();return{[r(o)]:{permissions:{supported:!0,signerTypes:["account","key"],keyTypes:["secp256k1"],permissionTypes:["contract-calls"]},paymasterService:{supported:!0},atomicBatch:{supported:!0}}}}case"wallet_getAssets":{const a=await t.fromStorage(this.#t),i=await e.fromStorage(this.#t);if(!a||!i)throw new d(m.UNAUTHORIZED,"Unauthorized - call eth_requestAccounts first");return await this.#i(),await c({params:s.params?.[0],account:a,authentication:i,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(m.UNSUPPORTED_METHOD,`${s.method}: Method not supported`)}}async request(t){try{return this.#m(t)}catch(t){if(t instanceof d)throw t;if(t instanceof Error)throw new d(w.INTERNAL_ERROR,t.message);throw new d(w.INTERNAL_ERROR,"Internal error")}}on(t,e){this.#r.on(t,e)}removeListener(t,e){this.#r.off(t,e)}}export{E as EvmProvider};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withApiError as t}from"../../core/errors/withApiError.js";import{AccountType as e}from"../../types/types.js";import{JsonRpcError as i,RpcErrorCode as n}from"./JsonRpcError.js";function a(t){return{data:(()=>{if("token-allowance"===t.type)throw new i(n.INVALID_PARAMS,"token-allowance policy is not supported with this account implementation.");if("gas-limit"===t.type)throw new i(n.INVALID_PARAMS,"gas-limit policy is not supported with this account implementation.");if("rate-limit"===t.type)throw new i(n.INVALID_PARAMS,"rate-limit policy is not supported with this account implementation.");return t.data})(),type:t.type.custom}}function s(t){if("native-token-transfer"===t.type)throw new i(n.INVALID_PARAMS,"native-token-transfer permission is not supported with this account implementation.");if("rate-limit"===t.type)throw new i(n.INVALID_PARAMS,"rate-limit permission is not supported with this account implementation.");if("gas-limit"===t.type)throw new i(n.INVALID_PARAMS,"gas-limit permission is not supported with this account implementation.");return{...t,policies:t?.policies?.map(a),required:t.required??!1,type:"string"==typeof t.type?t.type:t.type.custom}}function o(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}}const r=async({params:a,signer:r,account:c,authentication:p,backendClient:l,
|
|
1
|
+
import{withApiError as t}from"../../core/errors/withApiError.js";import{AccountType as e}from"../../types/types.js";import{JsonRpcError as i,RpcErrorCode as n}from"./JsonRpcError.js";function a(t){return{data:(()=>{if("token-allowance"===t.type)throw new i(n.INVALID_PARAMS,"token-allowance policy is not supported with this account implementation.");if("gas-limit"===t.type)throw new i(n.INVALID_PARAMS,"gas-limit policy is not supported with this account implementation.");if("rate-limit"===t.type)throw new i(n.INVALID_PARAMS,"rate-limit policy is not supported with this account implementation.");return t.data})(),type:t.type.custom}}function s(t){if("native-token-transfer"===t.type)throw new i(n.INVALID_PARAMS,"native-token-transfer permission is not supported with this account implementation.");if("rate-limit"===t.type)throw new i(n.INVALID_PARAMS,"rate-limit permission is not supported with this account implementation.");if("gas-limit"===t.type)throw new i(n.INVALID_PARAMS,"gas-limit permission is not supported with this account implementation.");return{...t,policies:t?.policies?.map(a),required:t.required??!1,type:"string"==typeof t.type?t.type:t.type.custom}}function o(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}}const r=async({params:a,signer:r,account:c,authentication:p,backendClient:l,feeSponsorshipId:d})=>{const m=await(async(e,a,o,r,c)=>{const p=e[0],l=Math.floor(Date.now()/1e3),d=Math.floor(new Date(Date.now()+1e3*p.expiry).getTime()/1e3),m=p.permissions.map(s),y=m.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 u,h=m.find(t=>"call-limit"===t.type)?.data;if(h=m[0]?.policies?.find(t=>"call-limit"===t.type)?.data?.limit,"signer"in p&&p.signer){if("keys"===p.signer.type)throw new i(n.INVALID_PARAMS,"Multi-key signers are not supported for session creation");"key"!==p.signer.type&&"account"!==p.signer.type||(u=p.signer.data.id)}else"account"in p&&p.account&&(u=p.account);if(!u)throw new i(n.INVALID_PARAMS,"Failed to request permissions - missing session address");const w=((t,e,i,n,a,s=!1,o,r,c)=>{const p={address:t,chainId:e,validAfter:i,validUntil:n,optimistic:s,whitelist:o,account:c};return a&&(p.policy=a),r&&(p.limit=r),p})(u,o.chainId,l,d,c,!1,y,h,o.id);return t(async()=>(await a.sessionsApi.createSession({createSessionRequest:w},{headers:r.thirdPartyProvider?{authorization:`Bearer ${a.config.backend.accessToken}`,"x-player-token":r.token,"x-auth-provider":r.thirdPartyProvider,"x-token-type":r.thirdPartyTokenType}:{authorization:`Bearer ${r.token}`,"x-project-key":String(a.config.backend.accessToken)}})).data,{context:"operation"})})(a,l,c,p,d).catch(t=>{throw new i(n.TRANSACTION_REJECTED,t.message)});if(m?.nextAction?.payload?.signableHash){let a;a=[300,324].includes(c.chainId)||c.implementationType&&[e.CALIBUR].includes(c.implementationType)?await r.sign(m.nextAction.payload.signableHash,!1,!1):await r.sign(m.nextAction.payload.signableHash);return o(await t(async()=>(await l.sessionsApi.signatureSession({id:m.id,signatureRequest:{signature:a}})).data,{context:"operation"}).catch(t=>{throw new i(n.TRANSACTION_REJECTED,t.message)}))}if(!1===m.isActive)throw new i(n.TRANSACTION_REJECTED,"Failed to grant permissions");return o(m)};export{r as registerSession};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withApiError as e}from"../../core/errors/withApiError.js";import{AccountType as t}from"../../types/types.js";import{JsonRpcError as n,RpcErrorCode as a}from"./JsonRpcError.js";const i=async({params:i,signer:o,account:
|
|
1
|
+
import{withApiError as e}from"../../core/errors/withApiError.js";import{AccountType as t}from"../../types/types.js";import{JsonRpcError as n,RpcErrorCode as a}from"./JsonRpcError.js";const i=async({params:i,signer:o,account:s,authentication:r,backendClient:c,feeSponsorshipId:p})=>{const d=i[0];if(!d.permissionContext)return await o.disconnect(),{};const h=await(async(t,n,a,i,o)=>{const s=((e,t,n,a)=>{const i={address:e,chainId:t,account:a};return n&&(i.policy=n),i})(t.permissionContext,a.chainId,o,a.id);return e(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"})})(d,c,s,r,p).catch(e=>{throw new n(a.TRANSACTION_REJECTED,e.message)});if(h?.nextAction?.payload?.signableHash){let e;e=[300,324].includes(s.chainId)||s.implementationType&&[t.CALIBUR].includes(s.implementationType)?await o.sign(h.nextAction.payload.signableHash,!1,!1):await o.sign(h.nextAction.payload.signableHash);return(await c.sessionsApi.signatureSession({id:h.id,signatureRequest:{signature:e}}).catch(e=>{throw new n(a.TRANSACTION_REJECTED,e.message)})).data}return h};export{i as revokeSession};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{withApiError as e}from"../../core/errors/withApiError.js";import{AccountTypeEnum as t,AccountType as a}from"../../types/types.js";import{prepareAndSignAuthorization as n,serializeSignedAuthorization as o}from"../../utils/authorization.js";import{JsonRpcError as r,RpcErrorCode as s}from"./JsonRpcError.js";const i=e=>{const t=e?.logs?.[0];return{blockHash:t?.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:t?.transactionIndex,type:"eip1559",blobGasPrice:void 0,blobGasUsed:void 0,root:void 0}};async function c(e,t){try{const a=await e.getCode(t);return"0x"!==a&&a.length>2}catch{return!1}}const d=async({params:d,signer:p,account:l,authentication:u,backendClient:h,rpcProvider:g,
|
|
1
|
+
import{withApiError as e}from"../../core/errors/withApiError.js";import{AccountTypeEnum as t,AccountType as a}from"../../types/types.js";import{prepareAndSignAuthorization as n,serializeSignedAuthorization as o}from"../../utils/authorization.js";import{JsonRpcError as r,RpcErrorCode as s}from"./JsonRpcError.js";const i=e=>{const t=e?.logs?.[0];return{blockHash:t?.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:t?.transactionIndex,type:"eip1559",blobGasPrice:void 0,blobGasUsed:void 0,root:void 0}};async function c(e,t){try{const a=await e.getCode(t);return"0x"!==a&&a.length>2}catch{return!1}}const d=async({params:d,signer:p,account:l,authentication:u,backendClient:h,rpcProvider:g,feeSponsorshipId:T})=>{const A=d[0]?.capabilities?.paymasterService?.policy??T;let m;if(l.accountType===t.DELEGATED_ACCOUNT){const[e,t]=await Promise.all([c(g,l.address),g.getTransactionCount(l.address)]);if(!e){const e=await n({signer:p,accountAddress:l.address,contractAddress:l.implementationAddress,chainId:l.chainId,nonce:t});m=o(e)}}const w=await(async(t,a,n,o,i,c)=>{const d=t.map(e=>{if(!e.to)throw new r(s.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(async()=>(await a.transactionIntentsApi.createTransactionIntent({createTransactionIntentRequest:{account:n.id,policy:i,signedAuthorization:c,chainId:n.chainId,interactions:d}},{headers:o.thirdPartyProvider?{authorization:`Bearer ${a.config.backend.accessToken}`,"x-player-token":o.token,"x-auth-provider":o.thirdPartyProvider,"x-token-type":o.thirdPartyTokenType}:{authorization:`Bearer ${o.token}`,"x-project-key":String(a.config.backend.accessToken)}})).data,{context:"operation"})})(d,h,l,u,A,m).catch(e=>{throw new r(s.TRANSACTION_REJECTED,e.message)});if(w.response?.error?.reason)throw new r(s.TRANSACTION_REJECTED,w.response.error.reason);if(w?.nextAction?.payload?.signableHash){let t;t=[300,324].includes(l.chainId)||l.implementationType&&[a.CALIBUR].includes(l.implementationType)?await p.sign(w.nextAction.payload.signableHash,!1,!1):await p.sign(w.nextAction.payload.signableHash);const n=await e(async()=>await h.transactionIntentsApi.signature({id:w.id,signatureRequest:{signature:t}}),{context:"operation"}).catch(e=>{throw new r(s.TRANSACTION_REJECTED,e.message)});if(0===n.data.response?.status)throw new r(s.TRANSACTION_REJECTED,n.data.response?.error?.reason??"");if(!n.data.response)throw new r(s.TRANSACTION_REJECTED,"No transaction response received");return{id:w.id,receipt:i(n.data.response)}}if(!w.response)throw new r(s.TRANSACTION_REJECTED,"No transaction response received");return{id:w.id,receipt:i(w.response)}};export{d as sendCallsSync};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{sendCallsSync as
|
|
1
|
+
import{sendCallsSync as n}from"./sendCallSync.js";const a=async({params:a,signer:e,account:i,authentication:r,backendClient:o,rpcProvider:t,feeSponsorshipId:c})=>(await n({params:a,signer:e,account:i,authentication:r,backendClient:o,rpcProvider:t,feeSponsorshipId:c})).id;export{a as sendCalls};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@openfort/openfort-js",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.1",
|
|
4
4
|
"author": "Openfort (https://www.openfort.io)",
|
|
5
5
|
"bugs": "https://github.com/openfort-xyz/openfort-js/issues",
|
|
6
6
|
"repository": "openfort-xyz/openfort-js.git",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"rollup-plugin-visualizer": "^5.14.0",
|
|
61
61
|
"typescript": "^5.8.3",
|
|
62
62
|
"vitest": "^2.1.8",
|
|
63
|
-
"@openfort/openapi-clients": "0.0.
|
|
63
|
+
"@openfort/openapi-clients": "0.0.1"
|
|
64
64
|
},
|
|
65
65
|
"main": "./dist/cjs/sdk/src/index.cjs",
|
|
66
66
|
"module": "./dist/sdk/src/index.js",
|