@getpara/user-management-client 1.4.3 → 1.5.0
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/index.js +1002 -1
- package/dist/cjs/index.js.br +0 -0
- package/dist/cjs/index.js.gz +0 -0
- package/dist/esm/index.js +938 -1
- package/dist/esm/index.js.br +0 -0
- package/dist/esm/index.js.gz +0 -0
- package/dist/types/client.d.ts +2 -0
- package/package.json +2 -2
package/dist/esm/index.js
CHANGED
|
@@ -1 +1,938 @@
|
|
|
1
|
-
import g from"axios";import A from"qs";function $(r){return!!r.walletId&&!r.externalWalletAddress}function O(r){return!!r.externalWalletAddress&&!r.walletId}function f(r){if($(r))return["walletId",r.walletId];if(O(r))return["externalWalletAddress",r.externalWalletAddress];throw new Error("invalid wallet params")}function l(r){return!!r&&r!=="null"&&r!=="undefined"&&r!==""}function q(r){return l(r.email)&&!l(r.phone)&&!l(r.countryCode)&&!l(r.farcasterUsername)&&!l(r.telegramUserId)}function C(r){return l(r.phone)&&l(r.countryCode)&&!l(r.email)&&!l(r.farcasterUsername)&&!l(r.telegramUserId)}function W(r){return l(r.farcasterUsername)&&!l(r.email)&&!l(r.phone)&&!l(r.countryCode)&&!l(r.telegramUserId)}function v(r){return l(r.telegramUserId)&&!l(r.email)&&!l(r.phone)&&!l(r.countryCode)&&!l(r.farcasterUsername)}function U(r){return l(r.userId)&&!l(r.email)&&!l(r.phone)&&!l(r.countryCode)&&!l(r.farcasterUsername)&&!l(r.telegramUserId)}function se(r,{allowUserId:e=!1,isRequired:s=!1}={}){switch(!0){case q(r):return{auth:{email:r.email},authType:"email",identifier:r.email,publicKeyIdentifier:r.email};case C(r):return{auth:{phone:r.phone,countryCode:r.countryCode},authType:"phone",identifier:`${r.countryCode}${r.phone}`,publicKeyIdentifier:`${r.countryCode}${r.phone}`};case W(r):return{auth:{farcasterUsername:r.farcasterUsername},authType:"farcaster",identifier:r.farcasterUsername,publicKeyIdentifier:`${r.farcasterUsername}-farcaster`};case v(r):return{auth:{telegramUserId:r.telegramUserId},authType:"telegram",identifier:r.telegramUserId,publicKeyIdentifier:`${r.telegramUserId}-telegram`};case(U(r)&&e):return{auth:{userId:r.userId},authType:"userId",identifier:r.userId,publicKeyIdentifier:r.userId};default:if(s)throw new Error("invalid auth object");return}}var P="x-capsule-sid",b="x-para-version",h="x-partner-id",I="X-External-API-Key";function m(r,e,s,t){Error.call(this),Error.captureStackTrace?Error.captureStackTrace(this,this.constructor):this.stack=new Error().stack,this.message=r,this.name="ParaApiError",e&&(this.code=e),s&&(this.status=s),t&&(this.responseURL=t)}var L=m.prototype;Object.defineProperty(L,"isParaApiError",{value:!0});var K=r=>{if(r.status===200)return r;throw new m("Invalid status code")},B=r=>{if(r===null)throw new m("Error is null");if(g.isAxiosError(r)){let e=r.response?.data??"Unknown error";throw r.code==="ERR_NETWORK"?e="Connection error":r.code==="ERR_CANCELED"&&(e="Connection canceled"),new m(e,r.code,r.response.status,r.request?.responseURL)}throw new m("Unknown error")},E=class{constructor({userManagementHost:e,apiKey:s,partnerId:t,version:a,opts:i,retrieveSessionCookie:o,persistSessionCookie:c}){this.createUser=async e=>(await this.baseRequest.post("/users",e)).data;this.checkUserExists=async e=>await this.baseRequest.get("/users/exists",{params:{...e}});this.verifyTelegram=async e=>(await this.baseRequest.post("/users/telegram",{authObject:e})).data;this.externalWalletLogin=async e=>(await this.baseRequest.post("/users/external-wallets/login",e)).data;this.verifyEmail=async(e,s)=>await this.baseRequest.post(`/users/${e}/verify-email`,s);this.verifyPhone=async(e,s)=>await this.baseRequest.post(`/users/${e}/verify-identifier`,s);this.verifyExternalWallet=async(e,s)=>await this.baseRequest.post(`/users/${e}/external-wallets/verify`,s);this.addSessionPublicKey=async(e,s)=>await this.baseRequest.post(`/users/${e}/biometrics/key`,s);this.getSessionPublicKeys=async e=>await this.baseRequest.get(`/users/${e}/biometrics/keys`);this.getBiometricLocationHints=async e=>(await this.baseRequest.get("/biometrics/location-hints",{params:e})).data.hints;this.getSessionPublicKey=async(e,s)=>await this.baseRequest.get(`/users/${e}/biometrics/${s}`);this.patchSessionPublicKey=async(e,s,t,a)=>await this.baseRequest.patch(`/users/${s}/biometrics/${t}`,a,{headers:{[h]:e}});this.getWebChallenge=async e=>(await this.baseRequest.get("/biometrics/challenge",{params:{...e||{}}})).data;this.touchSession=async e=>await this.baseRequest.post(`/touch?regenerate=${!!e}`);this.sessionOrigin=async e=>(await this.baseRequest.get(`/sessions/${e}/origin`)).data;this.verifyWebChallenge=async(e,s)=>await this.baseRequest.post("/biometrics/verify",s,{headers:{[h]:e}});this.getSessionChallenge=async e=>await this.baseRequest.get(`/users/${e}/biometrics/challenge`);this.verifySessionChallenge=async(e,s)=>await this.baseRequest.post(`/users/${e}/biometrics/verify`,s);this.createWallet=async(e,s)=>(await this.baseRequest.post(`/users/${e}/wallets`,s)).data;this.createPregenWallet=async e=>(await this.baseRequest.post("/wallets/pregen",e)).data;this.getPregenWallets=async(e,s=!1,t)=>(await this.baseRequest.get("/wallets/pregen",{params:{ids:e,expand:s,userId:t}})).data;this.claimPregenWallets=async e=>(await this.baseRequest.post("/wallets/pregen/claim",e)).data;this.sendTransaction=async(e,s,t)=>await this.baseRequest.post(`/users/${e}/wallets/${s}/transactions/send`,t);this.signTransaction=async(e,s,t)=>await this.baseRequest.post(`/users/${e}/wallets/${s}/transactions/sign`,t);this.refreshKeys=async(e,s,t,a,i)=>{let o={oldPartnerId:t,newPartnerId:a,keyShareProtocolId:i};return await this.baseRequest.post(`/users/${e}/wallets/${s}/refresh`,o)};this.updatePregenWallet=async(e,s)=>(await this.baseRequest.patch(`/wallets/pregen/${e}`,s)).data;this.getWallets=async(e,s)=>await this.baseRequest.get(`/users/${e}/wallets${s?`?includePartnerData=${encodeURIComponent(s)}`:""}`);this.getAllWallets=async e=>await this.baseRequest.get(`/users/${e}/all-wallets`);this.setCurrentWalletIds=async(e,s,t=!1,a,i)=>await this.baseRequest.post(`/users/${e}/wallets/set`,{walletIds:s,needsWallet:t,sessionLookupId:a,newDeviceSessionLookupId:i});this.login=async e=>{let s=e;return await this.baseRequest.post("/login",s)};this.verifyLogin=async e=>{let s={verificationCode:e};return await this.baseRequest.post("/login/verify-email",s)};this.logout=async()=>await this.baseRequest.get("/logout");this.recoveryVerification=async(e,s)=>{let t={email:e,verificationCode:s};return await this.baseRequest.post("/recovery/verification",t)};this.recoveryInit=async e=>{let s={email:e};return await this.baseRequest.post("/recovery",s)};this.preSignMessage=async(e,s,t,a,i)=>{let o={message:t,scheme:a,cosmosSignDoc:i};return(await this.baseRequest.post(`/users/${e}/wallets/${s}/messages/sign`,o)).data};this.deleteSelf=async e=>await this.baseRequest.delete(`/users/${e}`);this.getParaShare=async(e,s)=>(await this.baseRequest.get(`/users/${e}/wallets/${s}/capsule-share`)).data.share;this.getBackupKit=async e=>await this.baseRequest.get(`/download-backup-kit/${e}`,{responseType:"blob"});this.patchSessionPassword=async(e,s,t,a)=>await this.baseRequest.patch(`/users/${s}/passwords/${t}`,a,{headers:{[h]:e}});let d={...s&&{[I]:s},...t&&{[h]:t}},p={baseURL:e,withCredentials:!0,headers:d};if(o){let n=Array.isArray(g.defaults.transformRequest)?g.defaults.transformRequest:[g.defaults.transformRequest];p.transformRequest=[function(u,y){let R=o();return R&&(y[P]=R),a&&(y[b]=a),u},...n]}if(c){let n=Array.isArray(g.defaults.transformResponse)?g.defaults.transformResponse:[g.defaults.transformResponse];p.transformResponse=[...n,function(u,y,R){return y?.[P]&&c(y[P]),u}]}this.baseRequest=g.create(p),i?.useFetchAdapter&&(g.defaults.adapter=function(n){return fetch(n.baseURL+n.url.substring(1),{method:n.method,headers:n.headers,body:n.data,credentials:n.withCredentials?"include":void 0}).then(u=>u.text().then(y=>({data:y,status:u.status,statusText:u.statusText,headers:u.headers,config:n,request:fetch}))).catch(function(u){throw u})}),this.baseRequest.interceptors.response.use(K,B)}async uploadKeyshares(e,s,t){let a={keyShares:t};return await this.baseRequest.post(`/users/${e}/wallets/${s}/key-shares`,a)}async uploadUserKeyShares(e,s){let t={keyShares:s};return await this.baseRequest.post(`/users/${e}/key-shares`,t)}async getKeyshare(e,s,t,a){return await this.baseRequest.get(`/users/${e}/wallets/${s}/key-shares?type=${t}${a?`&encryptor=${a}`:""}`)}async getBiometricKeyshares(e,s,t){return await this.baseRequest.get(`/users/${e}/biometrics/key-shares?publicKey=${s}&all=${!!t}`)}async getPasswordKeyshares(e,s,t){return await this.baseRequest.get(`/users/${e}/passwords/key-shares?passwordId=${s}&all=${!!t}`)}async uploadTransmissionKeyshares(e,s){let t={shares:s};return await this.baseRequest.post(`/users/${e}/temporary-shares`,t)}async getTransmissionKeyshares(e,s){return await this.baseRequest.get(`/users/${e}/temporary-shares?sessionLookupId=${s}`)}async resendVerificationCode({userId:e,...s}){return await this.baseRequest.post(`/users/${e}/resend-verification-code`,s)}async resendVerificationCodeByPhone({userId:e,...s}){return await this.baseRequest.post(`/users/${e}/resend-verification-code-by-phone`,s)}async cancelRecoveryAttempt(e){return await this.baseRequest.post("/recovery/cancel",{email:e})}async check2FAStatus(e){return await this.baseRequest.get(`/2fa/users/${e}/check-status`)}async enable2FA(e,s){return await this.baseRequest.post(`/2fa/users/${e}/enable`,{verificationCode:s})}async setup2FA(e){return await this.baseRequest.post(`/2fa/users/${e}/setup`)}async initializeRecovery(e){return await this.baseRequest.post("/recovery/init",{email:e})}async initializeFarcasterLogin(){return await this.baseRequest.post("/auth/farcaster/init")}async getFarcasterAuthStatus(){return await this.baseRequest.post("/auth/farcaster/status")}async initializeRecoveryForPhone(e,s){return await this.baseRequest.post("/recovery/init",{phone:e,countryCode:s})}async finalizeRecovery(e,s){return await this.baseRequest.post(`/recovery/users/${e}/wallets/${s}/finish`)}async recoverUserShares(e,s){return await this.baseRequest.get(`/recovery/users/${e}/wallets/${s}/key-shares?type=USER&encryptor=RECOVERY`)}async verifyEmailForRecovery(e,s){let t={email:e,verificationCode:s};return await this.baseRequest.post("/recovery/verify-email",t)}async verifyPhoneForRecovery(e,s,t){let a={phone:e,countryCode:s,verificationCode:t};return await this.baseRequest.post("/recovery/verify-identifier",a)}async verify2FA(e,s){let t={email:e,verificationCode:s};return await this.baseRequest.post("/2fa/verify",t)}async verify2FAForPhone(e,s,t){let a={phone:e,countryCode:s,verificationCode:t};return await this.baseRequest.post("/2fa/verify",a)}async tempTrasmissionInit(e,s){let t={message:e,userId:s};return await this.baseRequest.post("/temporary-transmissions",t)}async tempTrasmission(e){return await this.baseRequest.get(`/temporary-transmissions/${e}`)}async getPartner(e){return await this.baseRequest.get(`/partners/${e}`)}async acceptScopes(e,s,t){return await this.baseRequest.post(`/users/${e}/wallets/${s}/scopes/accept`,t)}async getPendingTransaction(e,s){return await this.baseRequest.get(`/users/${e}/pending-transactions/${s}`)}async acceptPendingTransaction(e,s){return await this.baseRequest.post(`/users/${e}/pending-transactions/${s}/accept`)}async getOnRampConfig(){return(await this.baseRequest.get("/on-ramp-config")).data}async createOnRampPurchase({userId:e,params:{type:s,walletType:t,address:a,provider:i,networks:o,assets:c,defaultNetwork:d,defaultAsset:p,fiat:n,fiatQuantity:u,testMode:y=!1},...R}){let[T,w]=f(R),S=T==="walletId"?`wallets/${w}`:`external-wallets/${w}`;return(await this.baseRequest.post(`/users/${e}/${S}/purchases`,{type:s,provider:i,walletType:t,address:a,networks:o,assets:c,defaultAsset:p,defaultNetwork:d,fiat:n,fiatQuantity:u,testMode:y})).data}async updateOnRampPurchase({userId:e,purchaseId:s,updates:t,...a}){let[i,o]=f(a),c=i==="walletId"?`wallets/${o}`:`external-wallets/${o}`;return(await this.baseRequest.patch(`/users/${e}/${c}/purchases/${s}`,t)).data}async getOnRampPurchase({userId:e,purchaseId:s,...t}){let[a,i]=f(t),o=a==="walletId"?`wallets/${i}`:`external-wallets/${i}`;return await this.baseRequest.get(`/users/${e}/${o}/purchases/${s}`)}async signMoonPayUrl(e,{url:s,type:t,cosmosPrefix:a,testMode:i,walletId:o,externalWalletAddress:c}){let d=o?`wallets/${o}`:`external-wallets/${c}`;return await this.baseRequest.post(`/users/${e}/${d}/moonpay-sign`,{url:s,type:t,cosmosPrefix:a,testMode:i})}async generateOffRampTx(e,{provider:s,chainId:t,contractAddress:a,testMode:i,walletId:o,walletType:c,destinationAddress:d,sourceAddress:p,assetQuantity:n}){return(await this.baseRequest.post(`/users/${e}/wallets/${o}/offramp-generate`,{provider:s,testMode:i,chainId:t,contractAddress:a,walletId:o,walletType:c,destinationAddress:d,sourceAddress:p,assetQuantity:n})).data}async sendOffRampTx(e,{tx:s,signature:t,network:a,walletId:i,walletType:o}){return(await this.baseRequest.post(`/users/${e}/wallets/${i}/offramp-send`,{tx:s,signature:t,network:a,walletType:o})).data}async distributeParaShare({userId:e,walletId:s,...t}){let a=t;return await this.baseRequest.post(`/users/${e}/wallets/${s}/capsule-share/distribute`,a)}async keepSessionAlive(e){return(await this.baseRequest.post(`/users/${e}/session/keep-alive`)).data}async persistRecoveryPublicKeys(e,s){return(await this.baseRequest.post(`/users/${e}/recovery-public-keys`,{publicKeys:s})).data}async getRecoveryPublicKeys(e){return(await this.baseRequest.get(`/users/${e}/recovery-public-keys`)).data}async uploadEncryptedWalletPrivateKey(e,s,t,a,i){let o={encryptedWalletPrivateKey:s,encryptionKeyHash:t,biometricPublicKey:a,passwordId:i};return(await this.baseRequest.post(`/users/${e}/encrypted-wallet-private-keys`,o)).data}async getEncryptedWalletPrivateKeys(e,s){return(await this.baseRequest.get(`/users/${e}/encrypted-wallet-private-keys/${s}`)).data}async getConversionRate(e,s,t){let a={symbol:s,currency:t};return(await this.baseRequest.get(`/chains/${e}/conversion-rate`,{params:a})).data}async getGasEstimate(e,s){let t={totalGasPrice:s};return(await this.baseRequest.get(`/chains/${e}/gas-estimate`,{params:t})).data}async getGasOracle(e){return(await this.baseRequest.get(`/chains/${e}/gas-oracle`)).data}async isRefreshDone(e,s,t,a){let i={};t&&(i.partnerId=t),a&&(i.protocolId=a);let o=A.stringify(i);return(await this.baseRequest.get(`/users/${e}/wallets/${s}/refresh-done?${o}`)).data}async deletePendingTransaction(e,s){return(await this.baseRequest.delete(`/users/${e}/pending-transactions/${s}`)).data}async addSessionPasswordPublicKey(e,s){return await this.baseRequest.post(`/users/${e}/passwords/key`,s)}async getSupportedAuthMethods(e){return(await this.baseRequest.get("/users/supported-auth-methods",{params:{...e}})).data}async getPasswords(e){return(await this.baseRequest.get("/users/passwords",{params:{...e}})).data.passwords}async verifyPasswordChallenge(e,s){return await this.baseRequest.post("/passwords/verify",s,{headers:{[h]:e}})}async getEncryptedWalletPrivateKey(e){let s={};s.passwordId=e;let t=A.stringify(s);return await this.baseRequest.get(`/encrypted-wallet-private-keys?${t}`)}async getUser(e){return(await this.baseRequest.get(`/users/${e}`)).data}},x=E;var k=(a=>(a.USER="USER",a.RECOVERY="RECOVERY",a.BIOMETRICS="BIOMETRICS",a.PASSWORD="PASSWORD",a))(k||{}),N=(s=>(s.USER="USER",s.RECOVERY="RECOVERY",s))(N||{}),D=(s=>(s.PENDING="PENDING",s.COMPLETE="COMPLETE",s))(D||{}),M=(s=>(s.PENDING="PENDING",s.COMPLETE="COMPLETE",s))(M||{}),G=(s=>(s.MOBILE="MOBILE",s.WEB="WEB",s))(G||{}),H=(c=>(c.GOOGLE="GOOGLE",c.TWITTER="TWITTER",c.APPLE="APPLE",c.DISCORD="DISCORD",c.FACEBOOK="FACEBOOK",c.FARCASTER="FARCASTER",c.TELEGRAM="TELEGRAM",c))(H||{}),_=(s=>(s.PASSWORD="PASSWORD",s.PASSKEY="PASSKEY",s))(_||{});var V=(s=>(s.LIGHT="light",s.DARK="dark",s))(V||{});var F=(t=>(t.RAMP="RAMP",t.STRIPE="STRIPE",t.MOONPAY="MOONPAY",t))(F||{}),Y=(n=>(n.ETHEREUM="ETHEREUM",n.USDC="USDC",n.TETHER="TETHER",n.POLYGON="POLYGON",n.SOLANA="SOLANA",n.ATOM="ATOM",n.CELO="CELO",n.CUSD="CUSD",n.CEUR="CEUR",n.CREAL="CREAL",n))(Y||{}),z=(t=>(t.INITIATED="INITIATED",t.FINISHED="FINISHED",t.CANCELLED="CANCELLED",t))(z||{}),Q=(s=>(s.BUY="BUY",s.SELL="SELL",s))(Q||{});var J=(t=>(t.DKLS="DKLS",t.CGGMP="CGGMP",t.ED25519="ED25519",t))(J||{}),X=(t=>(t.EVM="EVM",t.SOLANA="SOLANA",t.COSMOS="COSMOS",t))(X||{}),Z=(t=>(t.ETH="ETH",t.CELO="CELO",t.MATIC="MATIC",t))(Z||{}),j=(n=>(n.ETHEREUM="ETHEREUM",n.SEPOLIA="SEPOLIA",n.ARBITRUM="ARBITRUM",n.BASE="BASE",n.OPTIMISM="OPTIMISM",n.POLYGON="POLYGON",n.SOLANA="SOLANA",n.COSMOS="COSMOS",n.CELO="CELO",n.NOBLE="NOBLE",n))(j||{}),Pe=["EMAIL","PHONE","CUSTOM_ID","DISCORD","TWITTER","TELEGRAM"],Ee=["DKLS","CGGMP"];var Ie=x;export{_ as AuthMethod,Z as Chain,V as EmailTheme,k as EncryptorType,N as KeyShareType,Ee as NON_ED25519,j as Network,H as OAuthMethod,Y as OnRampAsset,F as OnRampProvider,z as OnRampPurchaseStatus,Q as OnRampPurchaseType,Pe as PREGEN_IDENTIFIER_TYPES,D as PasswordStatus,M as PublicKeyStatus,G as PublicKeyType,J as WalletScheme,X as WalletType,Ie as default,se as extractAuthInfo,f as extractWalletRef,B as handleResponseError,K as handleResponseSuccess,q as isEmail,O as isExternalWalletAddress,W as isFarcaster,C as isPhone,v as isTelegram,U as isUserId,$ as isWalletId};
|
|
1
|
+
// src/client.ts
|
|
2
|
+
import axios from "axios";
|
|
3
|
+
import qs from "qs";
|
|
4
|
+
|
|
5
|
+
// src/utils.ts
|
|
6
|
+
function isWalletId(params) {
|
|
7
|
+
return !!params.walletId && !params.externalWalletAddress;
|
|
8
|
+
}
|
|
9
|
+
function isExternalWalletAddress(params) {
|
|
10
|
+
return !!params.externalWalletAddress && !params.walletId;
|
|
11
|
+
}
|
|
12
|
+
function extractWalletRef(params) {
|
|
13
|
+
if (isWalletId(params)) {
|
|
14
|
+
return ["walletId", params.walletId];
|
|
15
|
+
} else if (isExternalWalletAddress(params)) {
|
|
16
|
+
return ["externalWalletAddress", params.externalWalletAddress];
|
|
17
|
+
}
|
|
18
|
+
throw new Error("invalid wallet params");
|
|
19
|
+
}
|
|
20
|
+
function isValid(s) {
|
|
21
|
+
return !!s && s !== "null" && s !== "undefined" && s !== "";
|
|
22
|
+
}
|
|
23
|
+
function isEmail(params) {
|
|
24
|
+
return isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId);
|
|
25
|
+
}
|
|
26
|
+
function isPhone(params) {
|
|
27
|
+
return isValid(params.phone) && isValid(params.countryCode) && !isValid(params.email) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId);
|
|
28
|
+
}
|
|
29
|
+
function isFarcaster(params) {
|
|
30
|
+
return isValid(params.farcasterUsername) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.telegramUserId);
|
|
31
|
+
}
|
|
32
|
+
function isTelegram(params) {
|
|
33
|
+
return isValid(params.telegramUserId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername);
|
|
34
|
+
}
|
|
35
|
+
function isUserId(params) {
|
|
36
|
+
return isValid(params.userId) && !isValid(params.email) && !isValid(params.phone) && !isValid(params.countryCode) && !isValid(params.farcasterUsername) && !isValid(params.telegramUserId);
|
|
37
|
+
}
|
|
38
|
+
function extractAuthInfo(obj, { allowUserId = false, isRequired = false } = {}) {
|
|
39
|
+
switch (true) {
|
|
40
|
+
case isEmail(obj):
|
|
41
|
+
return { auth: { email: obj.email }, authType: "email", identifier: obj.email, publicKeyIdentifier: obj.email };
|
|
42
|
+
case isPhone(obj):
|
|
43
|
+
return {
|
|
44
|
+
auth: { phone: obj.phone, countryCode: obj.countryCode },
|
|
45
|
+
authType: "phone",
|
|
46
|
+
identifier: `${obj.countryCode}${obj.phone}`,
|
|
47
|
+
publicKeyIdentifier: `${obj.countryCode}${obj.phone}`
|
|
48
|
+
};
|
|
49
|
+
case isFarcaster(obj):
|
|
50
|
+
return {
|
|
51
|
+
auth: { farcasterUsername: obj.farcasterUsername },
|
|
52
|
+
authType: "farcaster",
|
|
53
|
+
identifier: obj.farcasterUsername,
|
|
54
|
+
publicKeyIdentifier: `${obj.farcasterUsername}-farcaster`
|
|
55
|
+
};
|
|
56
|
+
case isTelegram(obj):
|
|
57
|
+
return {
|
|
58
|
+
auth: { telegramUserId: obj.telegramUserId },
|
|
59
|
+
authType: "telegram",
|
|
60
|
+
identifier: obj.telegramUserId,
|
|
61
|
+
publicKeyIdentifier: `${obj.telegramUserId}-telegram`
|
|
62
|
+
};
|
|
63
|
+
case (isUserId(obj) && allowUserId):
|
|
64
|
+
return { auth: { userId: obj.userId }, authType: "userId", identifier: obj.userId, publicKeyIdentifier: obj.userId };
|
|
65
|
+
default:
|
|
66
|
+
if (isRequired) {
|
|
67
|
+
throw new Error("invalid auth object");
|
|
68
|
+
}
|
|
69
|
+
return void 0;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// src/consts.ts
|
|
74
|
+
var SESSION_COOKIE_HEADER_NAME = "x-capsule-sid";
|
|
75
|
+
var VERSION_HEADER_NAME = "x-para-version";
|
|
76
|
+
var PARTNER_ID_HEADER_NAME = "x-partner-id";
|
|
77
|
+
var API_KEY_HEADER_NAME = "X-External-API-Key";
|
|
78
|
+
|
|
79
|
+
// src/error.ts
|
|
80
|
+
function ParaApiError(message, code, status, responseURL) {
|
|
81
|
+
Error.call(this);
|
|
82
|
+
if (Error.captureStackTrace) {
|
|
83
|
+
Error.captureStackTrace(this, this.constructor);
|
|
84
|
+
} else {
|
|
85
|
+
this.stack = new Error().stack;
|
|
86
|
+
}
|
|
87
|
+
this.message = message;
|
|
88
|
+
this.name = "ParaApiError";
|
|
89
|
+
code && (this.code = code);
|
|
90
|
+
status && (this.status = status);
|
|
91
|
+
responseURL && (this.responseURL = responseURL);
|
|
92
|
+
}
|
|
93
|
+
var prototype = ParaApiError.prototype;
|
|
94
|
+
Object.defineProperty(prototype, "isParaApiError", { value: true });
|
|
95
|
+
|
|
96
|
+
// src/client.ts
|
|
97
|
+
var handleResponseSuccess = (response) => {
|
|
98
|
+
if (response.status === 200) {
|
|
99
|
+
return response;
|
|
100
|
+
}
|
|
101
|
+
throw new ParaApiError("Invalid status code");
|
|
102
|
+
};
|
|
103
|
+
var handleResponseError = (error) => {
|
|
104
|
+
if (error === null) throw new ParaApiError("Error is null");
|
|
105
|
+
if (axios.isAxiosError(error)) {
|
|
106
|
+
let message = error.response?.data ?? "Unknown error";
|
|
107
|
+
if (error.code === "ERR_NETWORK") {
|
|
108
|
+
message = "Connection error";
|
|
109
|
+
} else if (error.code === "ERR_CANCELED") {
|
|
110
|
+
message = "Connection canceled";
|
|
111
|
+
}
|
|
112
|
+
throw new ParaApiError(message, error.code, error.response.status, error.request?.responseURL);
|
|
113
|
+
}
|
|
114
|
+
throw new ParaApiError("Unknown error");
|
|
115
|
+
};
|
|
116
|
+
var Client = class {
|
|
117
|
+
constructor({
|
|
118
|
+
userManagementHost,
|
|
119
|
+
apiKey,
|
|
120
|
+
partnerId,
|
|
121
|
+
version,
|
|
122
|
+
opts,
|
|
123
|
+
retrieveSessionCookie,
|
|
124
|
+
persistSessionCookie
|
|
125
|
+
}) {
|
|
126
|
+
this.createUser = async (body) => {
|
|
127
|
+
const res = await this.baseRequest.post(`/users`, body);
|
|
128
|
+
return res.data;
|
|
129
|
+
};
|
|
130
|
+
this.checkUserExists = async (auth) => {
|
|
131
|
+
const res = await this.baseRequest.get("/users/exists", {
|
|
132
|
+
params: { ...auth }
|
|
133
|
+
});
|
|
134
|
+
return res;
|
|
135
|
+
};
|
|
136
|
+
this.verifyTelegram = async (authObject) => {
|
|
137
|
+
return (await this.baseRequest.post("/users/telegram", {
|
|
138
|
+
authObject
|
|
139
|
+
})).data;
|
|
140
|
+
};
|
|
141
|
+
this.externalWalletLogin = async (body) => {
|
|
142
|
+
const res = await this.baseRequest.post(`/users/external-wallets/login`, body);
|
|
143
|
+
return res.data;
|
|
144
|
+
};
|
|
145
|
+
// POST /users/:userId/verify-email
|
|
146
|
+
this.verifyEmail = async (userId, body) => {
|
|
147
|
+
const res = await this.baseRequest.post(`/users/${userId}/verify-email`, body);
|
|
148
|
+
return res;
|
|
149
|
+
};
|
|
150
|
+
this.verifyPhone = async (userId, body) => {
|
|
151
|
+
const res = await this.baseRequest.post(`/users/${userId}/verify-identifier`, body);
|
|
152
|
+
return res;
|
|
153
|
+
};
|
|
154
|
+
this.verifyExternalWallet = async (userId, body) => {
|
|
155
|
+
const res = await this.baseRequest.post(`/users/${userId}/external-wallets/verify`, body);
|
|
156
|
+
return res;
|
|
157
|
+
};
|
|
158
|
+
// POST /users/:userId/biometrics/key
|
|
159
|
+
this.addSessionPublicKey = async (userId, body) => {
|
|
160
|
+
const res = await this.baseRequest.post(`/users/${userId}/biometrics/key`, body);
|
|
161
|
+
return res;
|
|
162
|
+
};
|
|
163
|
+
// GET /users/:userId/biometrics/keys
|
|
164
|
+
this.getSessionPublicKeys = async (userId) => {
|
|
165
|
+
const res = await this.baseRequest.get(`/users/${userId}/biometrics/keys`);
|
|
166
|
+
return res;
|
|
167
|
+
};
|
|
168
|
+
// GET /biometrics/location-hints
|
|
169
|
+
this.getBiometricLocationHints = async (params) => {
|
|
170
|
+
const res = await this.baseRequest.get(`/biometrics/location-hints`, { params });
|
|
171
|
+
return res.data.hints;
|
|
172
|
+
};
|
|
173
|
+
// GET /users/:userId/biometrics/:biometricId
|
|
174
|
+
this.getSessionPublicKey = async (userId, biometricId) => {
|
|
175
|
+
const res = await this.baseRequest.get(`/users/${userId}/biometrics/${biometricId}`);
|
|
176
|
+
return res;
|
|
177
|
+
};
|
|
178
|
+
// PATCH /users/:userId/biometrics/:biometricId
|
|
179
|
+
this.patchSessionPublicKey = async (partnerId, userId, biometricId, body) => {
|
|
180
|
+
const res = await this.baseRequest.patch(`/users/${userId}/biometrics/${biometricId}`, body, {
|
|
181
|
+
headers: {
|
|
182
|
+
[PARTNER_ID_HEADER_NAME]: partnerId
|
|
183
|
+
}
|
|
184
|
+
});
|
|
185
|
+
return res;
|
|
186
|
+
};
|
|
187
|
+
// GET /biometrics/challenge?email&publicKey
|
|
188
|
+
this.getWebChallenge = async (auth) => {
|
|
189
|
+
const res = await this.baseRequest.get("/biometrics/challenge", {
|
|
190
|
+
params: { ...auth || {} }
|
|
191
|
+
});
|
|
192
|
+
return res.data;
|
|
193
|
+
};
|
|
194
|
+
// POST /touch
|
|
195
|
+
this.touchSession = async (regenerate) => {
|
|
196
|
+
const res = await this.baseRequest.post(
|
|
197
|
+
`/touch?regenerate=${!!regenerate}`
|
|
198
|
+
);
|
|
199
|
+
return res;
|
|
200
|
+
};
|
|
201
|
+
// GET /session/origin
|
|
202
|
+
this.sessionOrigin = async (sessionLookupId) => {
|
|
203
|
+
const res = await this.baseRequest.get(`/sessions/${sessionLookupId}/origin`);
|
|
204
|
+
return res.data;
|
|
205
|
+
};
|
|
206
|
+
// POST /biometrics/verify
|
|
207
|
+
this.verifyWebChallenge = async (partnerId, body) => {
|
|
208
|
+
const res = await this.baseRequest.post(`/biometrics/verify`, body, {
|
|
209
|
+
headers: {
|
|
210
|
+
[PARTNER_ID_HEADER_NAME]: partnerId
|
|
211
|
+
}
|
|
212
|
+
});
|
|
213
|
+
return res;
|
|
214
|
+
};
|
|
215
|
+
// GET /users/:userId/biometrics/challenge
|
|
216
|
+
this.getSessionChallenge = async (userId) => {
|
|
217
|
+
const res = await this.baseRequest.get(`/users/${userId}/biometrics/challenge`);
|
|
218
|
+
return res;
|
|
219
|
+
};
|
|
220
|
+
// POST /users/:userId/biometrics/verify
|
|
221
|
+
this.verifySessionChallenge = async (userId, body) => {
|
|
222
|
+
const res = await this.baseRequest.post(`/users/${userId}/biometrics/verify`, body);
|
|
223
|
+
return res;
|
|
224
|
+
};
|
|
225
|
+
// POST /users/:userId/wallets
|
|
226
|
+
this.createWallet = async (userId, body) => {
|
|
227
|
+
const res = await this.baseRequest.post(`/users/${userId}/wallets`, body);
|
|
228
|
+
return res.data;
|
|
229
|
+
};
|
|
230
|
+
// POST /wallets/pregen
|
|
231
|
+
this.createPregenWallet = async (body) => {
|
|
232
|
+
const res = await this.baseRequest.post(`/wallets/pregen`, body);
|
|
233
|
+
return res.data;
|
|
234
|
+
};
|
|
235
|
+
// GET /wallets/pregen?pregenIdentifier={pregenIdentifier}&pregenIdentifierType={pregenIdentifierType}
|
|
236
|
+
this.getPregenWallets = async (pregenIds, isPortal = false, userId) => {
|
|
237
|
+
const res = await this.baseRequest.get("/wallets/pregen", {
|
|
238
|
+
params: { ids: pregenIds, expand: isPortal, userId }
|
|
239
|
+
});
|
|
240
|
+
return res.data;
|
|
241
|
+
};
|
|
242
|
+
// POST /wallets/pregen/claim
|
|
243
|
+
this.claimPregenWallets = async (body) => {
|
|
244
|
+
const res = await this.baseRequest.post(`/wallets/pregen/claim`, body);
|
|
245
|
+
return res.data;
|
|
246
|
+
};
|
|
247
|
+
// POST /users/:userId/wallets/:walletId/transactions/send
|
|
248
|
+
this.sendTransaction = async (userId, walletId, body) => {
|
|
249
|
+
const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/transactions/send`, body);
|
|
250
|
+
return res;
|
|
251
|
+
};
|
|
252
|
+
// functionality changed to only sign transactions and not send them
|
|
253
|
+
// POST /users/:userId/wallets/:walletId/transactions/sign
|
|
254
|
+
this.signTransaction = async (userId, walletId, body) => {
|
|
255
|
+
const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/transactions/sign`, body);
|
|
256
|
+
return res;
|
|
257
|
+
};
|
|
258
|
+
// POST /users/:userId/wallets/:walletId/refresh
|
|
259
|
+
this.refreshKeys = async (userId, walletId, oldPartnerId, newPartnerId, keyShareProtocolId) => {
|
|
260
|
+
const body = { oldPartnerId, newPartnerId, keyShareProtocolId };
|
|
261
|
+
const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/refresh`, body);
|
|
262
|
+
return res;
|
|
263
|
+
};
|
|
264
|
+
// PATCH /wallets/pregen/:walletId
|
|
265
|
+
this.updatePregenWallet = async (walletId, body) => {
|
|
266
|
+
const res = await this.baseRequest.patch(`/wallets/pregen/${walletId}`, body);
|
|
267
|
+
return res.data;
|
|
268
|
+
};
|
|
269
|
+
// GET /users/:userId/wallets
|
|
270
|
+
this.getWallets = async (userId, includePartnerData) => {
|
|
271
|
+
const res = await this.baseRequest.get(
|
|
272
|
+
`/users/${userId}/wallets${includePartnerData ? `?includePartnerData=${encodeURIComponent(includePartnerData)}` : ""}`
|
|
273
|
+
);
|
|
274
|
+
return res;
|
|
275
|
+
};
|
|
276
|
+
// GET /users/:userId/all-wallets
|
|
277
|
+
this.getAllWallets = async (userId) => {
|
|
278
|
+
const res = await this.baseRequest.get(`/users/${userId}/all-wallets`);
|
|
279
|
+
return res;
|
|
280
|
+
};
|
|
281
|
+
// POST /users/:userId/wallets/set
|
|
282
|
+
this.setCurrentWalletIds = async (userId, walletIds, needsWallet = false, sessionLookupId, newDeviceSessionLookupId) => {
|
|
283
|
+
const res = await this.baseRequest.post(`/users/${userId}/wallets/set`, {
|
|
284
|
+
walletIds,
|
|
285
|
+
needsWallet,
|
|
286
|
+
sessionLookupId,
|
|
287
|
+
newDeviceSessionLookupId
|
|
288
|
+
});
|
|
289
|
+
return res;
|
|
290
|
+
};
|
|
291
|
+
// POST /login
|
|
292
|
+
this.login = async (props) => {
|
|
293
|
+
const body = props;
|
|
294
|
+
const res = await this.baseRequest.post("/login", body);
|
|
295
|
+
return res;
|
|
296
|
+
};
|
|
297
|
+
// POST /login
|
|
298
|
+
this.verifyLogin = async (verificationCode) => {
|
|
299
|
+
const body = { verificationCode };
|
|
300
|
+
const res = await this.baseRequest.post("/login/verify-email", body);
|
|
301
|
+
return res;
|
|
302
|
+
};
|
|
303
|
+
// GET /logout
|
|
304
|
+
this.logout = async () => {
|
|
305
|
+
const res = await this.baseRequest.get("/logout");
|
|
306
|
+
return res;
|
|
307
|
+
};
|
|
308
|
+
// POST /recovery/verification
|
|
309
|
+
this.recoveryVerification = async (email, verificationCode) => {
|
|
310
|
+
const body = { email, verificationCode };
|
|
311
|
+
const res = await this.baseRequest.post("/recovery/verification", body);
|
|
312
|
+
return res;
|
|
313
|
+
};
|
|
314
|
+
// POST /recovery
|
|
315
|
+
this.recoveryInit = async (email) => {
|
|
316
|
+
const body = { email };
|
|
317
|
+
const res = await this.baseRequest.post("/recovery", body);
|
|
318
|
+
return res;
|
|
319
|
+
};
|
|
320
|
+
this.preSignMessage = async (userId, walletId, message, scheme, cosmosSignDoc) => {
|
|
321
|
+
const body = { message, scheme, cosmosSignDoc };
|
|
322
|
+
const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/messages/sign`, body);
|
|
323
|
+
return res.data;
|
|
324
|
+
};
|
|
325
|
+
//DELETE /users/:userId
|
|
326
|
+
this.deleteSelf = async (userId) => {
|
|
327
|
+
const res = await this.baseRequest.delete(`/users/${userId}`);
|
|
328
|
+
return res;
|
|
329
|
+
};
|
|
330
|
+
// GET /users/:userId/wallets/:walletId/capsule-share
|
|
331
|
+
this.getParaShare = async (userId, walletId) => {
|
|
332
|
+
const res = await this.baseRequest.get(`/users/${userId}/wallets/${walletId}/capsule-share`);
|
|
333
|
+
return res.data.share;
|
|
334
|
+
};
|
|
335
|
+
// GET /download-backup-kit/:userId
|
|
336
|
+
this.getBackupKit = async (userId) => {
|
|
337
|
+
const res = await this.baseRequest.get(`/download-backup-kit/${userId}`, { responseType: "blob" });
|
|
338
|
+
return res;
|
|
339
|
+
};
|
|
340
|
+
// PATCH /users/:userId/biometrics/:biometricId
|
|
341
|
+
this.patchSessionPassword = async (partnerId, userId, passwordId, body) => {
|
|
342
|
+
const res = await this.baseRequest.patch(`/users/${userId}/passwords/${passwordId}`, body, {
|
|
343
|
+
headers: {
|
|
344
|
+
[PARTNER_ID_HEADER_NAME]: partnerId
|
|
345
|
+
}
|
|
346
|
+
});
|
|
347
|
+
return res;
|
|
348
|
+
};
|
|
349
|
+
const headers = {
|
|
350
|
+
...apiKey && { [API_KEY_HEADER_NAME]: apiKey },
|
|
351
|
+
...partnerId && { [PARTNER_ID_HEADER_NAME]: partnerId }
|
|
352
|
+
};
|
|
353
|
+
const axiosConfig = {
|
|
354
|
+
baseURL: userManagementHost,
|
|
355
|
+
withCredentials: true,
|
|
356
|
+
headers
|
|
357
|
+
};
|
|
358
|
+
if (retrieveSessionCookie) {
|
|
359
|
+
const defaultTransformRequest = Array.isArray(axios.defaults.transformRequest) ? axios.defaults.transformRequest : [axios.defaults.transformRequest];
|
|
360
|
+
axiosConfig.transformRequest = [
|
|
361
|
+
function(data, headers2) {
|
|
362
|
+
const currentSessionCookie = retrieveSessionCookie();
|
|
363
|
+
if (currentSessionCookie) {
|
|
364
|
+
headers2[SESSION_COOKIE_HEADER_NAME] = currentSessionCookie;
|
|
365
|
+
}
|
|
366
|
+
if (version) {
|
|
367
|
+
headers2[VERSION_HEADER_NAME] = version;
|
|
368
|
+
}
|
|
369
|
+
return data;
|
|
370
|
+
},
|
|
371
|
+
...defaultTransformRequest
|
|
372
|
+
];
|
|
373
|
+
}
|
|
374
|
+
if (persistSessionCookie) {
|
|
375
|
+
const defaultTransformResponse = Array.isArray(axios.defaults.transformResponse) ? axios.defaults.transformResponse : [axios.defaults.transformResponse];
|
|
376
|
+
axiosConfig.transformResponse = [
|
|
377
|
+
...defaultTransformResponse,
|
|
378
|
+
function(data, headers2, _status) {
|
|
379
|
+
if (headers2?.[SESSION_COOKIE_HEADER_NAME]) {
|
|
380
|
+
persistSessionCookie(headers2[SESSION_COOKIE_HEADER_NAME]);
|
|
381
|
+
}
|
|
382
|
+
return data;
|
|
383
|
+
}
|
|
384
|
+
];
|
|
385
|
+
}
|
|
386
|
+
this.baseRequest = axios.create(axiosConfig);
|
|
387
|
+
if (opts?.useFetchAdapter) {
|
|
388
|
+
axios.defaults.adapter = function(config) {
|
|
389
|
+
return fetch(config.baseURL + config.url.substring(1), {
|
|
390
|
+
method: config.method,
|
|
391
|
+
headers: config.headers,
|
|
392
|
+
body: config.data,
|
|
393
|
+
credentials: config.withCredentials ? "include" : void 0
|
|
394
|
+
}).then(
|
|
395
|
+
(response) => response.text().then((text) => ({
|
|
396
|
+
data: text,
|
|
397
|
+
status: response.status,
|
|
398
|
+
statusText: response.statusText,
|
|
399
|
+
headers: response.headers,
|
|
400
|
+
config,
|
|
401
|
+
request: fetch
|
|
402
|
+
}))
|
|
403
|
+
).catch(function(reason) {
|
|
404
|
+
throw reason;
|
|
405
|
+
});
|
|
406
|
+
};
|
|
407
|
+
}
|
|
408
|
+
this.baseRequest.interceptors.response.use(handleResponseSuccess, handleResponseError);
|
|
409
|
+
}
|
|
410
|
+
// DEPRECATED: use uploadUserKeyShares instead
|
|
411
|
+
// POST /users/:userId/wallets/:walletId/key-shares
|
|
412
|
+
async uploadKeyshares(userId, walletId, encryptedKeyshares) {
|
|
413
|
+
const body = { keyShares: encryptedKeyshares };
|
|
414
|
+
const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/key-shares`, body);
|
|
415
|
+
return res;
|
|
416
|
+
}
|
|
417
|
+
// POST /users/:userId/key-shares
|
|
418
|
+
async uploadUserKeyShares(userId, encryptedKeyshares) {
|
|
419
|
+
const body = { keyShares: encryptedKeyshares };
|
|
420
|
+
const res = await this.baseRequest.post(`/users/${userId}/key-shares`, body);
|
|
421
|
+
return res;
|
|
422
|
+
}
|
|
423
|
+
// GET /users/:userId/wallets/:walletId/key-shares
|
|
424
|
+
async getKeyshare(userId, walletId, type, encryptor) {
|
|
425
|
+
const res = await this.baseRequest.get(
|
|
426
|
+
`/users/${userId}/wallets/${walletId}/key-shares?type=${type}${encryptor ? `&encryptor=${encryptor}` : ""}`
|
|
427
|
+
);
|
|
428
|
+
return res;
|
|
429
|
+
}
|
|
430
|
+
// GET /users/:userId/biometrics/key-shares
|
|
431
|
+
async getBiometricKeyshares(userId, biometricPublicKey, getAll) {
|
|
432
|
+
const res = await this.baseRequest.get(
|
|
433
|
+
`/users/${userId}/biometrics/key-shares?publicKey=${biometricPublicKey}&all=${!!getAll}`
|
|
434
|
+
);
|
|
435
|
+
return res;
|
|
436
|
+
}
|
|
437
|
+
// GET /users/:userId/key-shares
|
|
438
|
+
async getPasswordKeyshares(userId, passwordId, getAll) {
|
|
439
|
+
const res = await this.baseRequest.get(
|
|
440
|
+
`/users/${userId}/passwords/key-shares?passwordId=${passwordId}&all=${!!getAll}`
|
|
441
|
+
);
|
|
442
|
+
return res;
|
|
443
|
+
}
|
|
444
|
+
// POST '/users/:userId/temporary-shares',
|
|
445
|
+
async uploadTransmissionKeyshares(userId, shares) {
|
|
446
|
+
const body = { shares };
|
|
447
|
+
const res = await this.baseRequest.post(`/users/${userId}/temporary-shares`, body);
|
|
448
|
+
return res;
|
|
449
|
+
}
|
|
450
|
+
// GET /users/:userId/temporary-shares returns { temporaryShares: { userId: string, walletId: string, encryptedShare: string, encryptedKey?: string }[] }
|
|
451
|
+
async getTransmissionKeyshares(userId, sessionLookupId) {
|
|
452
|
+
const res = await this.baseRequest.get(`/users/${userId}/temporary-shares?sessionLookupId=${sessionLookupId}`);
|
|
453
|
+
return res;
|
|
454
|
+
}
|
|
455
|
+
// POST '/users/:userId/resend-verification-code
|
|
456
|
+
async resendVerificationCode({ userId, ...rest }) {
|
|
457
|
+
const res = await this.baseRequest.post(`/users/${userId}/resend-verification-code`, rest);
|
|
458
|
+
return res;
|
|
459
|
+
}
|
|
460
|
+
// POST '/users/:userId/resend-verification-code-by-phone
|
|
461
|
+
async resendVerificationCodeByPhone({ userId, ...rest }) {
|
|
462
|
+
const res = await this.baseRequest.post(`/users/${userId}/resend-verification-code-by-phone`, rest);
|
|
463
|
+
return res;
|
|
464
|
+
}
|
|
465
|
+
// POST recovery/cancel
|
|
466
|
+
async cancelRecoveryAttempt(email) {
|
|
467
|
+
const res = await this.baseRequest.post(`/recovery/cancel`, { email });
|
|
468
|
+
return res;
|
|
469
|
+
}
|
|
470
|
+
// GET '/2fa/users/:userId/check-status'
|
|
471
|
+
async check2FAStatus(userId) {
|
|
472
|
+
const res = await this.baseRequest.get(`/2fa/users/${userId}/check-status`);
|
|
473
|
+
return res;
|
|
474
|
+
}
|
|
475
|
+
// POST '/2fa/users/:userId/enable'
|
|
476
|
+
async enable2FA(userId, verificationCode) {
|
|
477
|
+
const res = await this.baseRequest.post(`/2fa/users/${userId}/enable`, { verificationCode });
|
|
478
|
+
return res;
|
|
479
|
+
}
|
|
480
|
+
// POST '/2fa/users/:userId/setup'
|
|
481
|
+
async setup2FA(userId) {
|
|
482
|
+
const res = await this.baseRequest.post(`/2fa/users/${userId}/setup`);
|
|
483
|
+
return res;
|
|
484
|
+
}
|
|
485
|
+
// POST /recovery/init
|
|
486
|
+
async initializeRecovery(email) {
|
|
487
|
+
const res = await this.baseRequest.post(`/recovery/init`, { email });
|
|
488
|
+
return res;
|
|
489
|
+
}
|
|
490
|
+
// POST /auth/farcaster/init
|
|
491
|
+
async initializeFarcasterLogin() {
|
|
492
|
+
const res = await this.baseRequest.post(`/auth/farcaster/init`);
|
|
493
|
+
return res;
|
|
494
|
+
}
|
|
495
|
+
// POST /auth/farcaster/status
|
|
496
|
+
async getFarcasterAuthStatus() {
|
|
497
|
+
const res = await this.baseRequest.post(`/auth/farcaster/status`);
|
|
498
|
+
return res;
|
|
499
|
+
}
|
|
500
|
+
// POST /recovery/init
|
|
501
|
+
async initializeRecoveryForPhone(phone, countryCode) {
|
|
502
|
+
const res = await this.baseRequest.post(`/recovery/init`, { phone, countryCode });
|
|
503
|
+
return res;
|
|
504
|
+
}
|
|
505
|
+
// POST /recovery/users/:userId/wallets/:walletId/finish
|
|
506
|
+
async finalizeRecovery(userId, walletId) {
|
|
507
|
+
const res = await this.baseRequest.post(`/recovery/users/${userId}/wallets/${walletId}/finish`);
|
|
508
|
+
return res;
|
|
509
|
+
}
|
|
510
|
+
// GET /recovery/users/:userId/wallets/:walletId/key-shares
|
|
511
|
+
async recoverUserShares(userId, walletId) {
|
|
512
|
+
const res = await this.baseRequest.get(`/recovery/users/${userId}/wallets/${walletId}/key-shares?type=USER&encryptor=RECOVERY`);
|
|
513
|
+
return res;
|
|
514
|
+
}
|
|
515
|
+
// POST /recovery/verify-email
|
|
516
|
+
async verifyEmailForRecovery(email, verificationCode) {
|
|
517
|
+
const body = { email, verificationCode };
|
|
518
|
+
const res = await this.baseRequest.post(`/recovery/verify-email`, body);
|
|
519
|
+
return res;
|
|
520
|
+
}
|
|
521
|
+
// POST /recovery/verify-identifier
|
|
522
|
+
async verifyPhoneForRecovery(phone, countryCode, verificationCode) {
|
|
523
|
+
const body = { phone, countryCode, verificationCode };
|
|
524
|
+
const res = await this.baseRequest.post(`/recovery/verify-identifier`, body);
|
|
525
|
+
return res;
|
|
526
|
+
}
|
|
527
|
+
// POST /2fa/verify
|
|
528
|
+
async verify2FA(email, verificationCode) {
|
|
529
|
+
const body = { email, verificationCode };
|
|
530
|
+
const res = await this.baseRequest.post("/2fa/verify", body);
|
|
531
|
+
return res;
|
|
532
|
+
}
|
|
533
|
+
// POST /2fa/phone/verify
|
|
534
|
+
async verify2FAForPhone(phone, countryCode, verificationCode) {
|
|
535
|
+
const body = { phone, countryCode, verificationCode };
|
|
536
|
+
const res = await this.baseRequest.post("/2fa/verify", body);
|
|
537
|
+
return res;
|
|
538
|
+
}
|
|
539
|
+
async tempTrasmissionInit(message, userId) {
|
|
540
|
+
const body = { message, userId };
|
|
541
|
+
const res = await this.baseRequest.post("/temporary-transmissions", body);
|
|
542
|
+
return res;
|
|
543
|
+
}
|
|
544
|
+
async tempTrasmission(id) {
|
|
545
|
+
const res = await this.baseRequest.get(`/temporary-transmissions/${id}`);
|
|
546
|
+
return res;
|
|
547
|
+
}
|
|
548
|
+
async getPartner(partnerId) {
|
|
549
|
+
const res = await this.baseRequest.get(`/partners/${partnerId}`);
|
|
550
|
+
return res;
|
|
551
|
+
}
|
|
552
|
+
async acceptScopes(userId, walletId, body) {
|
|
553
|
+
const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/scopes/accept`, body);
|
|
554
|
+
return res;
|
|
555
|
+
}
|
|
556
|
+
async getPendingTransaction(userId, pendingTransactionId) {
|
|
557
|
+
const res = await this.baseRequest.get(`/users/${userId}/pending-transactions/${pendingTransactionId}`);
|
|
558
|
+
return res;
|
|
559
|
+
}
|
|
560
|
+
async acceptPendingTransaction(userId, pendingTransactionId) {
|
|
561
|
+
const res = await this.baseRequest.post(`/users/${userId}/pending-transactions/${pendingTransactionId}/accept`);
|
|
562
|
+
return res;
|
|
563
|
+
}
|
|
564
|
+
async getOnRampConfig() {
|
|
565
|
+
const res = await this.baseRequest.get(`/on-ramp-config`);
|
|
566
|
+
return res.data;
|
|
567
|
+
}
|
|
568
|
+
async createOnRampPurchase({
|
|
569
|
+
userId,
|
|
570
|
+
params: {
|
|
571
|
+
type,
|
|
572
|
+
walletType,
|
|
573
|
+
address,
|
|
574
|
+
provider,
|
|
575
|
+
networks,
|
|
576
|
+
assets,
|
|
577
|
+
defaultNetwork,
|
|
578
|
+
defaultAsset,
|
|
579
|
+
fiat,
|
|
580
|
+
fiatQuantity,
|
|
581
|
+
testMode = false
|
|
582
|
+
},
|
|
583
|
+
...params
|
|
584
|
+
}) {
|
|
585
|
+
const [key, identifier] = extractWalletRef(params);
|
|
586
|
+
const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
|
|
587
|
+
const res = await this.baseRequest.post(`/users/${userId}/${walletString}/purchases`, {
|
|
588
|
+
type,
|
|
589
|
+
provider,
|
|
590
|
+
walletType,
|
|
591
|
+
address,
|
|
592
|
+
networks,
|
|
593
|
+
assets,
|
|
594
|
+
defaultAsset,
|
|
595
|
+
defaultNetwork,
|
|
596
|
+
fiat,
|
|
597
|
+
fiatQuantity,
|
|
598
|
+
testMode
|
|
599
|
+
});
|
|
600
|
+
return res.data;
|
|
601
|
+
}
|
|
602
|
+
async updateOnRampPurchase({
|
|
603
|
+
userId,
|
|
604
|
+
purchaseId,
|
|
605
|
+
updates,
|
|
606
|
+
...params
|
|
607
|
+
}) {
|
|
608
|
+
const [key, identifier] = extractWalletRef(params);
|
|
609
|
+
const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
|
|
610
|
+
const res = await this.baseRequest.patch(
|
|
611
|
+
`/users/${userId}/${walletString}/purchases/${purchaseId}`,
|
|
612
|
+
updates
|
|
613
|
+
);
|
|
614
|
+
return res.data;
|
|
615
|
+
}
|
|
616
|
+
async getOnRampPurchase({
|
|
617
|
+
userId,
|
|
618
|
+
purchaseId,
|
|
619
|
+
...params
|
|
620
|
+
}) {
|
|
621
|
+
const [key, identifier] = extractWalletRef(params);
|
|
622
|
+
const walletString = key === "walletId" ? `wallets/${identifier}` : `external-wallets/${identifier}`;
|
|
623
|
+
const res = await this.baseRequest.get(`/users/${userId}/${walletString}/purchases/${purchaseId}`);
|
|
624
|
+
return res;
|
|
625
|
+
}
|
|
626
|
+
async signMoonPayUrl(userId, {
|
|
627
|
+
url,
|
|
628
|
+
type,
|
|
629
|
+
cosmosPrefix,
|
|
630
|
+
testMode,
|
|
631
|
+
walletId,
|
|
632
|
+
externalWalletAddress
|
|
633
|
+
}) {
|
|
634
|
+
const walletString = walletId ? `wallets/${walletId}` : `external-wallets/${externalWalletAddress}`;
|
|
635
|
+
const res = await this.baseRequest.post(`/users/${userId}/${walletString}/moonpay-sign`, {
|
|
636
|
+
url,
|
|
637
|
+
type,
|
|
638
|
+
cosmosPrefix,
|
|
639
|
+
testMode
|
|
640
|
+
});
|
|
641
|
+
return res;
|
|
642
|
+
}
|
|
643
|
+
async generateOffRampTx(userId, {
|
|
644
|
+
provider,
|
|
645
|
+
chainId,
|
|
646
|
+
contractAddress,
|
|
647
|
+
testMode,
|
|
648
|
+
walletId,
|
|
649
|
+
walletType,
|
|
650
|
+
destinationAddress,
|
|
651
|
+
sourceAddress,
|
|
652
|
+
assetQuantity
|
|
653
|
+
}) {
|
|
654
|
+
const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/offramp-generate`, {
|
|
655
|
+
provider,
|
|
656
|
+
testMode,
|
|
657
|
+
chainId,
|
|
658
|
+
contractAddress,
|
|
659
|
+
walletId,
|
|
660
|
+
walletType,
|
|
661
|
+
destinationAddress,
|
|
662
|
+
sourceAddress,
|
|
663
|
+
assetQuantity
|
|
664
|
+
});
|
|
665
|
+
return res.data;
|
|
666
|
+
}
|
|
667
|
+
async sendOffRampTx(userId, {
|
|
668
|
+
tx,
|
|
669
|
+
signature,
|
|
670
|
+
network,
|
|
671
|
+
walletId,
|
|
672
|
+
walletType
|
|
673
|
+
}) {
|
|
674
|
+
const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/offramp-send`, {
|
|
675
|
+
tx,
|
|
676
|
+
signature,
|
|
677
|
+
network,
|
|
678
|
+
walletType
|
|
679
|
+
});
|
|
680
|
+
return res.data;
|
|
681
|
+
}
|
|
682
|
+
async distributeParaShare({
|
|
683
|
+
userId,
|
|
684
|
+
walletId,
|
|
685
|
+
...rest
|
|
686
|
+
}) {
|
|
687
|
+
const body = rest;
|
|
688
|
+
const res = await this.baseRequest.post(`/users/${userId}/wallets/${walletId}/capsule-share/distribute`, body);
|
|
689
|
+
return res;
|
|
690
|
+
}
|
|
691
|
+
async keepSessionAlive(userId) {
|
|
692
|
+
const res = await this.baseRequest.post(`/users/${userId}/session/keep-alive`);
|
|
693
|
+
return res.data;
|
|
694
|
+
}
|
|
695
|
+
async persistRecoveryPublicKeys(userId, publicKeys) {
|
|
696
|
+
const res = await this.baseRequest.post(`/users/${userId}/recovery-public-keys`, { publicKeys });
|
|
697
|
+
return res.data;
|
|
698
|
+
}
|
|
699
|
+
async getRecoveryPublicKeys(userId) {
|
|
700
|
+
const res = await this.baseRequest.get(`/users/${userId}/recovery-public-keys`);
|
|
701
|
+
return res.data;
|
|
702
|
+
}
|
|
703
|
+
async uploadEncryptedWalletPrivateKey(userId, encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey, passwordId) {
|
|
704
|
+
const body = { encryptedWalletPrivateKey, encryptionKeyHash, biometricPublicKey, passwordId };
|
|
705
|
+
const res = await this.baseRequest.post(`/users/${userId}/encrypted-wallet-private-keys`, body);
|
|
706
|
+
return res.data;
|
|
707
|
+
}
|
|
708
|
+
async getEncryptedWalletPrivateKeys(userId, encryptionKeyHash) {
|
|
709
|
+
const res = await this.baseRequest.get(`/users/${userId}/encrypted-wallet-private-keys/${encryptionKeyHash}`);
|
|
710
|
+
return res.data;
|
|
711
|
+
}
|
|
712
|
+
async getConversionRate(chainId, symbol, currency) {
|
|
713
|
+
const params = { symbol, currency };
|
|
714
|
+
const res = await this.baseRequest.get(`/chains/${chainId}/conversion-rate`, { params });
|
|
715
|
+
return res.data;
|
|
716
|
+
}
|
|
717
|
+
async getGasEstimate(chainId, totalGasPrice) {
|
|
718
|
+
const params = { totalGasPrice };
|
|
719
|
+
const res = await this.baseRequest.get(`/chains/${chainId}/gas-estimate`, { params });
|
|
720
|
+
return res.data;
|
|
721
|
+
}
|
|
722
|
+
async getGasOracle(chainId) {
|
|
723
|
+
const res = await this.baseRequest.get(`/chains/${chainId}/gas-oracle`);
|
|
724
|
+
return res.data;
|
|
725
|
+
}
|
|
726
|
+
// GET /users/:userId/wallets/:walletId/refresh-done
|
|
727
|
+
async isRefreshDone(userId, walletId, partnerId, protocolId) {
|
|
728
|
+
const queryParams = {};
|
|
729
|
+
if (partnerId) queryParams["partnerId"] = partnerId;
|
|
730
|
+
if (protocolId) queryParams["protocolId"] = protocolId;
|
|
731
|
+
const query = qs.stringify(queryParams);
|
|
732
|
+
const res = await this.baseRequest.get(`/users/${userId}/wallets/${walletId}/refresh-done?${query}`);
|
|
733
|
+
return res.data;
|
|
734
|
+
}
|
|
735
|
+
async deletePendingTransaction(userId, pendingTransactionId) {
|
|
736
|
+
const res = await this.baseRequest.delete(`/users/${userId}/pending-transactions/${pendingTransactionId}`);
|
|
737
|
+
return res.data;
|
|
738
|
+
}
|
|
739
|
+
// POST /users/:userId/passwords/key
|
|
740
|
+
async addSessionPasswordPublicKey(userId, body) {
|
|
741
|
+
const res = await this.baseRequest.post(`/users/${userId}/passwords/key`, body);
|
|
742
|
+
return res;
|
|
743
|
+
}
|
|
744
|
+
async getSupportedAuthMethods(auth) {
|
|
745
|
+
const res = await this.baseRequest.get("/users/supported-auth-methods", {
|
|
746
|
+
params: { ...auth }
|
|
747
|
+
});
|
|
748
|
+
return res.data;
|
|
749
|
+
}
|
|
750
|
+
async getPasswords(auth) {
|
|
751
|
+
const res = await this.baseRequest.get("/users/passwords", {
|
|
752
|
+
params: { ...auth }
|
|
753
|
+
});
|
|
754
|
+
return res.data.passwords;
|
|
755
|
+
}
|
|
756
|
+
// POST /passwords/verify
|
|
757
|
+
async verifyPasswordChallenge(partnerId, body) {
|
|
758
|
+
const res = await this.baseRequest.post(`/passwords/verify`, body, {
|
|
759
|
+
headers: {
|
|
760
|
+
[PARTNER_ID_HEADER_NAME]: partnerId
|
|
761
|
+
}
|
|
762
|
+
});
|
|
763
|
+
return res;
|
|
764
|
+
}
|
|
765
|
+
async getEncryptedWalletPrivateKey(passwordId) {
|
|
766
|
+
const queryParams = {};
|
|
767
|
+
queryParams["passwordId"] = passwordId;
|
|
768
|
+
const query = qs.stringify(queryParams);
|
|
769
|
+
const res = await this.baseRequest.get(`/encrypted-wallet-private-keys?${query}`);
|
|
770
|
+
return res;
|
|
771
|
+
}
|
|
772
|
+
// GET /users/:userId
|
|
773
|
+
async getUser(userId) {
|
|
774
|
+
const res = await this.baseRequest.get(`/users/${userId}`);
|
|
775
|
+
return res.data;
|
|
776
|
+
}
|
|
777
|
+
};
|
|
778
|
+
var client_default = Client;
|
|
779
|
+
|
|
780
|
+
// src/types/auth.ts
|
|
781
|
+
var EncryptorType = /* @__PURE__ */ ((EncryptorType2) => {
|
|
782
|
+
EncryptorType2["USER"] = "USER";
|
|
783
|
+
EncryptorType2["RECOVERY"] = "RECOVERY";
|
|
784
|
+
EncryptorType2["BIOMETRICS"] = "BIOMETRICS";
|
|
785
|
+
EncryptorType2["PASSWORD"] = "PASSWORD";
|
|
786
|
+
return EncryptorType2;
|
|
787
|
+
})(EncryptorType || {});
|
|
788
|
+
var KeyShareType = /* @__PURE__ */ ((KeyShareType2) => {
|
|
789
|
+
KeyShareType2["USER"] = "USER";
|
|
790
|
+
KeyShareType2["RECOVERY"] = "RECOVERY";
|
|
791
|
+
return KeyShareType2;
|
|
792
|
+
})(KeyShareType || {});
|
|
793
|
+
var PasswordStatus = /* @__PURE__ */ ((PasswordStatus2) => {
|
|
794
|
+
PasswordStatus2["PENDING"] = "PENDING";
|
|
795
|
+
PasswordStatus2["COMPLETE"] = "COMPLETE";
|
|
796
|
+
return PasswordStatus2;
|
|
797
|
+
})(PasswordStatus || {});
|
|
798
|
+
var PublicKeyStatus = /* @__PURE__ */ ((PublicKeyStatus2) => {
|
|
799
|
+
PublicKeyStatus2["PENDING"] = "PENDING";
|
|
800
|
+
PublicKeyStatus2["COMPLETE"] = "COMPLETE";
|
|
801
|
+
return PublicKeyStatus2;
|
|
802
|
+
})(PublicKeyStatus || {});
|
|
803
|
+
var PublicKeyType = /* @__PURE__ */ ((PublicKeyType2) => {
|
|
804
|
+
PublicKeyType2["MOBILE"] = "MOBILE";
|
|
805
|
+
PublicKeyType2["WEB"] = "WEB";
|
|
806
|
+
return PublicKeyType2;
|
|
807
|
+
})(PublicKeyType || {});
|
|
808
|
+
var OAuthMethod = /* @__PURE__ */ ((OAuthMethod2) => {
|
|
809
|
+
OAuthMethod2["GOOGLE"] = "GOOGLE";
|
|
810
|
+
OAuthMethod2["TWITTER"] = "TWITTER";
|
|
811
|
+
OAuthMethod2["APPLE"] = "APPLE";
|
|
812
|
+
OAuthMethod2["DISCORD"] = "DISCORD";
|
|
813
|
+
OAuthMethod2["FACEBOOK"] = "FACEBOOK";
|
|
814
|
+
OAuthMethod2["FARCASTER"] = "FARCASTER";
|
|
815
|
+
OAuthMethod2["TELEGRAM"] = "TELEGRAM";
|
|
816
|
+
return OAuthMethod2;
|
|
817
|
+
})(OAuthMethod || {});
|
|
818
|
+
var AuthMethod = /* @__PURE__ */ ((AuthMethod2) => {
|
|
819
|
+
AuthMethod2["PASSWORD"] = "PASSWORD";
|
|
820
|
+
AuthMethod2["PASSKEY"] = "PASSKEY";
|
|
821
|
+
return AuthMethod2;
|
|
822
|
+
})(AuthMethod || {});
|
|
823
|
+
|
|
824
|
+
// src/types/email.ts
|
|
825
|
+
var EmailTheme = /* @__PURE__ */ ((EmailTheme2) => {
|
|
826
|
+
EmailTheme2["LIGHT"] = "light";
|
|
827
|
+
EmailTheme2["DARK"] = "dark";
|
|
828
|
+
return EmailTheme2;
|
|
829
|
+
})(EmailTheme || {});
|
|
830
|
+
|
|
831
|
+
// src/types/onRamp.ts
|
|
832
|
+
var OnRampProvider = /* @__PURE__ */ ((OnRampProvider2) => {
|
|
833
|
+
OnRampProvider2["RAMP"] = "RAMP";
|
|
834
|
+
OnRampProvider2["STRIPE"] = "STRIPE";
|
|
835
|
+
OnRampProvider2["MOONPAY"] = "MOONPAY";
|
|
836
|
+
return OnRampProvider2;
|
|
837
|
+
})(OnRampProvider || {});
|
|
838
|
+
var OnRampAsset = /* @__PURE__ */ ((OnRampAsset2) => {
|
|
839
|
+
OnRampAsset2["ETHEREUM"] = "ETHEREUM";
|
|
840
|
+
OnRampAsset2["USDC"] = "USDC";
|
|
841
|
+
OnRampAsset2["TETHER"] = "TETHER";
|
|
842
|
+
OnRampAsset2["POLYGON"] = "POLYGON";
|
|
843
|
+
OnRampAsset2["SOLANA"] = "SOLANA";
|
|
844
|
+
OnRampAsset2["ATOM"] = "ATOM";
|
|
845
|
+
OnRampAsset2["CELO"] = "CELO";
|
|
846
|
+
OnRampAsset2["CUSD"] = "CUSD";
|
|
847
|
+
OnRampAsset2["CEUR"] = "CEUR";
|
|
848
|
+
OnRampAsset2["CREAL"] = "CREAL";
|
|
849
|
+
return OnRampAsset2;
|
|
850
|
+
})(OnRampAsset || {});
|
|
851
|
+
var OnRampPurchaseStatus = /* @__PURE__ */ ((OnRampPurchaseStatus2) => {
|
|
852
|
+
OnRampPurchaseStatus2["INITIATED"] = "INITIATED";
|
|
853
|
+
OnRampPurchaseStatus2["FINISHED"] = "FINISHED";
|
|
854
|
+
OnRampPurchaseStatus2["CANCELLED"] = "CANCELLED";
|
|
855
|
+
return OnRampPurchaseStatus2;
|
|
856
|
+
})(OnRampPurchaseStatus || {});
|
|
857
|
+
var OnRampPurchaseType = /* @__PURE__ */ ((OnRampPurchaseType2) => {
|
|
858
|
+
OnRampPurchaseType2["BUY"] = "BUY";
|
|
859
|
+
OnRampPurchaseType2["SELL"] = "SELL";
|
|
860
|
+
return OnRampPurchaseType2;
|
|
861
|
+
})(OnRampPurchaseType || {});
|
|
862
|
+
|
|
863
|
+
// src/types/wallet.ts
|
|
864
|
+
var WalletScheme = /* @__PURE__ */ ((WalletScheme2) => {
|
|
865
|
+
WalletScheme2["DKLS"] = "DKLS";
|
|
866
|
+
WalletScheme2["CGGMP"] = "CGGMP";
|
|
867
|
+
WalletScheme2["ED25519"] = "ED25519";
|
|
868
|
+
return WalletScheme2;
|
|
869
|
+
})(WalletScheme || {});
|
|
870
|
+
var WalletType = /* @__PURE__ */ ((WalletType2) => {
|
|
871
|
+
WalletType2["EVM"] = "EVM";
|
|
872
|
+
WalletType2["SOLANA"] = "SOLANA";
|
|
873
|
+
WalletType2["COSMOS"] = "COSMOS";
|
|
874
|
+
return WalletType2;
|
|
875
|
+
})(WalletType || {});
|
|
876
|
+
var Chain = /* @__PURE__ */ ((Chain2) => {
|
|
877
|
+
Chain2["ETH"] = "ETH";
|
|
878
|
+
Chain2["CELO"] = "CELO";
|
|
879
|
+
Chain2["MATIC"] = "MATIC";
|
|
880
|
+
return Chain2;
|
|
881
|
+
})(Chain || {});
|
|
882
|
+
var Network = /* @__PURE__ */ ((Network2) => {
|
|
883
|
+
Network2["ETHEREUM"] = "ETHEREUM";
|
|
884
|
+
Network2["SEPOLIA"] = "SEPOLIA";
|
|
885
|
+
Network2["ARBITRUM"] = "ARBITRUM";
|
|
886
|
+
Network2["BASE"] = "BASE";
|
|
887
|
+
Network2["OPTIMISM"] = "OPTIMISM";
|
|
888
|
+
Network2["POLYGON"] = "POLYGON";
|
|
889
|
+
Network2["SOLANA"] = "SOLANA";
|
|
890
|
+
Network2["COSMOS"] = "COSMOS";
|
|
891
|
+
Network2["CELO"] = "CELO";
|
|
892
|
+
Network2["NOBLE"] = "NOBLE";
|
|
893
|
+
return Network2;
|
|
894
|
+
})(Network || {});
|
|
895
|
+
var PREGEN_IDENTIFIER_TYPES = [
|
|
896
|
+
"EMAIL",
|
|
897
|
+
"PHONE",
|
|
898
|
+
"CUSTOM_ID",
|
|
899
|
+
"DISCORD" /* DISCORD */,
|
|
900
|
+
"TWITTER" /* TWITTER */,
|
|
901
|
+
"TELEGRAM" /* TELEGRAM */
|
|
902
|
+
];
|
|
903
|
+
var NON_ED25519 = ["DKLS" /* DKLS */, "CGGMP" /* CGGMP */];
|
|
904
|
+
|
|
905
|
+
// src/index.ts
|
|
906
|
+
var src_default = client_default;
|
|
907
|
+
export {
|
|
908
|
+
AuthMethod,
|
|
909
|
+
Chain,
|
|
910
|
+
EmailTheme,
|
|
911
|
+
EncryptorType,
|
|
912
|
+
KeyShareType,
|
|
913
|
+
NON_ED25519,
|
|
914
|
+
Network,
|
|
915
|
+
OAuthMethod,
|
|
916
|
+
OnRampAsset,
|
|
917
|
+
OnRampProvider,
|
|
918
|
+
OnRampPurchaseStatus,
|
|
919
|
+
OnRampPurchaseType,
|
|
920
|
+
PREGEN_IDENTIFIER_TYPES,
|
|
921
|
+
PasswordStatus,
|
|
922
|
+
PublicKeyStatus,
|
|
923
|
+
PublicKeyType,
|
|
924
|
+
WalletScheme,
|
|
925
|
+
WalletType,
|
|
926
|
+
src_default as default,
|
|
927
|
+
extractAuthInfo,
|
|
928
|
+
extractWalletRef,
|
|
929
|
+
handleResponseError,
|
|
930
|
+
handleResponseSuccess,
|
|
931
|
+
isEmail,
|
|
932
|
+
isExternalWalletAddress,
|
|
933
|
+
isFarcaster,
|
|
934
|
+
isPhone,
|
|
935
|
+
isTelegram,
|
|
936
|
+
isUserId,
|
|
937
|
+
isWalletId
|
|
938
|
+
};
|