@haechi-labs/face-types
Advanced tools
Comparing version 1.10.9 to 1.10.10
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("ethers");var r;exports.Network=void 0,(r=exports.Network||(exports.Network={})).ETHEREUM="ethereum",r.ROPSTEN="ropsten",r.GOERLI="goerli",r.POLYGON="polygon",r.MUMBAI="mumbai",r.BNB_SMART_CHAIN="bnb_smart_chain",r.BNB_SMART_CHAIN_TESTNET="bnb_smart_chain_testnet",r.KLAYTN="klaytn",r.BAOBAB="baobab",r.SOLANA="solana",r.SOLANA_DEVNET="solana_devnet",r.NEAR="near",r.NEAR_TESTNET="near_testnet",r.BORA="bora",r.BORA_TESTNET="bora_testnet",r.ETH_MAINNET="ethereum",r.ETH_TESTNET="ropsten",r.MATIC_MAINNET="polygon",r.MATIC_TESTNET="mumbai",r.BINANCE_COIN_MAINNET="bnb_smart_chain",r.BINANCE_COIN_TESTNET="bnb_smart_chain_testnet",r.KLAYTN_MAINNET="klaytn",r.KLAYTN_TESTNET="baobab",r.APTOS="aptoslab",r.APTOS_TESTNET="aptoslab_testnet",r.MEVERSE="meverse",r.MEVERSE_TESTNET="meverse_testnet",r.PSM="psm",r.PSM_TESTNET="psm_testnet",r.PSM_TESTNET_TEST="psm_testnet_test",r.PSM_TESTNET_DEV="psm_testnet_dev",r.HOME_VERSE="home_verse",r.HOME_VERSE_TESTNET="home_verse_testnet",r.YOOLDO_VERSE="yooldo_verse",r.YOOLDO_VERSE_TESTNET="yooldo_verse_testnet";const t={[exports.Network.ETHEREUM]:1,[exports.Network.ROPSTEN]:3,[exports.Network.GOERLI]:5,[exports.Network.POLYGON]:137,[exports.Network.MUMBAI]:80001,[exports.Network.BNB_SMART_CHAIN]:56,[exports.Network.BNB_SMART_CHAIN_TESTNET]:97,[exports.Network.KLAYTN]:8217,[exports.Network.BAOBAB]:1001,[exports.Network.SOLANA]:0,[exports.Network.SOLANA_DEVNET]:0,[exports.Network.NEAR]:0,[exports.Network.NEAR_TESTNET]:0,[exports.Network.BORA]:77001,[exports.Network.BORA_TESTNET]:99001,[exports.Network.APTOS]:1,[exports.Network.APTOS_TESTNET]:2,[exports.Network.MEVERSE]:7518,[exports.Network.MEVERSE_TESTNET]:4759,[exports.Network.PSM_TESTNET_DEV]:100,[exports.Network.PSM_TESTNET_TEST]:400,[exports.Network.PSM_TESTNET]:500,[exports.Network.PSM]:91002,[exports.Network.HOME_VERSE]:19011,[exports.Network.HOME_VERSE_TESTNET]:40875,[exports.Network.YOOLDO_VERSE]:411,[exports.Network.YOOLDO_VERSE_TESTNET]:20197,1:exports.Network.ETHEREUM,3:exports.Network.ROPSTEN,5:exports.Network.GOERLI,137:exports.Network.POLYGON,80001:exports.Network.MUMBAI,56:exports.Network.BNB_SMART_CHAIN,97:exports.Network.BNB_SMART_CHAIN_TESTNET,8217:exports.Network.KLAYTN,1001:exports.Network.BAOBAB,77001:exports.Network.BORA,99001:exports.Network.BORA_TESTNET,7518:exports.Network.MEVERSE,4759:exports.Network.MEVERSE_TESTNET,100:exports.Network.PSM_TESTNET_DEV,400:exports.Network.PSM_TESTNET_TEST,500:exports.Network.PSM_TESTNET,91002:exports.Network.PSM,19011:exports.Network.HOME_VERSE,40875:exports.Network.HOME_VERSE_TESTNET,411:exports.Network.YOOLDO_VERSE,20197:exports.Network.YOOLDO_VERSE_TESTNET};var o;exports.Blockchain=void 0,(o=exports.Blockchain||(exports.Blockchain={})).ETHEREUM="ETHEREUM",o.POLYGON="POLYGON",o.BNB_SMART_CHAIN="BNB_SMART_CHAIN",o.KLAYTN="KLAYTN",o.SOLANA="SOLANA",o.NEAR="NEAR",o.BORA="BORA",o.APTOS="APTOS",o.MEVERSE="MEVERSE",o.PSM="PSM",o.PSM_TEST="PSM_TEST",o.PSM_DEV="PSM_DEV",o.HOME_VERSE="HOME_VERSE",o.YOOLDO_VERSE="YOOLDO_VERSE";const s=[exports.Blockchain.ETHEREUM,exports.Blockchain.POLYGON,exports.Blockchain.BNB_SMART_CHAIN,exports.Blockchain.KLAYTN,exports.Blockchain.BORA,exports.Blockchain.MEVERSE,exports.Blockchain.PSM,exports.Blockchain.PSM_DEV,exports.Blockchain.PSM_TEST,exports.Blockchain.HOME_VERSE,exports.Blockchain.YOOLDO_VERSE];var E,n,a,c,N,_,T,i;exports.BoraPortalConnectStatusEnum=void 0,(E=exports.BoraPortalConnectStatusEnum||(exports.BoraPortalConnectStatusEnum={})).Connected="CONNECTED",E.Unconnected="UNCONNECTED";class p{constructor(e,r){p.ensureHexString(e),p.checkLength(e,r),this.hex=e,this.length=r}static empty(){return new p("",0)}static fromUint8Array(e){return new p(S(e),e.length)}static fromHex(e,r){return new p(e,r)}static ensureHexString(e){try{if(""===e)return;if(null==e)throw new Error(`hex is null ${e}`);if(!e.startsWith("0x"))throw new Error(`hex does not start with 0x ${e}`);if(null==e.match("0x[0-9a-fA-F]+"))throw new Error(`invalid hex data ${e}`)}catch(e){throw e}}static checkLength(e,r){if(0===e.length)return;if(4*(e.length-2)/8>r)throw new Error(`length is less than hex data ${e}, ${r}`)}toString(){return this.hex}toHex(){return this.hex}toBigNumber(){return e.BigNumber.from(this.hex)}toJSON(){return{hex:this.hex,length:this.length}}static fromJSON(e){const{hex:r,length:t}=JSON.parse(e);return new p(r,t)}static fromBigNumber(e,r){return p.fromHex(e.toHexString(),r)}toUInt8Array(){const e=this.hex.substring(2),r=[];for(let t=0;t<e.length;t+=2)r.push(parseInt(e.substring(t,t+2),16));return new Uint8Array(r)}static concat(e,r){try{const t=e.toUInt8Array(),o=r.toUInt8Array(),s=new Uint8Array(t.length+o.length);s.set(t),s.set(o,t.length);const E=S(s);return new p(E,t.length+o.length)}catch(e){return console.debug("concat error",e),p.empty()}}split(e){const r=this.toUInt8Array();return[p.fromUint8Array(r.slice(0,e)),p.fromUint8Array(r.slice(e))]}clone(){return new p(this.hex,this.length)}unsafeSetLength(e){this.length=e}}function S(e){return"0x"+[...e].map((e=>e.toString(16).padStart(2,"0"))).join("")}function A(e){return function(e){return null===e}(e)||function(e){return void 0===e}(e)}exports.Env=void 0,(n=exports.Env||(exports.Env={})).Local="Local",n.Dev="Dev",n.StageTest="StageTest",n.StageMainnet="StageMainnet",n.ProdTest="ProdTest",n.ProdMainnet="ProdMainnet",exports.JsonRpcMethod=void 0,(a=exports.JsonRpcMethod||(exports.JsonRpcMethod={})).face_logInSignUp="face_logInSignUp",a.face_loggedIn="face_loggedIn",a.face_logOut="face_logOut",a.face_open2fa="face_open2fa",a.face_currentUser="face_currentUser",a.face_accounts="face_accounts",a.face_getUserVerificationToken="face_getUserVerificationToken",a.face_openIframe="face_openIframe",a.face_closeIframe="face_closeIframe",a.face_ready="face_ready",a.face_openHome="face_openHome",a.face_openKit="face_openKit",a.face_connectExternalWallet="face_connectExternalWallet",a.face_openWalletConnect="face_openWalletConnect",a.face_confirmWalletConnectDapp="face_confirmWalletConnectDapp",a.face_switchNetwork="face_switchNetwork",a.face_directSocialLogin="face_directSocialLogin",a.face_getIdToken="face_getIdToken",a.face_loginWithIdToken="face_loginWithIdToken",a.face_loginWithAccessToken="face_loginWithAccessToken",a.face_showToast="face_showToast",a.bora_connect="bora_connect",a.bora_isConnected="bora_isConnected",a.eth_sendTransaction="eth_sendTransaction",a.eth_getBalance="eth_getBalance",a.eth_call="eth_call",a.eth_estimateGas="eth_estimateGas",a.eth_sign="eth_sign",a.eth_signTypedData_v3="eth_signTypedData_v3",a.eth_signTypedData_v4="eth_signTypedData_v4",a.eth_accounts="eth_accounts",a.personal_sign="personal_sign",a.personal_listAccounts="personal_listAccounts",a.wallet_switchEthereumChain="wallet_switchEthereumChain",a.solana_sendTransaction="solana_sendTransaction",a.near_broadcast_tx_async="near_broadcast_tx_async",a.near_get_balance="near_get_balance",a.aptos_signMultiAgentTransaction="aptos_signMultiAgentTransaction",a.aptos_signMessage="aptos_signMessage",a.aptos_signTransaction="aptos_signTransaction",a.aptos_signAndSubmitTransaction="aptos_signAndSubmitTransaction",exports.JsonRpcSource=void 0,(c=exports.JsonRpcSource||(exports.JsonRpcSource={})).FACE_SDK="FACE_SDK",c.FACE_IFRAME="FACE_IFRAME",c.FACE_WALLET_CONNECT="FACE_WALLET_CONNECT",c.FACE_NATIVE_SDK="FACE_NATIVE_SDK",exports.RpcErrorCode=void 0,(N=exports.RpcErrorCode||(exports.RpcErrorCode={}))[N.PARSE_ERROR=-32700]="PARSE_ERROR",N[N.INVALID_REQUEST=-32600]="INVALID_REQUEST",N[N.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",N[N.INVALID_PARAMS=-32602]="INVALID_PARAMS",N[N.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",exports.HttpStatus=void 0,(_=exports.HttpStatus||(exports.HttpStatus={}))[_.SUCCESS=200]="SUCCESS",_[_.CREATED=201]="CREATED",_[_.BAD_REQUEST=400]="BAD_REQUEST",_[_.UNAUTHORIZED=401]="UNAUTHORIZED",_[_.FORBIDDEN=403]="FORBIDDEN",_[_.NOT_FOUND=404]="NOT_FOUND",_[_.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",exports.FaceErrorCode=void 0,(T=exports.FaceErrorCode||(exports.FaceErrorCode={}))[T.INVALID_ARGUMENT=4e3]="INVALID_ARGUMENT",T[T.USER_REJECTED_REQUEST=4001]="USER_REJECTED_REQUEST",T[T.NOT_IMPLEMENTED=4002]="NOT_IMPLEMENTED",T[T.BAD_REQUEST=4003]="BAD_REQUEST",T[T.SEND_TRANSACTION_FAILED=4004]="SEND_TRANSACTION_FAILED",T[T.SIGN_FAILED=4005]="SIGN_FAILED",T[T.UNAUTHORIZED=4100]="UNAUTHORIZED",T[T.NO_USER_DATA=4101]="NO_USER_DATA",T[T.AUTHENTICATION=4102]="AUTHENTICATION",T[T.UNSUPPORTED_SOCIAL_PROVIDER=4103]="UNSUPPORTED_SOCIAL_PROVIDER",T[T.INVALID_ENVIRONMENT=4200]="INVALID_ENVIRONMENT",T[T.UNSUPPORTED_METHOD=4201]="UNSUPPORTED_METHOD",T[T.UNSUPPORTED_CHAIN=4202]="UNSUPPORTED_CHAIN",T[T.INVALID_WALLET=4300]="INVALID_WALLET",T[T.PROVIDERS_AND_WALLETS_CONFIG_ERROR=4301]="PROVIDERS_AND_WALLETS_CONFIG_ERROR",T[T.INVALID_SIGNATURE_MESSAGE=4906]="INVALID_SIGNATURE_MESSAGE",T[T.INVALID_BORA_API_AND_SECRET_KEY=4907]="INVALID_BORA_API_AND_SECRET_KEY",T[T.ALREADY_CONNECTED_OTHER_BAPP_USN=4909]="ALREADY_CONNECTED_OTHER_BAPP_USN",T[T.BORA_SERVICE_REGION_IS_WRONG=4910]="BORA_SERVICE_REGION_IS_WRONG",T[T.INTERNAL=5e3]="INTERNAL";class x extends Error{static isFaceError(e){return e.isFaceError}isValidErrorCode(e){return!A(r=e)&&"number"==typeof r&&Object.values(exports.RpcErrorCode).includes(r)||function(e){return!A(e)&&"number"==typeof e&&Object.values(exports.FaceErrorCode).includes(e)}(e);var r}constructor(e){super(),this.isFaceError=!0,this.code=this.isValidErrorCode(e.code)?e.code:exports.FaceErrorCode.INTERNAL,this.message=`Face Error: [${this.code}] ${e.message}`,e.origin&&(e.origin.isFaceError&&e.origin.origin?this.origin=e.origin.origin:this.origin=e.origin),e.data&&(this.data=e.data),Object.setPrototypeOf(this,x.prototype),Error.captureStackTrace(this,this.constructor)}}function R(e){return O({message:`invalid ${e}`,code:exports.FaceErrorCode.INVALID_ARGUMENT})}function O(e){return new x(e)}function l(e,r,t){if(!e)throw r(...null!=t?t:[])}exports.TxType=void 0,(i=exports.TxType||(exports.TxType={})).COIN="COIN",i.ERC20="ERC20",i.ERC721="ERC721",i.ERC1155="ERC1155",i.FT="FT",i.CONVERT="CONVERT";var u;exports.UserStatus=void 0,(u=exports.UserStatus||(exports.UserStatus={})).isWalletCreated="isWalletCreated",u.isNewUser="isNewUser",u.isRegisteredPinCode="isRegisteredPinCode",u.isAdmin="isAdmin",exports.CryptoBuffer=p,exports.FaceAuthSessionKey="Face-Auth-Session",exports.FaceError=x,exports.FaceOAuthResultKey="Face-OAuth-Result",exports.FaceVersionLocalKey="Face-Version",exports.LoginProvider={Google:"google.com",Apple:"apple.com",Twitter:"twitter.com",Discord:"discord.com",Facebook:"facebook.com",Kakao:"kakao.com"},exports.NetworkChainIdMap=t,exports.WalletPath="m/44'/60'/1'/0/0",exports.alreadyConnectedToOtherBappusn=function(e){return O({message:"already connected to other bappusn",code:exports.FaceErrorCode.ALREADY_CONNECTED_OTHER_BAPP_USN,origin:e})},exports.assert=l,exports.assertArgument=function(e,r,t,o=!0){(o||e)&&l(!!e&&r,R,[t])},exports.boraServiceRegionIsWrong=function(e){return new x({message:"bora service region is wrong",code:exports.FaceErrorCode.BORA_SERVICE_REGION_IS_WRONG,origin:e})},exports.getEthlikeBlockchains=function(){return s},exports.getPlatFormCoinDecimalByBlockchain=e=>{switch(e){case exports.Blockchain.ETHEREUM:case exports.Blockchain.POLYGON:case exports.Blockchain.KLAYTN:case exports.Blockchain.BNB_SMART_CHAIN:case exports.Blockchain.BORA:case exports.Blockchain.MEVERSE:case exports.Blockchain.PSM:case exports.Blockchain.PSM_DEV:case exports.Blockchain.PSM_TEST:case exports.Blockchain.HOME_VERSE:case exports.Blockchain.YOOLDO_VERSE:return 18;case exports.Blockchain.SOLANA:return 9;case exports.Blockchain.NEAR:return 24;case exports.Blockchain.APTOS:return 8;default:throw new Error("unsupported blockchain")}},exports.invalidApiKeyError=function(e){return O({message:"invalid api key error",code:exports.FaceErrorCode.UNAUTHORIZED,origin:e})},exports.invalidArgumentError=R,exports.invalidBoraPortalIdAndSecretKey=function(e){return O({message:"Not found bapp. please contact FaceWallet Team to register BoraPortal Client Id/SecretKey.",code:exports.FaceErrorCode.INVALID_BORA_API_AND_SECRET_KEY,origin:e})},exports.invalidEnvironmentError=function(e){return O({message:"invalid environment",code:exports.FaceErrorCode.INVALID_ENVIRONMENT,data:{env:e}})},exports.invalidHostNameError=function(e){return O({message:"invalid host name error",code:exports.FaceErrorCode.UNAUTHORIZED,origin:e})},exports.invalidSignatureError=function(e){return O({message:"Invalid Signature message.",code:exports.FaceErrorCode.INVALID_SIGNATURE_MESSAGE,origin:e})},exports.invalidWallet=function(){return O({message:"invalid wallet error",code:exports.FaceErrorCode.INVALID_WALLET})},exports.isEthlikeBlockchain=function(e){return-1!==s.indexOf(e)},exports.isSupportedNetwork=e=>{switch(e){case exports.Network.ETHEREUM:case exports.Network.GOERLI:case exports.Network.POLYGON:case exports.Network.MUMBAI:case exports.Network.BNB_SMART_CHAIN:case exports.Network.BNB_SMART_CHAIN_TESTNET:case exports.Network.KLAYTN:case exports.Network.BAOBAB:case exports.Network.SOLANA:case exports.Network.SOLANA_DEVNET:case exports.Network.NEAR:case exports.Network.NEAR_TESTNET:case exports.Network.BORA:case exports.Network.BORA_TESTNET:case exports.Network.APTOS:case exports.Network.APTOS_TESTNET:case exports.Network.MEVERSE:case exports.Network.MEVERSE_TESTNET:case exports.Network.PSM_TESTNET:case exports.Network.PSM_TESTNET_DEV:case exports.Network.PSM_TESTNET_TEST:case exports.Network.HOME_VERSE:case exports.Network.HOME_VERSE_TESTNET:case exports.Network.YOOLDO_VERSE:case exports.Network.YOOLDO_VERSE_TESTNET:return!0;default:return!1}},exports.kitProvidersAndWalletsConfigError=function(){return O({message:"Both wallets and providers cannot be empty.",code:exports.FaceErrorCode.PROVIDERS_AND_WALLETS_CONFIG_ERROR})},exports.makeError=O,exports.networkToBlockchain=function(e){switch(e){case exports.Network.ETHEREUM:case exports.Network.ROPSTEN:case exports.Network.GOERLI:return exports.Blockchain.ETHEREUM;case exports.Network.POLYGON:case exports.Network.MUMBAI:return exports.Blockchain.POLYGON;case exports.Network.BNB_SMART_CHAIN:case exports.Network.BNB_SMART_CHAIN_TESTNET:return exports.Blockchain.BNB_SMART_CHAIN;case exports.Network.KLAYTN:case exports.Network.BAOBAB:return exports.Blockchain.KLAYTN;case exports.Network.SOLANA:case exports.Network.SOLANA_DEVNET:return exports.Blockchain.SOLANA;case exports.Network.BORA:case exports.Network.BORA_TESTNET:return exports.Blockchain.BORA;case exports.Network.NEAR:case exports.Network.NEAR_TESTNET:return exports.Blockchain.NEAR;case exports.Network.APTOS:case exports.Network.APTOS_TESTNET:return exports.Blockchain.APTOS;case exports.Network.MEVERSE:case exports.Network.MEVERSE_TESTNET:return exports.Blockchain.MEVERSE;case exports.Network.PSM:case exports.Network.PSM_TESTNET:return exports.Blockchain.PSM;case exports.Network.PSM_TESTNET_TEST:return exports.Blockchain.PSM_TEST;case exports.Network.PSM_TESTNET_DEV:return exports.Blockchain.PSM_DEV;case exports.Network.HOME_VERSE:case exports.Network.HOME_VERSE_TESTNET:return exports.Blockchain.HOME_VERSE;case exports.Network.YOOLDO_VERSE:case exports.Network.YOOLDO_VERSE_TESTNET:return exports.Blockchain.YOOLDO_VERSE}throw new Error(`Unsupported network: ${e}`)},exports.noUserDataError=function(){return O({message:"no user data",code:exports.FaceErrorCode.NO_USER_DATA})},exports.notImplementedError=function(e){return O({message:e,code:exports.FaceErrorCode.NOT_IMPLEMENTED})},exports.oauthError=function(e,r){return O({message:`OAuth 2.0 Error: ${e}`,code:exports.FaceErrorCode.AUTHENTICATION,origin:r})},exports.parseFaceSolanaNearTransactionPayload=function(e){return null==e||"object"!=typeof e||null==e.serializedHex||"string"!=typeof e.serializedHex?null:e},exports.sendTransactionError=function(e){return O({message:e.message,code:exports.FaceErrorCode.SEND_TRANSACTION_FAILED,data:e.data})},exports.signError=function(e){return O({message:e,code:exports.FaceErrorCode.SIGN_FAILED})},exports.unknownError=function(e){return O({message:"unknown error",code:exports.FaceErrorCode.INTERNAL,origin:e})},exports.unsupportedChainError=function(e){return O({message:"unsupported chain error",code:exports.FaceErrorCode.UNSUPPORTED_CHAIN,origin:e})},exports.unsupportedProviderError=function(e){return O({message:`${e} login is not supported.`,code:exports.FaceErrorCode.UNSUPPORTED_SOCIAL_PROVIDER})},exports.unsupportedTokenProviderError=function(e){return O({message:`${e} is not support get id token`,code:exports.FaceErrorCode.UNSUPPORTED_SOCIAL_PROVIDER})},exports.userRejectedRequest=function(e){return O({code:exports.FaceErrorCode.USER_REJECTED_REQUEST,message:"user rejected request",data:{path:e}})}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("ethers");var r;exports.Network=void 0,(r=exports.Network||(exports.Network={})).ETHEREUM="ethereum",r.ROPSTEN="ropsten",r.GOERLI="goerli",r.POLYGON="polygon",r.MUMBAI="mumbai",r.BNB_SMART_CHAIN="bnb_smart_chain",r.BNB_SMART_CHAIN_TESTNET="bnb_smart_chain_testnet",r.KLAYTN="klaytn",r.BAOBAB="baobab",r.SOLANA="solana",r.SOLANA_DEVNET="solana_devnet",r.NEAR="near",r.NEAR_TESTNET="near_testnet",r.BORA="bora",r.BORA_TESTNET="bora_testnet",r.ETH_MAINNET="ethereum",r.ETH_TESTNET="ropsten",r.MATIC_MAINNET="polygon",r.MATIC_TESTNET="mumbai",r.BINANCE_COIN_MAINNET="bnb_smart_chain",r.BINANCE_COIN_TESTNET="bnb_smart_chain_testnet",r.KLAYTN_MAINNET="klaytn",r.KLAYTN_TESTNET="baobab",r.APTOS="aptoslab",r.APTOS_TESTNET="aptoslab_testnet",r.MEVERSE="meverse",r.MEVERSE_TESTNET="meverse_testnet",r.PSM="psm",r.PSM_TESTNET="psm_testnet",r.PSM_TESTNET_TEST="psm_testnet_test",r.PSM_TESTNET_DEV="psm_testnet_dev",r.HOME_VERSE="home_verse",r.HOME_VERSE_TESTNET="home_verse_testnet",r.YOOLDO_VERSE="yooldo_verse",r.YOOLDO_VERSE_TESTNET="yooldo_verse_testnet",r.OASYS="oasys",r.OASYS_TESTNET="oasys_testnet";const t={[exports.Network.ETHEREUM]:1,[exports.Network.ROPSTEN]:3,[exports.Network.GOERLI]:5,[exports.Network.POLYGON]:137,[exports.Network.MUMBAI]:80001,[exports.Network.BNB_SMART_CHAIN]:56,[exports.Network.BNB_SMART_CHAIN_TESTNET]:97,[exports.Network.KLAYTN]:8217,[exports.Network.BAOBAB]:1001,[exports.Network.SOLANA]:0,[exports.Network.SOLANA_DEVNET]:0,[exports.Network.NEAR]:0,[exports.Network.NEAR_TESTNET]:0,[exports.Network.BORA]:77001,[exports.Network.BORA_TESTNET]:99001,[exports.Network.APTOS]:1,[exports.Network.APTOS_TESTNET]:2,[exports.Network.MEVERSE]:7518,[exports.Network.MEVERSE_TESTNET]:4759,[exports.Network.PSM_TESTNET_DEV]:100,[exports.Network.PSM_TESTNET_TEST]:400,[exports.Network.PSM_TESTNET]:500,[exports.Network.PSM]:91002,[exports.Network.HOME_VERSE]:19011,[exports.Network.HOME_VERSE_TESTNET]:40875,[exports.Network.YOOLDO_VERSE]:411,[exports.Network.YOOLDO_VERSE_TESTNET]:20197,[exports.Network.OASYS]:248,[exports.Network.OASYS_TESTNET]:9372,1:exports.Network.ETHEREUM,3:exports.Network.ROPSTEN,5:exports.Network.GOERLI,137:exports.Network.POLYGON,80001:exports.Network.MUMBAI,56:exports.Network.BNB_SMART_CHAIN,97:exports.Network.BNB_SMART_CHAIN_TESTNET,8217:exports.Network.KLAYTN,1001:exports.Network.BAOBAB,77001:exports.Network.BORA,99001:exports.Network.BORA_TESTNET,7518:exports.Network.MEVERSE,4759:exports.Network.MEVERSE_TESTNET,100:exports.Network.PSM_TESTNET_DEV,400:exports.Network.PSM_TESTNET_TEST,500:exports.Network.PSM_TESTNET,91002:exports.Network.PSM,19011:exports.Network.HOME_VERSE,40875:exports.Network.HOME_VERSE_TESTNET,411:exports.Network.YOOLDO_VERSE,20197:exports.Network.YOOLDO_VERSE_TESTNET,248:exports.Network.OASYS,9372:exports.Network.OASYS_TESTNET};var o;exports.Blockchain=void 0,(o=exports.Blockchain||(exports.Blockchain={})).ETHEREUM="ETHEREUM",o.POLYGON="POLYGON",o.BNB_SMART_CHAIN="BNB_SMART_CHAIN",o.KLAYTN="KLAYTN",o.SOLANA="SOLANA",o.NEAR="NEAR",o.BORA="BORA",o.APTOS="APTOS",o.MEVERSE="MEVERSE",o.PSM="PSM",o.PSM_TEST="PSM_TEST",o.PSM_DEV="PSM_DEV",o.HOME_VERSE="HOME_VERSE",o.YOOLDO_VERSE="YOOLDO_VERSE",o.OASYS="OASYS";const s=[exports.Blockchain.ETHEREUM,exports.Blockchain.POLYGON,exports.Blockchain.BNB_SMART_CHAIN,exports.Blockchain.KLAYTN,exports.Blockchain.BORA,exports.Blockchain.MEVERSE,exports.Blockchain.PSM,exports.Blockchain.PSM_DEV,exports.Blockchain.PSM_TEST,exports.Blockchain.HOME_VERSE,exports.Blockchain.YOOLDO_VERSE,exports.Blockchain.OASYS];var E,n,a,c,N,_,T,i;exports.BoraPortalConnectStatusEnum=void 0,(E=exports.BoraPortalConnectStatusEnum||(exports.BoraPortalConnectStatusEnum={})).Connected="CONNECTED",E.Unconnected="UNCONNECTED";class p{constructor(e,r){p.ensureHexString(e),p.checkLength(e,r),this.hex=e,this.length=r}static empty(){return new p("",0)}static fromUint8Array(e){return new p(S(e),e.length)}static fromHex(e,r){return new p(e,r)}static ensureHexString(e){try{if(""===e)return;if(null==e)throw new Error(`hex is null ${e}`);if(!e.startsWith("0x"))throw new Error(`hex does not start with 0x ${e}`);if(null==e.match("0x[0-9a-fA-F]+"))throw new Error(`invalid hex data ${e}`)}catch(e){throw e}}static checkLength(e,r){if(0===e.length)return;if(4*(e.length-2)/8>r)throw new Error(`length is less than hex data ${e}, ${r}`)}toString(){return this.hex}toHex(){return this.hex}toBigNumber(){return e.BigNumber.from(this.hex)}toJSON(){return{hex:this.hex,length:this.length}}static fromJSON(e){const{hex:r,length:t}=JSON.parse(e);return new p(r,t)}static fromBigNumber(e,r){return p.fromHex(e.toHexString(),r)}toUInt8Array(){const e=this.hex.substring(2),r=[];for(let t=0;t<e.length;t+=2)r.push(parseInt(e.substring(t,t+2),16));return new Uint8Array(r)}static concat(e,r){try{const t=e.toUInt8Array(),o=r.toUInt8Array(),s=new Uint8Array(t.length+o.length);s.set(t),s.set(o,t.length);const E=S(s);return new p(E,t.length+o.length)}catch(e){return console.debug("concat error",e),p.empty()}}split(e){const r=this.toUInt8Array();return[p.fromUint8Array(r.slice(0,e)),p.fromUint8Array(r.slice(e))]}clone(){return new p(this.hex,this.length)}unsafeSetLength(e){this.length=e}}function S(e){return"0x"+[...e].map((e=>e.toString(16).padStart(2,"0"))).join("")}function A(e){return function(e){return null===e}(e)||function(e){return void 0===e}(e)}exports.Env=void 0,(n=exports.Env||(exports.Env={})).Local="Local",n.Dev="Dev",n.StageTest="StageTest",n.StageMainnet="StageMainnet",n.ProdTest="ProdTest",n.ProdMainnet="ProdMainnet",exports.JsonRpcMethod=void 0,(a=exports.JsonRpcMethod||(exports.JsonRpcMethod={})).face_logInSignUp="face_logInSignUp",a.face_loggedIn="face_loggedIn",a.face_logOut="face_logOut",a.face_open2fa="face_open2fa",a.face_currentUser="face_currentUser",a.face_accounts="face_accounts",a.face_getUserVerificationToken="face_getUserVerificationToken",a.face_openIframe="face_openIframe",a.face_closeIframe="face_closeIframe",a.face_ready="face_ready",a.face_openHome="face_openHome",a.face_openKit="face_openKit",a.face_connectExternalWallet="face_connectExternalWallet",a.face_openWalletConnect="face_openWalletConnect",a.face_confirmWalletConnectDapp="face_confirmWalletConnectDapp",a.face_switchNetwork="face_switchNetwork",a.face_directSocialLogin="face_directSocialLogin",a.face_getIdToken="face_getIdToken",a.face_loginWithIdToken="face_loginWithIdToken",a.face_loginWithAccessToken="face_loginWithAccessToken",a.face_showToast="face_showToast",a.bora_connect="bora_connect",a.bora_isConnected="bora_isConnected",a.eth_sendTransaction="eth_sendTransaction",a.eth_getBalance="eth_getBalance",a.eth_call="eth_call",a.eth_estimateGas="eth_estimateGas",a.eth_sign="eth_sign",a.eth_signTypedData_v3="eth_signTypedData_v3",a.eth_signTypedData_v4="eth_signTypedData_v4",a.eth_accounts="eth_accounts",a.personal_sign="personal_sign",a.personal_listAccounts="personal_listAccounts",a.wallet_switchEthereumChain="wallet_switchEthereumChain",a.solana_sendTransaction="solana_sendTransaction",a.near_broadcast_tx_async="near_broadcast_tx_async",a.near_get_balance="near_get_balance",a.aptos_signMultiAgentTransaction="aptos_signMultiAgentTransaction",a.aptos_signMessage="aptos_signMessage",a.aptos_signTransaction="aptos_signTransaction",a.aptos_signAndSubmitTransaction="aptos_signAndSubmitTransaction",exports.JsonRpcSource=void 0,(c=exports.JsonRpcSource||(exports.JsonRpcSource={})).FACE_SDK="FACE_SDK",c.FACE_IFRAME="FACE_IFRAME",c.FACE_WALLET_CONNECT="FACE_WALLET_CONNECT",c.FACE_NATIVE_SDK="FACE_NATIVE_SDK",exports.RpcErrorCode=void 0,(N=exports.RpcErrorCode||(exports.RpcErrorCode={}))[N.PARSE_ERROR=-32700]="PARSE_ERROR",N[N.INVALID_REQUEST=-32600]="INVALID_REQUEST",N[N.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",N[N.INVALID_PARAMS=-32602]="INVALID_PARAMS",N[N.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",exports.HttpStatus=void 0,(_=exports.HttpStatus||(exports.HttpStatus={}))[_.SUCCESS=200]="SUCCESS",_[_.CREATED=201]="CREATED",_[_.BAD_REQUEST=400]="BAD_REQUEST",_[_.UNAUTHORIZED=401]="UNAUTHORIZED",_[_.FORBIDDEN=403]="FORBIDDEN",_[_.NOT_FOUND=404]="NOT_FOUND",_[_.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",exports.FaceErrorCode=void 0,(T=exports.FaceErrorCode||(exports.FaceErrorCode={}))[T.INVALID_ARGUMENT=4e3]="INVALID_ARGUMENT",T[T.USER_REJECTED_REQUEST=4001]="USER_REJECTED_REQUEST",T[T.NOT_IMPLEMENTED=4002]="NOT_IMPLEMENTED",T[T.BAD_REQUEST=4003]="BAD_REQUEST",T[T.SEND_TRANSACTION_FAILED=4004]="SEND_TRANSACTION_FAILED",T[T.SIGN_FAILED=4005]="SIGN_FAILED",T[T.UNAUTHORIZED=4100]="UNAUTHORIZED",T[T.NO_USER_DATA=4101]="NO_USER_DATA",T[T.AUTHENTICATION=4102]="AUTHENTICATION",T[T.UNSUPPORTED_SOCIAL_PROVIDER=4103]="UNSUPPORTED_SOCIAL_PROVIDER",T[T.INVALID_ENVIRONMENT=4200]="INVALID_ENVIRONMENT",T[T.UNSUPPORTED_METHOD=4201]="UNSUPPORTED_METHOD",T[T.UNSUPPORTED_CHAIN=4202]="UNSUPPORTED_CHAIN",T[T.INVALID_WALLET=4300]="INVALID_WALLET",T[T.PROVIDERS_AND_WALLETS_CONFIG_ERROR=4301]="PROVIDERS_AND_WALLETS_CONFIG_ERROR",T[T.INVALID_SIGNATURE_MESSAGE=4906]="INVALID_SIGNATURE_MESSAGE",T[T.INVALID_BORA_API_AND_SECRET_KEY=4907]="INVALID_BORA_API_AND_SECRET_KEY",T[T.ALREADY_CONNECTED_OTHER_BAPP_USN=4909]="ALREADY_CONNECTED_OTHER_BAPP_USN",T[T.BORA_SERVICE_REGION_IS_WRONG=4910]="BORA_SERVICE_REGION_IS_WRONG",T[T.INTERNAL=5e3]="INTERNAL";class x extends Error{static isFaceError(e){return e.isFaceError}isValidErrorCode(e){return!A(r=e)&&"number"==typeof r&&Object.values(exports.RpcErrorCode).includes(r)||function(e){return!A(e)&&"number"==typeof e&&Object.values(exports.FaceErrorCode).includes(e)}(e);var r}constructor(e){super(),this.isFaceError=!0,this.code=this.isValidErrorCode(e.code)?e.code:exports.FaceErrorCode.INTERNAL,this.message=`Face Error: [${this.code}] ${e.message}`,e.origin&&(e.origin.isFaceError&&e.origin.origin?this.origin=e.origin.origin:this.origin=e.origin),e.data&&(this.data=e.data),Object.setPrototypeOf(this,x.prototype),Error.captureStackTrace(this,this.constructor)}}function R(e){return O({message:`invalid ${e}`,code:exports.FaceErrorCode.INVALID_ARGUMENT})}function O(e){return new x(e)}function l(e,r,t){if(!e)throw r(...null!=t?t:[])}exports.TxType=void 0,(i=exports.TxType||(exports.TxType={})).COIN="COIN",i.ERC20="ERC20",i.ERC721="ERC721",i.ERC1155="ERC1155",i.FT="FT",i.CONVERT="CONVERT";var u;exports.UserStatus=void 0,(u=exports.UserStatus||(exports.UserStatus={})).isWalletCreated="isWalletCreated",u.isNewUser="isNewUser",u.isRegisteredPinCode="isRegisteredPinCode",u.isAdmin="isAdmin",exports.CryptoBuffer=p,exports.FaceAuthSessionKey="Face-Auth-Session",exports.FaceError=x,exports.FaceOAuthResultKey="Face-OAuth-Result",exports.FaceVersionLocalKey="Face-Version",exports.LoginProvider={Google:"google.com",Apple:"apple.com",Twitter:"twitter.com",Discord:"discord.com",Facebook:"facebook.com",Kakao:"kakao.com"},exports.NetworkChainIdMap=t,exports.WalletPath="m/44'/60'/1'/0/0",exports.alreadyConnectedToOtherBappusn=function(e){return O({message:"already connected to other bappusn",code:exports.FaceErrorCode.ALREADY_CONNECTED_OTHER_BAPP_USN,origin:e})},exports.assert=l,exports.assertArgument=function(e,r,t,o=!0){(o||e)&&l(!!e&&r,R,[t])},exports.boraServiceRegionIsWrong=function(e){return new x({message:"bora service region is wrong",code:exports.FaceErrorCode.BORA_SERVICE_REGION_IS_WRONG,origin:e})},exports.getEthlikeBlockchains=function(){return s},exports.getPlatFormCoinDecimalByBlockchain=e=>{switch(e){case exports.Blockchain.ETHEREUM:case exports.Blockchain.POLYGON:case exports.Blockchain.KLAYTN:case exports.Blockchain.BNB_SMART_CHAIN:case exports.Blockchain.BORA:case exports.Blockchain.MEVERSE:case exports.Blockchain.PSM:case exports.Blockchain.PSM_DEV:case exports.Blockchain.PSM_TEST:case exports.Blockchain.HOME_VERSE:case exports.Blockchain.YOOLDO_VERSE:case exports.Blockchain.OASYS:return 18;case exports.Blockchain.SOLANA:return 9;case exports.Blockchain.NEAR:return 24;case exports.Blockchain.APTOS:return 8;default:throw new Error("unsupported blockchain")}},exports.invalidApiKeyError=function(e){return O({message:"invalid api key error",code:exports.FaceErrorCode.UNAUTHORIZED,origin:e})},exports.invalidArgumentError=R,exports.invalidBoraPortalIdAndSecretKey=function(e){return O({message:"Not found bapp. please contact FaceWallet Team to register BoraPortal Client Id/SecretKey.",code:exports.FaceErrorCode.INVALID_BORA_API_AND_SECRET_KEY,origin:e})},exports.invalidEnvironmentError=function(e){return O({message:"invalid environment",code:exports.FaceErrorCode.INVALID_ENVIRONMENT,data:{env:e}})},exports.invalidHostNameError=function(e){return O({message:"invalid host name error",code:exports.FaceErrorCode.UNAUTHORIZED,origin:e})},exports.invalidSignatureError=function(e){return O({message:"Invalid Signature message.",code:exports.FaceErrorCode.INVALID_SIGNATURE_MESSAGE,origin:e})},exports.invalidWallet=function(){return O({message:"invalid wallet error",code:exports.FaceErrorCode.INVALID_WALLET})},exports.isEthlikeBlockchain=function(e){return-1!==s.indexOf(e)},exports.isSupportedNetwork=e=>{switch(e){case exports.Network.ETHEREUM:case exports.Network.GOERLI:case exports.Network.POLYGON:case exports.Network.MUMBAI:case exports.Network.BNB_SMART_CHAIN:case exports.Network.BNB_SMART_CHAIN_TESTNET:case exports.Network.KLAYTN:case exports.Network.BAOBAB:case exports.Network.SOLANA:case exports.Network.SOLANA_DEVNET:case exports.Network.NEAR:case exports.Network.NEAR_TESTNET:case exports.Network.BORA:case exports.Network.BORA_TESTNET:case exports.Network.APTOS:case exports.Network.APTOS_TESTNET:case exports.Network.MEVERSE:case exports.Network.MEVERSE_TESTNET:case exports.Network.PSM_TESTNET:case exports.Network.PSM_TESTNET_DEV:case exports.Network.PSM_TESTNET_TEST:case exports.Network.HOME_VERSE:case exports.Network.HOME_VERSE_TESTNET:case exports.Network.YOOLDO_VERSE:case exports.Network.YOOLDO_VERSE_TESTNET:case exports.Network.OASYS:case exports.Network.OASYS_TESTNET:return!0;default:return!1}},exports.kitProvidersAndWalletsConfigError=function(){return O({message:"Both wallets and providers cannot be empty.",code:exports.FaceErrorCode.PROVIDERS_AND_WALLETS_CONFIG_ERROR})},exports.makeError=O,exports.networkToBlockchain=function(e){switch(e){case exports.Network.ETHEREUM:case exports.Network.ROPSTEN:case exports.Network.GOERLI:return exports.Blockchain.ETHEREUM;case exports.Network.POLYGON:case exports.Network.MUMBAI:return exports.Blockchain.POLYGON;case exports.Network.BNB_SMART_CHAIN:case exports.Network.BNB_SMART_CHAIN_TESTNET:return exports.Blockchain.BNB_SMART_CHAIN;case exports.Network.KLAYTN:case exports.Network.BAOBAB:return exports.Blockchain.KLAYTN;case exports.Network.SOLANA:case exports.Network.SOLANA_DEVNET:return exports.Blockchain.SOLANA;case exports.Network.BORA:case exports.Network.BORA_TESTNET:return exports.Blockchain.BORA;case exports.Network.NEAR:case exports.Network.NEAR_TESTNET:return exports.Blockchain.NEAR;case exports.Network.APTOS:case exports.Network.APTOS_TESTNET:return exports.Blockchain.APTOS;case exports.Network.MEVERSE:case exports.Network.MEVERSE_TESTNET:return exports.Blockchain.MEVERSE;case exports.Network.PSM:case exports.Network.PSM_TESTNET:return exports.Blockchain.PSM;case exports.Network.PSM_TESTNET_TEST:return exports.Blockchain.PSM_TEST;case exports.Network.PSM_TESTNET_DEV:return exports.Blockchain.PSM_DEV;case exports.Network.HOME_VERSE:case exports.Network.HOME_VERSE_TESTNET:return exports.Blockchain.HOME_VERSE;case exports.Network.YOOLDO_VERSE:case exports.Network.YOOLDO_VERSE_TESTNET:return exports.Blockchain.YOOLDO_VERSE;case exports.Network.OASYS:case exports.Network.OASYS_TESTNET:return exports.Blockchain.OASYS}throw new Error(`Unsupported network: ${e}`)},exports.noUserDataError=function(){return O({message:"no user data",code:exports.FaceErrorCode.NO_USER_DATA})},exports.notImplementedError=function(e){return O({message:e,code:exports.FaceErrorCode.NOT_IMPLEMENTED})},exports.oauthError=function(e,r){return O({message:`OAuth 2.0 Error: ${e}`,code:exports.FaceErrorCode.AUTHENTICATION,origin:r})},exports.parseFaceSolanaNearTransactionPayload=function(e){return null==e||"object"!=typeof e||null==e.serializedHex||"string"!=typeof e.serializedHex?null:e},exports.sendTransactionError=function(e){return O({message:e.message,code:exports.FaceErrorCode.SEND_TRANSACTION_FAILED,data:e.data})},exports.signError=function(e){return O({message:e,code:exports.FaceErrorCode.SIGN_FAILED})},exports.unknownError=function(e){return O({message:"unknown error",code:exports.FaceErrorCode.INTERNAL,origin:e})},exports.unsupportedChainError=function(e){return O({message:"unsupported chain error",code:exports.FaceErrorCode.UNSUPPORTED_CHAIN,origin:e})},exports.unsupportedProviderError=function(e){return O({message:`${e} login is not supported.`,code:exports.FaceErrorCode.UNSUPPORTED_SOCIAL_PROVIDER})},exports.unsupportedTokenProviderError=function(e){return O({message:`${e} is not support get id token`,code:exports.FaceErrorCode.UNSUPPORTED_SOCIAL_PROVIDER})},exports.userRejectedRequest=function(e){return O({code:exports.FaceErrorCode.USER_REJECTED_REQUEST,message:"user rejected request",data:{path:e}})}; | ||
//# sourceMappingURL=index.js.map |
@@ -45,3 +45,5 @@ export declare enum Network { | ||
YOOLDO_VERSE = "yooldo_verse", | ||
YOOLDO_VERSE_TESTNET = "yooldo_verse_testnet" | ||
YOOLDO_VERSE_TESTNET = "yooldo_verse_testnet", | ||
OASYS = "oasys", | ||
OASYS_TESTNET = "oasys_testnet" | ||
} | ||
@@ -66,3 +68,4 @@ export declare const isSupportedNetwork: (network?: Network) => boolean; | ||
HOME_VERSE = "HOME_VERSE", | ||
YOOLDO_VERSE = "YOOLDO_VERSE" | ||
YOOLDO_VERSE = "YOOLDO_VERSE", | ||
OASYS = "OASYS" | ||
} | ||
@@ -69,0 +72,0 @@ export declare function networkToBlockchain(network: Network): Blockchain; |
@@ -93,3 +93,5 @@ import { BigNumber, BigNumberish } from 'ethers'; | ||
YOOLDO_VERSE = "yooldo_verse", | ||
YOOLDO_VERSE_TESTNET = "yooldo_verse_testnet" | ||
YOOLDO_VERSE_TESTNET = "yooldo_verse_testnet", | ||
OASYS = "oasys", | ||
OASYS_TESTNET = "oasys_testnet" | ||
} | ||
@@ -114,3 +116,4 @@ declare const isSupportedNetwork: (network?: Network) => boolean; | ||
HOME_VERSE = "HOME_VERSE", | ||
YOOLDO_VERSE = "YOOLDO_VERSE" | ||
YOOLDO_VERSE = "YOOLDO_VERSE", | ||
OASYS = "OASYS" | ||
} | ||
@@ -117,0 +120,0 @@ declare function networkToBlockchain(network: Network): Blockchain; |
@@ -1,2 +0,2 @@ | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("ethers");var r;exports.Network=void 0,(r=exports.Network||(exports.Network={})).ETHEREUM="ethereum",r.ROPSTEN="ropsten",r.GOERLI="goerli",r.POLYGON="polygon",r.MUMBAI="mumbai",r.BNB_SMART_CHAIN="bnb_smart_chain",r.BNB_SMART_CHAIN_TESTNET="bnb_smart_chain_testnet",r.KLAYTN="klaytn",r.BAOBAB="baobab",r.SOLANA="solana",r.SOLANA_DEVNET="solana_devnet",r.NEAR="near",r.NEAR_TESTNET="near_testnet",r.BORA="bora",r.BORA_TESTNET="bora_testnet",r.ETH_MAINNET="ethereum",r.ETH_TESTNET="ropsten",r.MATIC_MAINNET="polygon",r.MATIC_TESTNET="mumbai",r.BINANCE_COIN_MAINNET="bnb_smart_chain",r.BINANCE_COIN_TESTNET="bnb_smart_chain_testnet",r.KLAYTN_MAINNET="klaytn",r.KLAYTN_TESTNET="baobab",r.APTOS="aptoslab",r.APTOS_TESTNET="aptoslab_testnet",r.MEVERSE="meverse",r.MEVERSE_TESTNET="meverse_testnet",r.PSM="psm",r.PSM_TESTNET="psm_testnet",r.PSM_TESTNET_TEST="psm_testnet_test",r.PSM_TESTNET_DEV="psm_testnet_dev",r.HOME_VERSE="home_verse",r.HOME_VERSE_TESTNET="home_verse_testnet",r.YOOLDO_VERSE="yooldo_verse",r.YOOLDO_VERSE_TESTNET="yooldo_verse_testnet";const t={[exports.Network.ETHEREUM]:1,[exports.Network.ROPSTEN]:3,[exports.Network.GOERLI]:5,[exports.Network.POLYGON]:137,[exports.Network.MUMBAI]:80001,[exports.Network.BNB_SMART_CHAIN]:56,[exports.Network.BNB_SMART_CHAIN_TESTNET]:97,[exports.Network.KLAYTN]:8217,[exports.Network.BAOBAB]:1001,[exports.Network.SOLANA]:0,[exports.Network.SOLANA_DEVNET]:0,[exports.Network.NEAR]:0,[exports.Network.NEAR_TESTNET]:0,[exports.Network.BORA]:77001,[exports.Network.BORA_TESTNET]:99001,[exports.Network.APTOS]:1,[exports.Network.APTOS_TESTNET]:2,[exports.Network.MEVERSE]:7518,[exports.Network.MEVERSE_TESTNET]:4759,[exports.Network.PSM_TESTNET_DEV]:100,[exports.Network.PSM_TESTNET_TEST]:400,[exports.Network.PSM_TESTNET]:500,[exports.Network.PSM]:91002,[exports.Network.HOME_VERSE]:19011,[exports.Network.HOME_VERSE_TESTNET]:40875,[exports.Network.YOOLDO_VERSE]:411,[exports.Network.YOOLDO_VERSE_TESTNET]:20197,1:exports.Network.ETHEREUM,3:exports.Network.ROPSTEN,5:exports.Network.GOERLI,137:exports.Network.POLYGON,80001:exports.Network.MUMBAI,56:exports.Network.BNB_SMART_CHAIN,97:exports.Network.BNB_SMART_CHAIN_TESTNET,8217:exports.Network.KLAYTN,1001:exports.Network.BAOBAB,77001:exports.Network.BORA,99001:exports.Network.BORA_TESTNET,7518:exports.Network.MEVERSE,4759:exports.Network.MEVERSE_TESTNET,100:exports.Network.PSM_TESTNET_DEV,400:exports.Network.PSM_TESTNET_TEST,500:exports.Network.PSM_TESTNET,91002:exports.Network.PSM,19011:exports.Network.HOME_VERSE,40875:exports.Network.HOME_VERSE_TESTNET,411:exports.Network.YOOLDO_VERSE,20197:exports.Network.YOOLDO_VERSE_TESTNET};var o;exports.Blockchain=void 0,(o=exports.Blockchain||(exports.Blockchain={})).ETHEREUM="ETHEREUM",o.POLYGON="POLYGON",o.BNB_SMART_CHAIN="BNB_SMART_CHAIN",o.KLAYTN="KLAYTN",o.SOLANA="SOLANA",o.NEAR="NEAR",o.BORA="BORA",o.APTOS="APTOS",o.MEVERSE="MEVERSE",o.PSM="PSM",o.PSM_TEST="PSM_TEST",o.PSM_DEV="PSM_DEV",o.HOME_VERSE="HOME_VERSE",o.YOOLDO_VERSE="YOOLDO_VERSE";const s=[exports.Blockchain.ETHEREUM,exports.Blockchain.POLYGON,exports.Blockchain.BNB_SMART_CHAIN,exports.Blockchain.KLAYTN,exports.Blockchain.BORA,exports.Blockchain.MEVERSE,exports.Blockchain.PSM,exports.Blockchain.PSM_DEV,exports.Blockchain.PSM_TEST,exports.Blockchain.HOME_VERSE,exports.Blockchain.YOOLDO_VERSE];var E,n,a,c,N,_,T,i;exports.BoraPortalConnectStatusEnum=void 0,(E=exports.BoraPortalConnectStatusEnum||(exports.BoraPortalConnectStatusEnum={})).Connected="CONNECTED",E.Unconnected="UNCONNECTED";class p{constructor(e,r){p.ensureHexString(e),p.checkLength(e,r),this.hex=e,this.length=r}static empty(){return new p("",0)}static fromUint8Array(e){return new p(S(e),e.length)}static fromHex(e,r){return new p(e,r)}static ensureHexString(e){try{if(""===e)return;if(null==e)throw new Error(`hex is null ${e}`);if(!e.startsWith("0x"))throw new Error(`hex does not start with 0x ${e}`);if(null==e.match("0x[0-9a-fA-F]+"))throw new Error(`invalid hex data ${e}`)}catch(e){throw e}}static checkLength(e,r){if(0===e.length)return;if(4*(e.length-2)/8>r)throw new Error(`length is less than hex data ${e}, ${r}`)}toString(){return this.hex}toHex(){return this.hex}toBigNumber(){return e.BigNumber.from(this.hex)}toJSON(){return{hex:this.hex,length:this.length}}static fromJSON(e){const{hex:r,length:t}=JSON.parse(e);return new p(r,t)}static fromBigNumber(e,r){return p.fromHex(e.toHexString(),r)}toUInt8Array(){const e=this.hex.substring(2),r=[];for(let t=0;t<e.length;t+=2)r.push(parseInt(e.substring(t,t+2),16));return new Uint8Array(r)}static concat(e,r){try{const t=e.toUInt8Array(),o=r.toUInt8Array(),s=new Uint8Array(t.length+o.length);s.set(t),s.set(o,t.length);const E=S(s);return new p(E,t.length+o.length)}catch(e){return console.debug("concat error",e),p.empty()}}split(e){const r=this.toUInt8Array();return[p.fromUint8Array(r.slice(0,e)),p.fromUint8Array(r.slice(e))]}clone(){return new p(this.hex,this.length)}unsafeSetLength(e){this.length=e}}function S(e){return"0x"+[...e].map((e=>e.toString(16).padStart(2,"0"))).join("")}function A(e){return function(e){return null===e}(e)||function(e){return void 0===e}(e)}exports.Env=void 0,(n=exports.Env||(exports.Env={})).Local="Local",n.Dev="Dev",n.StageTest="StageTest",n.StageMainnet="StageMainnet",n.ProdTest="ProdTest",n.ProdMainnet="ProdMainnet",exports.JsonRpcMethod=void 0,(a=exports.JsonRpcMethod||(exports.JsonRpcMethod={})).face_logInSignUp="face_logInSignUp",a.face_loggedIn="face_loggedIn",a.face_logOut="face_logOut",a.face_open2fa="face_open2fa",a.face_currentUser="face_currentUser",a.face_accounts="face_accounts",a.face_getUserVerificationToken="face_getUserVerificationToken",a.face_openIframe="face_openIframe",a.face_closeIframe="face_closeIframe",a.face_ready="face_ready",a.face_openHome="face_openHome",a.face_openKit="face_openKit",a.face_connectExternalWallet="face_connectExternalWallet",a.face_openWalletConnect="face_openWalletConnect",a.face_confirmWalletConnectDapp="face_confirmWalletConnectDapp",a.face_switchNetwork="face_switchNetwork",a.face_directSocialLogin="face_directSocialLogin",a.face_getIdToken="face_getIdToken",a.face_loginWithIdToken="face_loginWithIdToken",a.face_loginWithAccessToken="face_loginWithAccessToken",a.face_showToast="face_showToast",a.bora_connect="bora_connect",a.bora_isConnected="bora_isConnected",a.eth_sendTransaction="eth_sendTransaction",a.eth_getBalance="eth_getBalance",a.eth_call="eth_call",a.eth_estimateGas="eth_estimateGas",a.eth_sign="eth_sign",a.eth_signTypedData_v3="eth_signTypedData_v3",a.eth_signTypedData_v4="eth_signTypedData_v4",a.eth_accounts="eth_accounts",a.personal_sign="personal_sign",a.personal_listAccounts="personal_listAccounts",a.wallet_switchEthereumChain="wallet_switchEthereumChain",a.solana_sendTransaction="solana_sendTransaction",a.near_broadcast_tx_async="near_broadcast_tx_async",a.near_get_balance="near_get_balance",a.aptos_signMultiAgentTransaction="aptos_signMultiAgentTransaction",a.aptos_signMessage="aptos_signMessage",a.aptos_signTransaction="aptos_signTransaction",a.aptos_signAndSubmitTransaction="aptos_signAndSubmitTransaction",exports.JsonRpcSource=void 0,(c=exports.JsonRpcSource||(exports.JsonRpcSource={})).FACE_SDK="FACE_SDK",c.FACE_IFRAME="FACE_IFRAME",c.FACE_WALLET_CONNECT="FACE_WALLET_CONNECT",c.FACE_NATIVE_SDK="FACE_NATIVE_SDK",exports.RpcErrorCode=void 0,(N=exports.RpcErrorCode||(exports.RpcErrorCode={}))[N.PARSE_ERROR=-32700]="PARSE_ERROR",N[N.INVALID_REQUEST=-32600]="INVALID_REQUEST",N[N.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",N[N.INVALID_PARAMS=-32602]="INVALID_PARAMS",N[N.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",exports.HttpStatus=void 0,(_=exports.HttpStatus||(exports.HttpStatus={}))[_.SUCCESS=200]="SUCCESS",_[_.CREATED=201]="CREATED",_[_.BAD_REQUEST=400]="BAD_REQUEST",_[_.UNAUTHORIZED=401]="UNAUTHORIZED",_[_.FORBIDDEN=403]="FORBIDDEN",_[_.NOT_FOUND=404]="NOT_FOUND",_[_.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",exports.FaceErrorCode=void 0,(T=exports.FaceErrorCode||(exports.FaceErrorCode={}))[T.INVALID_ARGUMENT=4e3]="INVALID_ARGUMENT",T[T.USER_REJECTED_REQUEST=4001]="USER_REJECTED_REQUEST",T[T.NOT_IMPLEMENTED=4002]="NOT_IMPLEMENTED",T[T.BAD_REQUEST=4003]="BAD_REQUEST",T[T.SEND_TRANSACTION_FAILED=4004]="SEND_TRANSACTION_FAILED",T[T.SIGN_FAILED=4005]="SIGN_FAILED",T[T.UNAUTHORIZED=4100]="UNAUTHORIZED",T[T.NO_USER_DATA=4101]="NO_USER_DATA",T[T.AUTHENTICATION=4102]="AUTHENTICATION",T[T.UNSUPPORTED_SOCIAL_PROVIDER=4103]="UNSUPPORTED_SOCIAL_PROVIDER",T[T.INVALID_ENVIRONMENT=4200]="INVALID_ENVIRONMENT",T[T.UNSUPPORTED_METHOD=4201]="UNSUPPORTED_METHOD",T[T.UNSUPPORTED_CHAIN=4202]="UNSUPPORTED_CHAIN",T[T.INVALID_WALLET=4300]="INVALID_WALLET",T[T.PROVIDERS_AND_WALLETS_CONFIG_ERROR=4301]="PROVIDERS_AND_WALLETS_CONFIG_ERROR",T[T.INVALID_SIGNATURE_MESSAGE=4906]="INVALID_SIGNATURE_MESSAGE",T[T.INVALID_BORA_API_AND_SECRET_KEY=4907]="INVALID_BORA_API_AND_SECRET_KEY",T[T.ALREADY_CONNECTED_OTHER_BAPP_USN=4909]="ALREADY_CONNECTED_OTHER_BAPP_USN",T[T.BORA_SERVICE_REGION_IS_WRONG=4910]="BORA_SERVICE_REGION_IS_WRONG",T[T.INTERNAL=5e3]="INTERNAL";class x extends Error{static isFaceError(e){return e.isFaceError}isValidErrorCode(e){return!A(r=e)&&"number"==typeof r&&Object.values(exports.RpcErrorCode).includes(r)||function(e){return!A(e)&&"number"==typeof e&&Object.values(exports.FaceErrorCode).includes(e)}(e);var r}constructor(e){super(),this.isFaceError=!0,this.code=this.isValidErrorCode(e.code)?e.code:exports.FaceErrorCode.INTERNAL,this.message=`Face Error: [${this.code}] ${e.message}`,e.origin&&(e.origin.isFaceError&&e.origin.origin?this.origin=e.origin.origin:this.origin=e.origin),e.data&&(this.data=e.data),Object.setPrototypeOf(this,x.prototype),Error.captureStackTrace(this,this.constructor)}}function R(e){return O({message:`invalid ${e}`,code:exports.FaceErrorCode.INVALID_ARGUMENT})}function O(e){return new x(e)}function l(e,r,t){if(!e)throw r(...null!=t?t:[])}exports.TxType=void 0,(i=exports.TxType||(exports.TxType={})).COIN="COIN",i.ERC20="ERC20",i.ERC721="ERC721",i.ERC1155="ERC1155",i.FT="FT",i.CONVERT="CONVERT";var u;exports.UserStatus=void 0,(u=exports.UserStatus||(exports.UserStatus={})).isWalletCreated="isWalletCreated",u.isNewUser="isNewUser",u.isRegisteredPinCode="isRegisteredPinCode",u.isAdmin="isAdmin",exports.CryptoBuffer=p,exports.FaceAuthSessionKey="Face-Auth-Session",exports.FaceError=x,exports.FaceOAuthResultKey="Face-OAuth-Result",exports.FaceVersionLocalKey="Face-Version",exports.LoginProvider={Google:"google.com",Apple:"apple.com",Twitter:"twitter.com",Discord:"discord.com",Facebook:"facebook.com",Kakao:"kakao.com"},exports.NetworkChainIdMap=t,exports.WalletPath="m/44'/60'/1'/0/0",exports.alreadyConnectedToOtherBappusn=function(e){return O({message:"already connected to other bappusn",code:exports.FaceErrorCode.ALREADY_CONNECTED_OTHER_BAPP_USN,origin:e})},exports.assert=l,exports.assertArgument=function(e,r,t,o=!0){(o||e)&&l(!!e&&r,R,[t])},exports.boraServiceRegionIsWrong=function(e){return new x({message:"bora service region is wrong",code:exports.FaceErrorCode.BORA_SERVICE_REGION_IS_WRONG,origin:e})},exports.getEthlikeBlockchains=function(){return s},exports.getPlatFormCoinDecimalByBlockchain=e=>{switch(e){case exports.Blockchain.ETHEREUM:case exports.Blockchain.POLYGON:case exports.Blockchain.KLAYTN:case exports.Blockchain.BNB_SMART_CHAIN:case exports.Blockchain.BORA:case exports.Blockchain.MEVERSE:case exports.Blockchain.PSM:case exports.Blockchain.PSM_DEV:case exports.Blockchain.PSM_TEST:case exports.Blockchain.HOME_VERSE:case exports.Blockchain.YOOLDO_VERSE:return 18;case exports.Blockchain.SOLANA:return 9;case exports.Blockchain.NEAR:return 24;case exports.Blockchain.APTOS:return 8;default:throw new Error("unsupported blockchain")}},exports.invalidApiKeyError=function(e){return O({message:"invalid api key error",code:exports.FaceErrorCode.UNAUTHORIZED,origin:e})},exports.invalidArgumentError=R,exports.invalidBoraPortalIdAndSecretKey=function(e){return O({message:"Not found bapp. please contact FaceWallet Team to register BoraPortal Client Id/SecretKey.",code:exports.FaceErrorCode.INVALID_BORA_API_AND_SECRET_KEY,origin:e})},exports.invalidEnvironmentError=function(e){return O({message:"invalid environment",code:exports.FaceErrorCode.INVALID_ENVIRONMENT,data:{env:e}})},exports.invalidHostNameError=function(e){return O({message:"invalid host name error",code:exports.FaceErrorCode.UNAUTHORIZED,origin:e})},exports.invalidSignatureError=function(e){return O({message:"Invalid Signature message.",code:exports.FaceErrorCode.INVALID_SIGNATURE_MESSAGE,origin:e})},exports.invalidWallet=function(){return O({message:"invalid wallet error",code:exports.FaceErrorCode.INVALID_WALLET})},exports.isEthlikeBlockchain=function(e){return-1!==s.indexOf(e)},exports.isSupportedNetwork=e=>{switch(e){case exports.Network.ETHEREUM:case exports.Network.GOERLI:case exports.Network.POLYGON:case exports.Network.MUMBAI:case exports.Network.BNB_SMART_CHAIN:case exports.Network.BNB_SMART_CHAIN_TESTNET:case exports.Network.KLAYTN:case exports.Network.BAOBAB:case exports.Network.SOLANA:case exports.Network.SOLANA_DEVNET:case exports.Network.NEAR:case exports.Network.NEAR_TESTNET:case exports.Network.BORA:case exports.Network.BORA_TESTNET:case exports.Network.APTOS:case exports.Network.APTOS_TESTNET:case exports.Network.MEVERSE:case exports.Network.MEVERSE_TESTNET:case exports.Network.PSM_TESTNET:case exports.Network.PSM_TESTNET_DEV:case exports.Network.PSM_TESTNET_TEST:case exports.Network.HOME_VERSE:case exports.Network.HOME_VERSE_TESTNET:case exports.Network.YOOLDO_VERSE:case exports.Network.YOOLDO_VERSE_TESTNET:return!0;default:return!1}},exports.kitProvidersAndWalletsConfigError=function(){return O({message:"Both wallets and providers cannot be empty.",code:exports.FaceErrorCode.PROVIDERS_AND_WALLETS_CONFIG_ERROR})},exports.makeError=O,exports.networkToBlockchain=function(e){switch(e){case exports.Network.ETHEREUM:case exports.Network.ROPSTEN:case exports.Network.GOERLI:return exports.Blockchain.ETHEREUM;case exports.Network.POLYGON:case exports.Network.MUMBAI:return exports.Blockchain.POLYGON;case exports.Network.BNB_SMART_CHAIN:case exports.Network.BNB_SMART_CHAIN_TESTNET:return exports.Blockchain.BNB_SMART_CHAIN;case exports.Network.KLAYTN:case exports.Network.BAOBAB:return exports.Blockchain.KLAYTN;case exports.Network.SOLANA:case exports.Network.SOLANA_DEVNET:return exports.Blockchain.SOLANA;case exports.Network.BORA:case exports.Network.BORA_TESTNET:return exports.Blockchain.BORA;case exports.Network.NEAR:case exports.Network.NEAR_TESTNET:return exports.Blockchain.NEAR;case exports.Network.APTOS:case exports.Network.APTOS_TESTNET:return exports.Blockchain.APTOS;case exports.Network.MEVERSE:case exports.Network.MEVERSE_TESTNET:return exports.Blockchain.MEVERSE;case exports.Network.PSM:case exports.Network.PSM_TESTNET:return exports.Blockchain.PSM;case exports.Network.PSM_TESTNET_TEST:return exports.Blockchain.PSM_TEST;case exports.Network.PSM_TESTNET_DEV:return exports.Blockchain.PSM_DEV;case exports.Network.HOME_VERSE:case exports.Network.HOME_VERSE_TESTNET:return exports.Blockchain.HOME_VERSE;case exports.Network.YOOLDO_VERSE:case exports.Network.YOOLDO_VERSE_TESTNET:return exports.Blockchain.YOOLDO_VERSE}throw new Error(`Unsupported network: ${e}`)},exports.noUserDataError=function(){return O({message:"no user data",code:exports.FaceErrorCode.NO_USER_DATA})},exports.notImplementedError=function(e){return O({message:e,code:exports.FaceErrorCode.NOT_IMPLEMENTED})},exports.oauthError=function(e,r){return O({message:`OAuth 2.0 Error: ${e}`,code:exports.FaceErrorCode.AUTHENTICATION,origin:r})},exports.parseFaceSolanaNearTransactionPayload=function(e){return null==e||"object"!=typeof e||null==e.serializedHex||"string"!=typeof e.serializedHex?null:e},exports.sendTransactionError=function(e){return O({message:e.message,code:exports.FaceErrorCode.SEND_TRANSACTION_FAILED,data:e.data})},exports.signError=function(e){return O({message:e,code:exports.FaceErrorCode.SIGN_FAILED})},exports.unknownError=function(e){return O({message:"unknown error",code:exports.FaceErrorCode.INTERNAL,origin:e})},exports.unsupportedChainError=function(e){return O({message:"unsupported chain error",code:exports.FaceErrorCode.UNSUPPORTED_CHAIN,origin:e})},exports.unsupportedProviderError=function(e){return O({message:`${e} login is not supported.`,code:exports.FaceErrorCode.UNSUPPORTED_SOCIAL_PROVIDER})},exports.unsupportedTokenProviderError=function(e){return O({message:`${e} is not support get id token`,code:exports.FaceErrorCode.UNSUPPORTED_SOCIAL_PROVIDER})},exports.userRejectedRequest=function(e){return O({code:exports.FaceErrorCode.USER_REJECTED_REQUEST,message:"user rejected request",data:{path:e}})}; | ||
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("ethers");var r;exports.Network=void 0,(r=exports.Network||(exports.Network={})).ETHEREUM="ethereum",r.ROPSTEN="ropsten",r.GOERLI="goerli",r.POLYGON="polygon",r.MUMBAI="mumbai",r.BNB_SMART_CHAIN="bnb_smart_chain",r.BNB_SMART_CHAIN_TESTNET="bnb_smart_chain_testnet",r.KLAYTN="klaytn",r.BAOBAB="baobab",r.SOLANA="solana",r.SOLANA_DEVNET="solana_devnet",r.NEAR="near",r.NEAR_TESTNET="near_testnet",r.BORA="bora",r.BORA_TESTNET="bora_testnet",r.ETH_MAINNET="ethereum",r.ETH_TESTNET="ropsten",r.MATIC_MAINNET="polygon",r.MATIC_TESTNET="mumbai",r.BINANCE_COIN_MAINNET="bnb_smart_chain",r.BINANCE_COIN_TESTNET="bnb_smart_chain_testnet",r.KLAYTN_MAINNET="klaytn",r.KLAYTN_TESTNET="baobab",r.APTOS="aptoslab",r.APTOS_TESTNET="aptoslab_testnet",r.MEVERSE="meverse",r.MEVERSE_TESTNET="meverse_testnet",r.PSM="psm",r.PSM_TESTNET="psm_testnet",r.PSM_TESTNET_TEST="psm_testnet_test",r.PSM_TESTNET_DEV="psm_testnet_dev",r.HOME_VERSE="home_verse",r.HOME_VERSE_TESTNET="home_verse_testnet",r.YOOLDO_VERSE="yooldo_verse",r.YOOLDO_VERSE_TESTNET="yooldo_verse_testnet",r.OASYS="oasys",r.OASYS_TESTNET="oasys_testnet";const t={[exports.Network.ETHEREUM]:1,[exports.Network.ROPSTEN]:3,[exports.Network.GOERLI]:5,[exports.Network.POLYGON]:137,[exports.Network.MUMBAI]:80001,[exports.Network.BNB_SMART_CHAIN]:56,[exports.Network.BNB_SMART_CHAIN_TESTNET]:97,[exports.Network.KLAYTN]:8217,[exports.Network.BAOBAB]:1001,[exports.Network.SOLANA]:0,[exports.Network.SOLANA_DEVNET]:0,[exports.Network.NEAR]:0,[exports.Network.NEAR_TESTNET]:0,[exports.Network.BORA]:77001,[exports.Network.BORA_TESTNET]:99001,[exports.Network.APTOS]:1,[exports.Network.APTOS_TESTNET]:2,[exports.Network.MEVERSE]:7518,[exports.Network.MEVERSE_TESTNET]:4759,[exports.Network.PSM_TESTNET_DEV]:100,[exports.Network.PSM_TESTNET_TEST]:400,[exports.Network.PSM_TESTNET]:500,[exports.Network.PSM]:91002,[exports.Network.HOME_VERSE]:19011,[exports.Network.HOME_VERSE_TESTNET]:40875,[exports.Network.YOOLDO_VERSE]:411,[exports.Network.YOOLDO_VERSE_TESTNET]:20197,[exports.Network.OASYS]:248,[exports.Network.OASYS_TESTNET]:9372,1:exports.Network.ETHEREUM,3:exports.Network.ROPSTEN,5:exports.Network.GOERLI,137:exports.Network.POLYGON,80001:exports.Network.MUMBAI,56:exports.Network.BNB_SMART_CHAIN,97:exports.Network.BNB_SMART_CHAIN_TESTNET,8217:exports.Network.KLAYTN,1001:exports.Network.BAOBAB,77001:exports.Network.BORA,99001:exports.Network.BORA_TESTNET,7518:exports.Network.MEVERSE,4759:exports.Network.MEVERSE_TESTNET,100:exports.Network.PSM_TESTNET_DEV,400:exports.Network.PSM_TESTNET_TEST,500:exports.Network.PSM_TESTNET,91002:exports.Network.PSM,19011:exports.Network.HOME_VERSE,40875:exports.Network.HOME_VERSE_TESTNET,411:exports.Network.YOOLDO_VERSE,20197:exports.Network.YOOLDO_VERSE_TESTNET,248:exports.Network.OASYS,9372:exports.Network.OASYS_TESTNET};var o;exports.Blockchain=void 0,(o=exports.Blockchain||(exports.Blockchain={})).ETHEREUM="ETHEREUM",o.POLYGON="POLYGON",o.BNB_SMART_CHAIN="BNB_SMART_CHAIN",o.KLAYTN="KLAYTN",o.SOLANA="SOLANA",o.NEAR="NEAR",o.BORA="BORA",o.APTOS="APTOS",o.MEVERSE="MEVERSE",o.PSM="PSM",o.PSM_TEST="PSM_TEST",o.PSM_DEV="PSM_DEV",o.HOME_VERSE="HOME_VERSE",o.YOOLDO_VERSE="YOOLDO_VERSE",o.OASYS="OASYS";const s=[exports.Blockchain.ETHEREUM,exports.Blockchain.POLYGON,exports.Blockchain.BNB_SMART_CHAIN,exports.Blockchain.KLAYTN,exports.Blockchain.BORA,exports.Blockchain.MEVERSE,exports.Blockchain.PSM,exports.Blockchain.PSM_DEV,exports.Blockchain.PSM_TEST,exports.Blockchain.HOME_VERSE,exports.Blockchain.YOOLDO_VERSE,exports.Blockchain.OASYS];var E,n,a,c,N,_,T,i;exports.BoraPortalConnectStatusEnum=void 0,(E=exports.BoraPortalConnectStatusEnum||(exports.BoraPortalConnectStatusEnum={})).Connected="CONNECTED",E.Unconnected="UNCONNECTED";class p{constructor(e,r){p.ensureHexString(e),p.checkLength(e,r),this.hex=e,this.length=r}static empty(){return new p("",0)}static fromUint8Array(e){return new p(S(e),e.length)}static fromHex(e,r){return new p(e,r)}static ensureHexString(e){try{if(""===e)return;if(null==e)throw new Error(`hex is null ${e}`);if(!e.startsWith("0x"))throw new Error(`hex does not start with 0x ${e}`);if(null==e.match("0x[0-9a-fA-F]+"))throw new Error(`invalid hex data ${e}`)}catch(e){throw e}}static checkLength(e,r){if(0===e.length)return;if(4*(e.length-2)/8>r)throw new Error(`length is less than hex data ${e}, ${r}`)}toString(){return this.hex}toHex(){return this.hex}toBigNumber(){return e.BigNumber.from(this.hex)}toJSON(){return{hex:this.hex,length:this.length}}static fromJSON(e){const{hex:r,length:t}=JSON.parse(e);return new p(r,t)}static fromBigNumber(e,r){return p.fromHex(e.toHexString(),r)}toUInt8Array(){const e=this.hex.substring(2),r=[];for(let t=0;t<e.length;t+=2)r.push(parseInt(e.substring(t,t+2),16));return new Uint8Array(r)}static concat(e,r){try{const t=e.toUInt8Array(),o=r.toUInt8Array(),s=new Uint8Array(t.length+o.length);s.set(t),s.set(o,t.length);const E=S(s);return new p(E,t.length+o.length)}catch(e){return console.debug("concat error",e),p.empty()}}split(e){const r=this.toUInt8Array();return[p.fromUint8Array(r.slice(0,e)),p.fromUint8Array(r.slice(e))]}clone(){return new p(this.hex,this.length)}unsafeSetLength(e){this.length=e}}function S(e){return"0x"+[...e].map((e=>e.toString(16).padStart(2,"0"))).join("")}function A(e){return function(e){return null===e}(e)||function(e){return void 0===e}(e)}exports.Env=void 0,(n=exports.Env||(exports.Env={})).Local="Local",n.Dev="Dev",n.StageTest="StageTest",n.StageMainnet="StageMainnet",n.ProdTest="ProdTest",n.ProdMainnet="ProdMainnet",exports.JsonRpcMethod=void 0,(a=exports.JsonRpcMethod||(exports.JsonRpcMethod={})).face_logInSignUp="face_logInSignUp",a.face_loggedIn="face_loggedIn",a.face_logOut="face_logOut",a.face_open2fa="face_open2fa",a.face_currentUser="face_currentUser",a.face_accounts="face_accounts",a.face_getUserVerificationToken="face_getUserVerificationToken",a.face_openIframe="face_openIframe",a.face_closeIframe="face_closeIframe",a.face_ready="face_ready",a.face_openHome="face_openHome",a.face_openKit="face_openKit",a.face_connectExternalWallet="face_connectExternalWallet",a.face_openWalletConnect="face_openWalletConnect",a.face_confirmWalletConnectDapp="face_confirmWalletConnectDapp",a.face_switchNetwork="face_switchNetwork",a.face_directSocialLogin="face_directSocialLogin",a.face_getIdToken="face_getIdToken",a.face_loginWithIdToken="face_loginWithIdToken",a.face_loginWithAccessToken="face_loginWithAccessToken",a.face_showToast="face_showToast",a.bora_connect="bora_connect",a.bora_isConnected="bora_isConnected",a.eth_sendTransaction="eth_sendTransaction",a.eth_getBalance="eth_getBalance",a.eth_call="eth_call",a.eth_estimateGas="eth_estimateGas",a.eth_sign="eth_sign",a.eth_signTypedData_v3="eth_signTypedData_v3",a.eth_signTypedData_v4="eth_signTypedData_v4",a.eth_accounts="eth_accounts",a.personal_sign="personal_sign",a.personal_listAccounts="personal_listAccounts",a.wallet_switchEthereumChain="wallet_switchEthereumChain",a.solana_sendTransaction="solana_sendTransaction",a.near_broadcast_tx_async="near_broadcast_tx_async",a.near_get_balance="near_get_balance",a.aptos_signMultiAgentTransaction="aptos_signMultiAgentTransaction",a.aptos_signMessage="aptos_signMessage",a.aptos_signTransaction="aptos_signTransaction",a.aptos_signAndSubmitTransaction="aptos_signAndSubmitTransaction",exports.JsonRpcSource=void 0,(c=exports.JsonRpcSource||(exports.JsonRpcSource={})).FACE_SDK="FACE_SDK",c.FACE_IFRAME="FACE_IFRAME",c.FACE_WALLET_CONNECT="FACE_WALLET_CONNECT",c.FACE_NATIVE_SDK="FACE_NATIVE_SDK",exports.RpcErrorCode=void 0,(N=exports.RpcErrorCode||(exports.RpcErrorCode={}))[N.PARSE_ERROR=-32700]="PARSE_ERROR",N[N.INVALID_REQUEST=-32600]="INVALID_REQUEST",N[N.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",N[N.INVALID_PARAMS=-32602]="INVALID_PARAMS",N[N.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",exports.HttpStatus=void 0,(_=exports.HttpStatus||(exports.HttpStatus={}))[_.SUCCESS=200]="SUCCESS",_[_.CREATED=201]="CREATED",_[_.BAD_REQUEST=400]="BAD_REQUEST",_[_.UNAUTHORIZED=401]="UNAUTHORIZED",_[_.FORBIDDEN=403]="FORBIDDEN",_[_.NOT_FOUND=404]="NOT_FOUND",_[_.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",exports.FaceErrorCode=void 0,(T=exports.FaceErrorCode||(exports.FaceErrorCode={}))[T.INVALID_ARGUMENT=4e3]="INVALID_ARGUMENT",T[T.USER_REJECTED_REQUEST=4001]="USER_REJECTED_REQUEST",T[T.NOT_IMPLEMENTED=4002]="NOT_IMPLEMENTED",T[T.BAD_REQUEST=4003]="BAD_REQUEST",T[T.SEND_TRANSACTION_FAILED=4004]="SEND_TRANSACTION_FAILED",T[T.SIGN_FAILED=4005]="SIGN_FAILED",T[T.UNAUTHORIZED=4100]="UNAUTHORIZED",T[T.NO_USER_DATA=4101]="NO_USER_DATA",T[T.AUTHENTICATION=4102]="AUTHENTICATION",T[T.UNSUPPORTED_SOCIAL_PROVIDER=4103]="UNSUPPORTED_SOCIAL_PROVIDER",T[T.INVALID_ENVIRONMENT=4200]="INVALID_ENVIRONMENT",T[T.UNSUPPORTED_METHOD=4201]="UNSUPPORTED_METHOD",T[T.UNSUPPORTED_CHAIN=4202]="UNSUPPORTED_CHAIN",T[T.INVALID_WALLET=4300]="INVALID_WALLET",T[T.PROVIDERS_AND_WALLETS_CONFIG_ERROR=4301]="PROVIDERS_AND_WALLETS_CONFIG_ERROR",T[T.INVALID_SIGNATURE_MESSAGE=4906]="INVALID_SIGNATURE_MESSAGE",T[T.INVALID_BORA_API_AND_SECRET_KEY=4907]="INVALID_BORA_API_AND_SECRET_KEY",T[T.ALREADY_CONNECTED_OTHER_BAPP_USN=4909]="ALREADY_CONNECTED_OTHER_BAPP_USN",T[T.BORA_SERVICE_REGION_IS_WRONG=4910]="BORA_SERVICE_REGION_IS_WRONG",T[T.INTERNAL=5e3]="INTERNAL";class x extends Error{static isFaceError(e){return e.isFaceError}isValidErrorCode(e){return!A(r=e)&&"number"==typeof r&&Object.values(exports.RpcErrorCode).includes(r)||function(e){return!A(e)&&"number"==typeof e&&Object.values(exports.FaceErrorCode).includes(e)}(e);var r}constructor(e){super(),this.isFaceError=!0,this.code=this.isValidErrorCode(e.code)?e.code:exports.FaceErrorCode.INTERNAL,this.message=`Face Error: [${this.code}] ${e.message}`,e.origin&&(e.origin.isFaceError&&e.origin.origin?this.origin=e.origin.origin:this.origin=e.origin),e.data&&(this.data=e.data),Object.setPrototypeOf(this,x.prototype),Error.captureStackTrace(this,this.constructor)}}function R(e){return O({message:`invalid ${e}`,code:exports.FaceErrorCode.INVALID_ARGUMENT})}function O(e){return new x(e)}function l(e,r,t){if(!e)throw r(...null!=t?t:[])}exports.TxType=void 0,(i=exports.TxType||(exports.TxType={})).COIN="COIN",i.ERC20="ERC20",i.ERC721="ERC721",i.ERC1155="ERC1155",i.FT="FT",i.CONVERT="CONVERT";var u;exports.UserStatus=void 0,(u=exports.UserStatus||(exports.UserStatus={})).isWalletCreated="isWalletCreated",u.isNewUser="isNewUser",u.isRegisteredPinCode="isRegisteredPinCode",u.isAdmin="isAdmin",exports.CryptoBuffer=p,exports.FaceAuthSessionKey="Face-Auth-Session",exports.FaceError=x,exports.FaceOAuthResultKey="Face-OAuth-Result",exports.FaceVersionLocalKey="Face-Version",exports.LoginProvider={Google:"google.com",Apple:"apple.com",Twitter:"twitter.com",Discord:"discord.com",Facebook:"facebook.com",Kakao:"kakao.com"},exports.NetworkChainIdMap=t,exports.WalletPath="m/44'/60'/1'/0/0",exports.alreadyConnectedToOtherBappusn=function(e){return O({message:"already connected to other bappusn",code:exports.FaceErrorCode.ALREADY_CONNECTED_OTHER_BAPP_USN,origin:e})},exports.assert=l,exports.assertArgument=function(e,r,t,o=!0){(o||e)&&l(!!e&&r,R,[t])},exports.boraServiceRegionIsWrong=function(e){return new x({message:"bora service region is wrong",code:exports.FaceErrorCode.BORA_SERVICE_REGION_IS_WRONG,origin:e})},exports.getEthlikeBlockchains=function(){return s},exports.getPlatFormCoinDecimalByBlockchain=e=>{switch(e){case exports.Blockchain.ETHEREUM:case exports.Blockchain.POLYGON:case exports.Blockchain.KLAYTN:case exports.Blockchain.BNB_SMART_CHAIN:case exports.Blockchain.BORA:case exports.Blockchain.MEVERSE:case exports.Blockchain.PSM:case exports.Blockchain.PSM_DEV:case exports.Blockchain.PSM_TEST:case exports.Blockchain.HOME_VERSE:case exports.Blockchain.YOOLDO_VERSE:case exports.Blockchain.OASYS:return 18;case exports.Blockchain.SOLANA:return 9;case exports.Blockchain.NEAR:return 24;case exports.Blockchain.APTOS:return 8;default:throw new Error("unsupported blockchain")}},exports.invalidApiKeyError=function(e){return O({message:"invalid api key error",code:exports.FaceErrorCode.UNAUTHORIZED,origin:e})},exports.invalidArgumentError=R,exports.invalidBoraPortalIdAndSecretKey=function(e){return O({message:"Not found bapp. please contact FaceWallet Team to register BoraPortal Client Id/SecretKey.",code:exports.FaceErrorCode.INVALID_BORA_API_AND_SECRET_KEY,origin:e})},exports.invalidEnvironmentError=function(e){return O({message:"invalid environment",code:exports.FaceErrorCode.INVALID_ENVIRONMENT,data:{env:e}})},exports.invalidHostNameError=function(e){return O({message:"invalid host name error",code:exports.FaceErrorCode.UNAUTHORIZED,origin:e})},exports.invalidSignatureError=function(e){return O({message:"Invalid Signature message.",code:exports.FaceErrorCode.INVALID_SIGNATURE_MESSAGE,origin:e})},exports.invalidWallet=function(){return O({message:"invalid wallet error",code:exports.FaceErrorCode.INVALID_WALLET})},exports.isEthlikeBlockchain=function(e){return-1!==s.indexOf(e)},exports.isSupportedNetwork=e=>{switch(e){case exports.Network.ETHEREUM:case exports.Network.GOERLI:case exports.Network.POLYGON:case exports.Network.MUMBAI:case exports.Network.BNB_SMART_CHAIN:case exports.Network.BNB_SMART_CHAIN_TESTNET:case exports.Network.KLAYTN:case exports.Network.BAOBAB:case exports.Network.SOLANA:case exports.Network.SOLANA_DEVNET:case exports.Network.NEAR:case exports.Network.NEAR_TESTNET:case exports.Network.BORA:case exports.Network.BORA_TESTNET:case exports.Network.APTOS:case exports.Network.APTOS_TESTNET:case exports.Network.MEVERSE:case exports.Network.MEVERSE_TESTNET:case exports.Network.PSM_TESTNET:case exports.Network.PSM_TESTNET_DEV:case exports.Network.PSM_TESTNET_TEST:case exports.Network.HOME_VERSE:case exports.Network.HOME_VERSE_TESTNET:case exports.Network.YOOLDO_VERSE:case exports.Network.YOOLDO_VERSE_TESTNET:case exports.Network.OASYS:case exports.Network.OASYS_TESTNET:return!0;default:return!1}},exports.kitProvidersAndWalletsConfigError=function(){return O({message:"Both wallets and providers cannot be empty.",code:exports.FaceErrorCode.PROVIDERS_AND_WALLETS_CONFIG_ERROR})},exports.makeError=O,exports.networkToBlockchain=function(e){switch(e){case exports.Network.ETHEREUM:case exports.Network.ROPSTEN:case exports.Network.GOERLI:return exports.Blockchain.ETHEREUM;case exports.Network.POLYGON:case exports.Network.MUMBAI:return exports.Blockchain.POLYGON;case exports.Network.BNB_SMART_CHAIN:case exports.Network.BNB_SMART_CHAIN_TESTNET:return exports.Blockchain.BNB_SMART_CHAIN;case exports.Network.KLAYTN:case exports.Network.BAOBAB:return exports.Blockchain.KLAYTN;case exports.Network.SOLANA:case exports.Network.SOLANA_DEVNET:return exports.Blockchain.SOLANA;case exports.Network.BORA:case exports.Network.BORA_TESTNET:return exports.Blockchain.BORA;case exports.Network.NEAR:case exports.Network.NEAR_TESTNET:return exports.Blockchain.NEAR;case exports.Network.APTOS:case exports.Network.APTOS_TESTNET:return exports.Blockchain.APTOS;case exports.Network.MEVERSE:case exports.Network.MEVERSE_TESTNET:return exports.Blockchain.MEVERSE;case exports.Network.PSM:case exports.Network.PSM_TESTNET:return exports.Blockchain.PSM;case exports.Network.PSM_TESTNET_TEST:return exports.Blockchain.PSM_TEST;case exports.Network.PSM_TESTNET_DEV:return exports.Blockchain.PSM_DEV;case exports.Network.HOME_VERSE:case exports.Network.HOME_VERSE_TESTNET:return exports.Blockchain.HOME_VERSE;case exports.Network.YOOLDO_VERSE:case exports.Network.YOOLDO_VERSE_TESTNET:return exports.Blockchain.YOOLDO_VERSE;case exports.Network.OASYS:case exports.Network.OASYS_TESTNET:return exports.Blockchain.OASYS}throw new Error(`Unsupported network: ${e}`)},exports.noUserDataError=function(){return O({message:"no user data",code:exports.FaceErrorCode.NO_USER_DATA})},exports.notImplementedError=function(e){return O({message:e,code:exports.FaceErrorCode.NOT_IMPLEMENTED})},exports.oauthError=function(e,r){return O({message:`OAuth 2.0 Error: ${e}`,code:exports.FaceErrorCode.AUTHENTICATION,origin:r})},exports.parseFaceSolanaNearTransactionPayload=function(e){return null==e||"object"!=typeof e||null==e.serializedHex||"string"!=typeof e.serializedHex?null:e},exports.sendTransactionError=function(e){return O({message:e.message,code:exports.FaceErrorCode.SEND_TRANSACTION_FAILED,data:e.data})},exports.signError=function(e){return O({message:e,code:exports.FaceErrorCode.SIGN_FAILED})},exports.unknownError=function(e){return O({message:"unknown error",code:exports.FaceErrorCode.INTERNAL,origin:e})},exports.unsupportedChainError=function(e){return O({message:"unsupported chain error",code:exports.FaceErrorCode.UNSUPPORTED_CHAIN,origin:e})},exports.unsupportedProviderError=function(e){return O({message:`${e} login is not supported.`,code:exports.FaceErrorCode.UNSUPPORTED_SOCIAL_PROVIDER})},exports.unsupportedTokenProviderError=function(e){return O({message:`${e} is not support get id token`,code:exports.FaceErrorCode.UNSUPPORTED_SOCIAL_PROVIDER})},exports.userRejectedRequest=function(e){return O({code:exports.FaceErrorCode.USER_REJECTED_REQUEST,message:"user rejected request",data:{path:e}})}; | ||
//# sourceMappingURL=index.js.map |
@@ -45,3 +45,5 @@ export declare enum Network { | ||
YOOLDO_VERSE = "yooldo_verse", | ||
YOOLDO_VERSE_TESTNET = "yooldo_verse_testnet" | ||
YOOLDO_VERSE_TESTNET = "yooldo_verse_testnet", | ||
OASYS = "oasys", | ||
OASYS_TESTNET = "oasys_testnet" | ||
} | ||
@@ -66,3 +68,4 @@ export declare const isSupportedNetwork: (network?: Network) => boolean; | ||
HOME_VERSE = "HOME_VERSE", | ||
YOOLDO_VERSE = "YOOLDO_VERSE" | ||
YOOLDO_VERSE = "YOOLDO_VERSE", | ||
OASYS = "OASYS" | ||
} | ||
@@ -69,0 +72,0 @@ export declare function networkToBlockchain(network: Network): Blockchain; |
@@ -1,2 +0,2 @@ | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("ethers")):"function"==typeof define&&define.amd?define(["exports","ethers"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).FaceTypes={},e.ethers)}(this,(function(e,r){"use strict";var t;e.Network=void 0,(t=e.Network||(e.Network={})).ETHEREUM="ethereum",t.ROPSTEN="ropsten",t.GOERLI="goerli",t.POLYGON="polygon",t.MUMBAI="mumbai",t.BNB_SMART_CHAIN="bnb_smart_chain",t.BNB_SMART_CHAIN_TESTNET="bnb_smart_chain_testnet",t.KLAYTN="klaytn",t.BAOBAB="baobab",t.SOLANA="solana",t.SOLANA_DEVNET="solana_devnet",t.NEAR="near",t.NEAR_TESTNET="near_testnet",t.BORA="bora",t.BORA_TESTNET="bora_testnet",t.ETH_MAINNET="ethereum",t.ETH_TESTNET="ropsten",t.MATIC_MAINNET="polygon",t.MATIC_TESTNET="mumbai",t.BINANCE_COIN_MAINNET="bnb_smart_chain",t.BINANCE_COIN_TESTNET="bnb_smart_chain_testnet",t.KLAYTN_MAINNET="klaytn",t.KLAYTN_TESTNET="baobab",t.APTOS="aptoslab",t.APTOS_TESTNET="aptoslab_testnet",t.MEVERSE="meverse",t.MEVERSE_TESTNET="meverse_testnet",t.PSM="psm",t.PSM_TESTNET="psm_testnet",t.PSM_TESTNET_TEST="psm_testnet_test",t.PSM_TESTNET_DEV="psm_testnet_dev",t.HOME_VERSE="home_verse",t.HOME_VERSE_TESTNET="home_verse_testnet",t.YOOLDO_VERSE="yooldo_verse",t.YOOLDO_VERSE_TESTNET="yooldo_verse_testnet";const o={[e.Network.ETHEREUM]:1,[e.Network.ROPSTEN]:3,[e.Network.GOERLI]:5,[e.Network.POLYGON]:137,[e.Network.MUMBAI]:80001,[e.Network.BNB_SMART_CHAIN]:56,[e.Network.BNB_SMART_CHAIN_TESTNET]:97,[e.Network.KLAYTN]:8217,[e.Network.BAOBAB]:1001,[e.Network.SOLANA]:0,[e.Network.SOLANA_DEVNET]:0,[e.Network.NEAR]:0,[e.Network.NEAR_TESTNET]:0,[e.Network.BORA]:77001,[e.Network.BORA_TESTNET]:99001,[e.Network.APTOS]:1,[e.Network.APTOS_TESTNET]:2,[e.Network.MEVERSE]:7518,[e.Network.MEVERSE_TESTNET]:4759,[e.Network.PSM_TESTNET_DEV]:100,[e.Network.PSM_TESTNET_TEST]:400,[e.Network.PSM_TESTNET]:500,[e.Network.PSM]:91002,[e.Network.HOME_VERSE]:19011,[e.Network.HOME_VERSE_TESTNET]:40875,[e.Network.YOOLDO_VERSE]:411,[e.Network.YOOLDO_VERSE_TESTNET]:20197,1:e.Network.ETHEREUM,3:e.Network.ROPSTEN,5:e.Network.GOERLI,137:e.Network.POLYGON,80001:e.Network.MUMBAI,56:e.Network.BNB_SMART_CHAIN,97:e.Network.BNB_SMART_CHAIN_TESTNET,8217:e.Network.KLAYTN,1001:e.Network.BAOBAB,77001:e.Network.BORA,99001:e.Network.BORA_TESTNET,7518:e.Network.MEVERSE,4759:e.Network.MEVERSE_TESTNET,100:e.Network.PSM_TESTNET_DEV,400:e.Network.PSM_TESTNET_TEST,500:e.Network.PSM_TESTNET,91002:e.Network.PSM,19011:e.Network.HOME_VERSE,40875:e.Network.HOME_VERSE_TESTNET,411:e.Network.YOOLDO_VERSE,20197:e.Network.YOOLDO_VERSE_TESTNET};var E;e.Blockchain=void 0,(E=e.Blockchain||(e.Blockchain={})).ETHEREUM="ETHEREUM",E.POLYGON="POLYGON",E.BNB_SMART_CHAIN="BNB_SMART_CHAIN",E.KLAYTN="KLAYTN",E.SOLANA="SOLANA",E.NEAR="NEAR",E.BORA="BORA",E.APTOS="APTOS",E.MEVERSE="MEVERSE",E.PSM="PSM",E.PSM_TEST="PSM_TEST",E.PSM_DEV="PSM_DEV",E.HOME_VERSE="HOME_VERSE",E.YOOLDO_VERSE="YOOLDO_VERSE";const n=[e.Blockchain.ETHEREUM,e.Blockchain.POLYGON,e.Blockchain.BNB_SMART_CHAIN,e.Blockchain.KLAYTN,e.Blockchain.BORA,e.Blockchain.MEVERSE,e.Blockchain.PSM,e.Blockchain.PSM_DEV,e.Blockchain.PSM_TEST,e.Blockchain.HOME_VERSE,e.Blockchain.YOOLDO_VERSE];var a,c,s,N,_,T,i,S;e.BoraPortalConnectStatusEnum=void 0,(a=e.BoraPortalConnectStatusEnum||(e.BoraPortalConnectStatusEnum={})).Connected="CONNECTED",a.Unconnected="UNCONNECTED";class A{constructor(e,r){A.ensureHexString(e),A.checkLength(e,r),this.hex=e,this.length=r}static empty(){return new A("",0)}static fromUint8Array(e){return new A(R(e),e.length)}static fromHex(e,r){return new A(e,r)}static ensureHexString(e){try{if(""===e)return;if(null==e)throw new Error(`hex is null ${e}`);if(!e.startsWith("0x"))throw new Error(`hex does not start with 0x ${e}`);if(null==e.match("0x[0-9a-fA-F]+"))throw new Error(`invalid hex data ${e}`)}catch(e){throw e}}static checkLength(e,r){if(0===e.length)return;if(4*(e.length-2)/8>r)throw new Error(`length is less than hex data ${e}, ${r}`)}toString(){return this.hex}toHex(){return this.hex}toBigNumber(){return r.BigNumber.from(this.hex)}toJSON(){return{hex:this.hex,length:this.length}}static fromJSON(e){const{hex:r,length:t}=JSON.parse(e);return new A(r,t)}static fromBigNumber(e,r){return A.fromHex(e.toHexString(),r)}toUInt8Array(){const e=this.hex.substring(2),r=[];for(let t=0;t<e.length;t+=2)r.push(parseInt(e.substring(t,t+2),16));return new Uint8Array(r)}static concat(e,r){try{const t=e.toUInt8Array(),o=r.toUInt8Array(),E=new Uint8Array(t.length+o.length);E.set(t),E.set(o,t.length);const n=R(E);return new A(n,t.length+o.length)}catch(e){return console.debug("concat error",e),A.empty()}}split(e){const r=this.toUInt8Array();return[A.fromUint8Array(r.slice(0,e)),A.fromUint8Array(r.slice(e))]}clone(){return new A(this.hex,this.length)}unsafeSetLength(e){this.length=e}}function R(e){return"0x"+[...e].map((e=>e.toString(16).padStart(2,"0"))).join("")}function O(e){return function(e){return null===e}(e)||function(e){return void 0===e}(e)}e.Env=void 0,(c=e.Env||(e.Env={})).Local="Local",c.Dev="Dev",c.StageTest="StageTest",c.StageMainnet="StageMainnet",c.ProdTest="ProdTest",c.ProdMainnet="ProdMainnet",e.JsonRpcMethod=void 0,(s=e.JsonRpcMethod||(e.JsonRpcMethod={})).face_logInSignUp="face_logInSignUp",s.face_loggedIn="face_loggedIn",s.face_logOut="face_logOut",s.face_open2fa="face_open2fa",s.face_currentUser="face_currentUser",s.face_accounts="face_accounts",s.face_getUserVerificationToken="face_getUserVerificationToken",s.face_openIframe="face_openIframe",s.face_closeIframe="face_closeIframe",s.face_ready="face_ready",s.face_openHome="face_openHome",s.face_openKit="face_openKit",s.face_connectExternalWallet="face_connectExternalWallet",s.face_openWalletConnect="face_openWalletConnect",s.face_confirmWalletConnectDapp="face_confirmWalletConnectDapp",s.face_switchNetwork="face_switchNetwork",s.face_directSocialLogin="face_directSocialLogin",s.face_getIdToken="face_getIdToken",s.face_loginWithIdToken="face_loginWithIdToken",s.face_loginWithAccessToken="face_loginWithAccessToken",s.face_showToast="face_showToast",s.bora_connect="bora_connect",s.bora_isConnected="bora_isConnected",s.eth_sendTransaction="eth_sendTransaction",s.eth_getBalance="eth_getBalance",s.eth_call="eth_call",s.eth_estimateGas="eth_estimateGas",s.eth_sign="eth_sign",s.eth_signTypedData_v3="eth_signTypedData_v3",s.eth_signTypedData_v4="eth_signTypedData_v4",s.eth_accounts="eth_accounts",s.personal_sign="personal_sign",s.personal_listAccounts="personal_listAccounts",s.wallet_switchEthereumChain="wallet_switchEthereumChain",s.solana_sendTransaction="solana_sendTransaction",s.near_broadcast_tx_async="near_broadcast_tx_async",s.near_get_balance="near_get_balance",s.aptos_signMultiAgentTransaction="aptos_signMultiAgentTransaction",s.aptos_signMessage="aptos_signMessage",s.aptos_signTransaction="aptos_signTransaction",s.aptos_signAndSubmitTransaction="aptos_signAndSubmitTransaction",e.JsonRpcSource=void 0,(N=e.JsonRpcSource||(e.JsonRpcSource={})).FACE_SDK="FACE_SDK",N.FACE_IFRAME="FACE_IFRAME",N.FACE_WALLET_CONNECT="FACE_WALLET_CONNECT",N.FACE_NATIVE_SDK="FACE_NATIVE_SDK",e.RpcErrorCode=void 0,(_=e.RpcErrorCode||(e.RpcErrorCode={}))[_.PARSE_ERROR=-32700]="PARSE_ERROR",_[_.INVALID_REQUEST=-32600]="INVALID_REQUEST",_[_.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",_[_.INVALID_PARAMS=-32602]="INVALID_PARAMS",_[_.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",e.HttpStatus=void 0,(T=e.HttpStatus||(e.HttpStatus={}))[T.SUCCESS=200]="SUCCESS",T[T.CREATED=201]="CREATED",T[T.BAD_REQUEST=400]="BAD_REQUEST",T[T.UNAUTHORIZED=401]="UNAUTHORIZED",T[T.FORBIDDEN=403]="FORBIDDEN",T[T.NOT_FOUND=404]="NOT_FOUND",T[T.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e.FaceErrorCode=void 0,(i=e.FaceErrorCode||(e.FaceErrorCode={}))[i.INVALID_ARGUMENT=4e3]="INVALID_ARGUMENT",i[i.USER_REJECTED_REQUEST=4001]="USER_REJECTED_REQUEST",i[i.NOT_IMPLEMENTED=4002]="NOT_IMPLEMENTED",i[i.BAD_REQUEST=4003]="BAD_REQUEST",i[i.SEND_TRANSACTION_FAILED=4004]="SEND_TRANSACTION_FAILED",i[i.SIGN_FAILED=4005]="SIGN_FAILED",i[i.UNAUTHORIZED=4100]="UNAUTHORIZED",i[i.NO_USER_DATA=4101]="NO_USER_DATA",i[i.AUTHENTICATION=4102]="AUTHENTICATION",i[i.UNSUPPORTED_SOCIAL_PROVIDER=4103]="UNSUPPORTED_SOCIAL_PROVIDER",i[i.INVALID_ENVIRONMENT=4200]="INVALID_ENVIRONMENT",i[i.UNSUPPORTED_METHOD=4201]="UNSUPPORTED_METHOD",i[i.UNSUPPORTED_CHAIN=4202]="UNSUPPORTED_CHAIN",i[i.INVALID_WALLET=4300]="INVALID_WALLET",i[i.PROVIDERS_AND_WALLETS_CONFIG_ERROR=4301]="PROVIDERS_AND_WALLETS_CONFIG_ERROR",i[i.INVALID_SIGNATURE_MESSAGE=4906]="INVALID_SIGNATURE_MESSAGE",i[i.INVALID_BORA_API_AND_SECRET_KEY=4907]="INVALID_BORA_API_AND_SECRET_KEY",i[i.ALREADY_CONNECTED_OTHER_BAPP_USN=4909]="ALREADY_CONNECTED_OTHER_BAPP_USN",i[i.BORA_SERVICE_REGION_IS_WRONG=4910]="BORA_SERVICE_REGION_IS_WRONG",i[i.INTERNAL=5e3]="INTERNAL";class l extends Error{static isFaceError(e){return e.isFaceError}isValidErrorCode(r){return!O(t=r)&&"number"==typeof t&&Object.values(e.RpcErrorCode).includes(t)||function(r){return!O(r)&&"number"==typeof r&&Object.values(e.FaceErrorCode).includes(r)}(r);var t}constructor(r){super(),this.isFaceError=!0,this.code=this.isValidErrorCode(r.code)?r.code:e.FaceErrorCode.INTERNAL,this.message=`Face Error: [${this.code}] ${r.message}`,r.origin&&(r.origin.isFaceError&&r.origin.origin?this.origin=r.origin.origin:this.origin=r.origin),r.data&&(this.data=r.data),Object.setPrototypeOf(this,l.prototype),Error.captureStackTrace(this,this.constructor)}}function u(r){return d({message:`invalid ${r}`,code:e.FaceErrorCode.INVALID_ARGUMENT})}function d(e){return new l(e)}function h(e,r,t){if(!e)throw r(...null!=t?t:[])}e.TxType=void 0,(S=e.TxType||(e.TxType={})).COIN="COIN",S.ERC20="ERC20",S.ERC721="ERC721",S.ERC1155="ERC1155",S.FT="FT",S.CONVERT="CONVERT";var k;e.UserStatus=void 0,(k=e.UserStatus||(e.UserStatus={})).isWalletCreated="isWalletCreated",k.isNewUser="isNewUser",k.isRegisteredPinCode="isRegisteredPinCode",k.isAdmin="isAdmin",e.CryptoBuffer=A,e.FaceAuthSessionKey="Face-Auth-Session",e.FaceError=l,e.FaceOAuthResultKey="Face-OAuth-Result",e.FaceVersionLocalKey="Face-Version",e.LoginProvider={Google:"google.com",Apple:"apple.com",Twitter:"twitter.com",Discord:"discord.com",Facebook:"facebook.com",Kakao:"kakao.com"},e.NetworkChainIdMap=o,e.WalletPath="m/44'/60'/1'/0/0",e.alreadyConnectedToOtherBappusn=function(r){return d({message:"already connected to other bappusn",code:e.FaceErrorCode.ALREADY_CONNECTED_OTHER_BAPP_USN,origin:r})},e.assert=h,e.assertArgument=function(e,r,t,o=!0){(o||e)&&h(!!e&&r,u,[t])},e.boraServiceRegionIsWrong=function(r){return new l({message:"bora service region is wrong",code:e.FaceErrorCode.BORA_SERVICE_REGION_IS_WRONG,origin:r})},e.getEthlikeBlockchains=function(){return n},e.getPlatFormCoinDecimalByBlockchain=r=>{switch(r){case e.Blockchain.ETHEREUM:case e.Blockchain.POLYGON:case e.Blockchain.KLAYTN:case e.Blockchain.BNB_SMART_CHAIN:case e.Blockchain.BORA:case e.Blockchain.MEVERSE:case e.Blockchain.PSM:case e.Blockchain.PSM_DEV:case e.Blockchain.PSM_TEST:case e.Blockchain.HOME_VERSE:case e.Blockchain.YOOLDO_VERSE:return 18;case e.Blockchain.SOLANA:return 9;case e.Blockchain.NEAR:return 24;case e.Blockchain.APTOS:return 8;default:throw new Error("unsupported blockchain")}},e.invalidApiKeyError=function(r){return d({message:"invalid api key error",code:e.FaceErrorCode.UNAUTHORIZED,origin:r})},e.invalidArgumentError=u,e.invalidBoraPortalIdAndSecretKey=function(r){return d({message:"Not found bapp. please contact FaceWallet Team to register BoraPortal Client Id/SecretKey.",code:e.FaceErrorCode.INVALID_BORA_API_AND_SECRET_KEY,origin:r})},e.invalidEnvironmentError=function(r){return d({message:"invalid environment",code:e.FaceErrorCode.INVALID_ENVIRONMENT,data:{env:r}})},e.invalidHostNameError=function(r){return d({message:"invalid host name error",code:e.FaceErrorCode.UNAUTHORIZED,origin:r})},e.invalidSignatureError=function(r){return d({message:"Invalid Signature message.",code:e.FaceErrorCode.INVALID_SIGNATURE_MESSAGE,origin:r})},e.invalidWallet=function(){return d({message:"invalid wallet error",code:e.FaceErrorCode.INVALID_WALLET})},e.isEthlikeBlockchain=function(e){return-1!==n.indexOf(e)},e.isSupportedNetwork=r=>{switch(r){case e.Network.ETHEREUM:case e.Network.GOERLI:case e.Network.POLYGON:case e.Network.MUMBAI:case e.Network.BNB_SMART_CHAIN:case e.Network.BNB_SMART_CHAIN_TESTNET:case e.Network.KLAYTN:case e.Network.BAOBAB:case e.Network.SOLANA:case e.Network.SOLANA_DEVNET:case e.Network.NEAR:case e.Network.NEAR_TESTNET:case e.Network.BORA:case e.Network.BORA_TESTNET:case e.Network.APTOS:case e.Network.APTOS_TESTNET:case e.Network.MEVERSE:case e.Network.MEVERSE_TESTNET:case e.Network.PSM_TESTNET:case e.Network.PSM_TESTNET_DEV:case e.Network.PSM_TESTNET_TEST:case e.Network.HOME_VERSE:case e.Network.HOME_VERSE_TESTNET:case e.Network.YOOLDO_VERSE:case e.Network.YOOLDO_VERSE_TESTNET:return!0;default:return!1}},e.kitProvidersAndWalletsConfigError=function(){return d({message:"Both wallets and providers cannot be empty.",code:e.FaceErrorCode.PROVIDERS_AND_WALLETS_CONFIG_ERROR})},e.makeError=d,e.networkToBlockchain=function(r){switch(r){case e.Network.ETHEREUM:case e.Network.ROPSTEN:case e.Network.GOERLI:return e.Blockchain.ETHEREUM;case e.Network.POLYGON:case e.Network.MUMBAI:return e.Blockchain.POLYGON;case e.Network.BNB_SMART_CHAIN:case e.Network.BNB_SMART_CHAIN_TESTNET:return e.Blockchain.BNB_SMART_CHAIN;case e.Network.KLAYTN:case e.Network.BAOBAB:return e.Blockchain.KLAYTN;case e.Network.SOLANA:case e.Network.SOLANA_DEVNET:return e.Blockchain.SOLANA;case e.Network.BORA:case e.Network.BORA_TESTNET:return e.Blockchain.BORA;case e.Network.NEAR:case e.Network.NEAR_TESTNET:return e.Blockchain.NEAR;case e.Network.APTOS:case e.Network.APTOS_TESTNET:return e.Blockchain.APTOS;case e.Network.MEVERSE:case e.Network.MEVERSE_TESTNET:return e.Blockchain.MEVERSE;case e.Network.PSM:case e.Network.PSM_TESTNET:return e.Blockchain.PSM;case e.Network.PSM_TESTNET_TEST:return e.Blockchain.PSM_TEST;case e.Network.PSM_TESTNET_DEV:return e.Blockchain.PSM_DEV;case e.Network.HOME_VERSE:case e.Network.HOME_VERSE_TESTNET:return e.Blockchain.HOME_VERSE;case e.Network.YOOLDO_VERSE:case e.Network.YOOLDO_VERSE_TESTNET:return e.Blockchain.YOOLDO_VERSE}throw new Error(`Unsupported network: ${r}`)},e.noUserDataError=function(){return d({message:"no user data",code:e.FaceErrorCode.NO_USER_DATA})},e.notImplementedError=function(r){return d({message:r,code:e.FaceErrorCode.NOT_IMPLEMENTED})},e.oauthError=function(r,t){return d({message:`OAuth 2.0 Error: ${r}`,code:e.FaceErrorCode.AUTHENTICATION,origin:t})},e.parseFaceSolanaNearTransactionPayload=function(e){return null==e||"object"!=typeof e||null==e.serializedHex||"string"!=typeof e.serializedHex?null:e},e.sendTransactionError=function(r){return d({message:r.message,code:e.FaceErrorCode.SEND_TRANSACTION_FAILED,data:r.data})},e.signError=function(r){return d({message:r,code:e.FaceErrorCode.SIGN_FAILED})},e.unknownError=function(r){return d({message:"unknown error",code:e.FaceErrorCode.INTERNAL,origin:r})},e.unsupportedChainError=function(r){return d({message:"unsupported chain error",code:e.FaceErrorCode.UNSUPPORTED_CHAIN,origin:r})},e.unsupportedProviderError=function(r){return d({message:`${r} login is not supported.`,code:e.FaceErrorCode.UNSUPPORTED_SOCIAL_PROVIDER})},e.unsupportedTokenProviderError=function(r){return d({message:`${r} is not support get id token`,code:e.FaceErrorCode.UNSUPPORTED_SOCIAL_PROVIDER})},e.userRejectedRequest=function(r){return d({code:e.FaceErrorCode.USER_REJECTED_REQUEST,message:"user rejected request",data:{path:r}})},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
!function(e,r){"object"==typeof exports&&"undefined"!=typeof module?r(exports,require("ethers")):"function"==typeof define&&define.amd?define(["exports","ethers"],r):r((e="undefined"!=typeof globalThis?globalThis:e||self).FaceTypes={},e.ethers)}(this,(function(e,r){"use strict";var t;e.Network=void 0,(t=e.Network||(e.Network={})).ETHEREUM="ethereum",t.ROPSTEN="ropsten",t.GOERLI="goerli",t.POLYGON="polygon",t.MUMBAI="mumbai",t.BNB_SMART_CHAIN="bnb_smart_chain",t.BNB_SMART_CHAIN_TESTNET="bnb_smart_chain_testnet",t.KLAYTN="klaytn",t.BAOBAB="baobab",t.SOLANA="solana",t.SOLANA_DEVNET="solana_devnet",t.NEAR="near",t.NEAR_TESTNET="near_testnet",t.BORA="bora",t.BORA_TESTNET="bora_testnet",t.ETH_MAINNET="ethereum",t.ETH_TESTNET="ropsten",t.MATIC_MAINNET="polygon",t.MATIC_TESTNET="mumbai",t.BINANCE_COIN_MAINNET="bnb_smart_chain",t.BINANCE_COIN_TESTNET="bnb_smart_chain_testnet",t.KLAYTN_MAINNET="klaytn",t.KLAYTN_TESTNET="baobab",t.APTOS="aptoslab",t.APTOS_TESTNET="aptoslab_testnet",t.MEVERSE="meverse",t.MEVERSE_TESTNET="meverse_testnet",t.PSM="psm",t.PSM_TESTNET="psm_testnet",t.PSM_TESTNET_TEST="psm_testnet_test",t.PSM_TESTNET_DEV="psm_testnet_dev",t.HOME_VERSE="home_verse",t.HOME_VERSE_TESTNET="home_verse_testnet",t.YOOLDO_VERSE="yooldo_verse",t.YOOLDO_VERSE_TESTNET="yooldo_verse_testnet",t.OASYS="oasys",t.OASYS_TESTNET="oasys_testnet";const o={[e.Network.ETHEREUM]:1,[e.Network.ROPSTEN]:3,[e.Network.GOERLI]:5,[e.Network.POLYGON]:137,[e.Network.MUMBAI]:80001,[e.Network.BNB_SMART_CHAIN]:56,[e.Network.BNB_SMART_CHAIN_TESTNET]:97,[e.Network.KLAYTN]:8217,[e.Network.BAOBAB]:1001,[e.Network.SOLANA]:0,[e.Network.SOLANA_DEVNET]:0,[e.Network.NEAR]:0,[e.Network.NEAR_TESTNET]:0,[e.Network.BORA]:77001,[e.Network.BORA_TESTNET]:99001,[e.Network.APTOS]:1,[e.Network.APTOS_TESTNET]:2,[e.Network.MEVERSE]:7518,[e.Network.MEVERSE_TESTNET]:4759,[e.Network.PSM_TESTNET_DEV]:100,[e.Network.PSM_TESTNET_TEST]:400,[e.Network.PSM_TESTNET]:500,[e.Network.PSM]:91002,[e.Network.HOME_VERSE]:19011,[e.Network.HOME_VERSE_TESTNET]:40875,[e.Network.YOOLDO_VERSE]:411,[e.Network.YOOLDO_VERSE_TESTNET]:20197,[e.Network.OASYS]:248,[e.Network.OASYS_TESTNET]:9372,1:e.Network.ETHEREUM,3:e.Network.ROPSTEN,5:e.Network.GOERLI,137:e.Network.POLYGON,80001:e.Network.MUMBAI,56:e.Network.BNB_SMART_CHAIN,97:e.Network.BNB_SMART_CHAIN_TESTNET,8217:e.Network.KLAYTN,1001:e.Network.BAOBAB,77001:e.Network.BORA,99001:e.Network.BORA_TESTNET,7518:e.Network.MEVERSE,4759:e.Network.MEVERSE_TESTNET,100:e.Network.PSM_TESTNET_DEV,400:e.Network.PSM_TESTNET_TEST,500:e.Network.PSM_TESTNET,91002:e.Network.PSM,19011:e.Network.HOME_VERSE,40875:e.Network.HOME_VERSE_TESTNET,411:e.Network.YOOLDO_VERSE,20197:e.Network.YOOLDO_VERSE_TESTNET,248:e.Network.OASYS,9372:e.Network.OASYS_TESTNET};var E;e.Blockchain=void 0,(E=e.Blockchain||(e.Blockchain={})).ETHEREUM="ETHEREUM",E.POLYGON="POLYGON",E.BNB_SMART_CHAIN="BNB_SMART_CHAIN",E.KLAYTN="KLAYTN",E.SOLANA="SOLANA",E.NEAR="NEAR",E.BORA="BORA",E.APTOS="APTOS",E.MEVERSE="MEVERSE",E.PSM="PSM",E.PSM_TEST="PSM_TEST",E.PSM_DEV="PSM_DEV",E.HOME_VERSE="HOME_VERSE",E.YOOLDO_VERSE="YOOLDO_VERSE",E.OASYS="OASYS";const n=[e.Blockchain.ETHEREUM,e.Blockchain.POLYGON,e.Blockchain.BNB_SMART_CHAIN,e.Blockchain.KLAYTN,e.Blockchain.BORA,e.Blockchain.MEVERSE,e.Blockchain.PSM,e.Blockchain.PSM_DEV,e.Blockchain.PSM_TEST,e.Blockchain.HOME_VERSE,e.Blockchain.YOOLDO_VERSE,e.Blockchain.OASYS];var a,c,s,N,T,_,i,S;e.BoraPortalConnectStatusEnum=void 0,(a=e.BoraPortalConnectStatusEnum||(e.BoraPortalConnectStatusEnum={})).Connected="CONNECTED",a.Unconnected="UNCONNECTED";class A{constructor(e,r){A.ensureHexString(e),A.checkLength(e,r),this.hex=e,this.length=r}static empty(){return new A("",0)}static fromUint8Array(e){return new A(R(e),e.length)}static fromHex(e,r){return new A(e,r)}static ensureHexString(e){try{if(""===e)return;if(null==e)throw new Error(`hex is null ${e}`);if(!e.startsWith("0x"))throw new Error(`hex does not start with 0x ${e}`);if(null==e.match("0x[0-9a-fA-F]+"))throw new Error(`invalid hex data ${e}`)}catch(e){throw e}}static checkLength(e,r){if(0===e.length)return;if(4*(e.length-2)/8>r)throw new Error(`length is less than hex data ${e}, ${r}`)}toString(){return this.hex}toHex(){return this.hex}toBigNumber(){return r.BigNumber.from(this.hex)}toJSON(){return{hex:this.hex,length:this.length}}static fromJSON(e){const{hex:r,length:t}=JSON.parse(e);return new A(r,t)}static fromBigNumber(e,r){return A.fromHex(e.toHexString(),r)}toUInt8Array(){const e=this.hex.substring(2),r=[];for(let t=0;t<e.length;t+=2)r.push(parseInt(e.substring(t,t+2),16));return new Uint8Array(r)}static concat(e,r){try{const t=e.toUInt8Array(),o=r.toUInt8Array(),E=new Uint8Array(t.length+o.length);E.set(t),E.set(o,t.length);const n=R(E);return new A(n,t.length+o.length)}catch(e){return console.debug("concat error",e),A.empty()}}split(e){const r=this.toUInt8Array();return[A.fromUint8Array(r.slice(0,e)),A.fromUint8Array(r.slice(e))]}clone(){return new A(this.hex,this.length)}unsafeSetLength(e){this.length=e}}function R(e){return"0x"+[...e].map((e=>e.toString(16).padStart(2,"0"))).join("")}function O(e){return function(e){return null===e}(e)||function(e){return void 0===e}(e)}e.Env=void 0,(c=e.Env||(e.Env={})).Local="Local",c.Dev="Dev",c.StageTest="StageTest",c.StageMainnet="StageMainnet",c.ProdTest="ProdTest",c.ProdMainnet="ProdMainnet",e.JsonRpcMethod=void 0,(s=e.JsonRpcMethod||(e.JsonRpcMethod={})).face_logInSignUp="face_logInSignUp",s.face_loggedIn="face_loggedIn",s.face_logOut="face_logOut",s.face_open2fa="face_open2fa",s.face_currentUser="face_currentUser",s.face_accounts="face_accounts",s.face_getUserVerificationToken="face_getUserVerificationToken",s.face_openIframe="face_openIframe",s.face_closeIframe="face_closeIframe",s.face_ready="face_ready",s.face_openHome="face_openHome",s.face_openKit="face_openKit",s.face_connectExternalWallet="face_connectExternalWallet",s.face_openWalletConnect="face_openWalletConnect",s.face_confirmWalletConnectDapp="face_confirmWalletConnectDapp",s.face_switchNetwork="face_switchNetwork",s.face_directSocialLogin="face_directSocialLogin",s.face_getIdToken="face_getIdToken",s.face_loginWithIdToken="face_loginWithIdToken",s.face_loginWithAccessToken="face_loginWithAccessToken",s.face_showToast="face_showToast",s.bora_connect="bora_connect",s.bora_isConnected="bora_isConnected",s.eth_sendTransaction="eth_sendTransaction",s.eth_getBalance="eth_getBalance",s.eth_call="eth_call",s.eth_estimateGas="eth_estimateGas",s.eth_sign="eth_sign",s.eth_signTypedData_v3="eth_signTypedData_v3",s.eth_signTypedData_v4="eth_signTypedData_v4",s.eth_accounts="eth_accounts",s.personal_sign="personal_sign",s.personal_listAccounts="personal_listAccounts",s.wallet_switchEthereumChain="wallet_switchEthereumChain",s.solana_sendTransaction="solana_sendTransaction",s.near_broadcast_tx_async="near_broadcast_tx_async",s.near_get_balance="near_get_balance",s.aptos_signMultiAgentTransaction="aptos_signMultiAgentTransaction",s.aptos_signMessage="aptos_signMessage",s.aptos_signTransaction="aptos_signTransaction",s.aptos_signAndSubmitTransaction="aptos_signAndSubmitTransaction",e.JsonRpcSource=void 0,(N=e.JsonRpcSource||(e.JsonRpcSource={})).FACE_SDK="FACE_SDK",N.FACE_IFRAME="FACE_IFRAME",N.FACE_WALLET_CONNECT="FACE_WALLET_CONNECT",N.FACE_NATIVE_SDK="FACE_NATIVE_SDK",e.RpcErrorCode=void 0,(T=e.RpcErrorCode||(e.RpcErrorCode={}))[T.PARSE_ERROR=-32700]="PARSE_ERROR",T[T.INVALID_REQUEST=-32600]="INVALID_REQUEST",T[T.METHOD_NOT_FOUND=-32601]="METHOD_NOT_FOUND",T[T.INVALID_PARAMS=-32602]="INVALID_PARAMS",T[T.INTERNAL_ERROR=-32603]="INTERNAL_ERROR",e.HttpStatus=void 0,(_=e.HttpStatus||(e.HttpStatus={}))[_.SUCCESS=200]="SUCCESS",_[_.CREATED=201]="CREATED",_[_.BAD_REQUEST=400]="BAD_REQUEST",_[_.UNAUTHORIZED=401]="UNAUTHORIZED",_[_.FORBIDDEN=403]="FORBIDDEN",_[_.NOT_FOUND=404]="NOT_FOUND",_[_.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e.FaceErrorCode=void 0,(i=e.FaceErrorCode||(e.FaceErrorCode={}))[i.INVALID_ARGUMENT=4e3]="INVALID_ARGUMENT",i[i.USER_REJECTED_REQUEST=4001]="USER_REJECTED_REQUEST",i[i.NOT_IMPLEMENTED=4002]="NOT_IMPLEMENTED",i[i.BAD_REQUEST=4003]="BAD_REQUEST",i[i.SEND_TRANSACTION_FAILED=4004]="SEND_TRANSACTION_FAILED",i[i.SIGN_FAILED=4005]="SIGN_FAILED",i[i.UNAUTHORIZED=4100]="UNAUTHORIZED",i[i.NO_USER_DATA=4101]="NO_USER_DATA",i[i.AUTHENTICATION=4102]="AUTHENTICATION",i[i.UNSUPPORTED_SOCIAL_PROVIDER=4103]="UNSUPPORTED_SOCIAL_PROVIDER",i[i.INVALID_ENVIRONMENT=4200]="INVALID_ENVIRONMENT",i[i.UNSUPPORTED_METHOD=4201]="UNSUPPORTED_METHOD",i[i.UNSUPPORTED_CHAIN=4202]="UNSUPPORTED_CHAIN",i[i.INVALID_WALLET=4300]="INVALID_WALLET",i[i.PROVIDERS_AND_WALLETS_CONFIG_ERROR=4301]="PROVIDERS_AND_WALLETS_CONFIG_ERROR",i[i.INVALID_SIGNATURE_MESSAGE=4906]="INVALID_SIGNATURE_MESSAGE",i[i.INVALID_BORA_API_AND_SECRET_KEY=4907]="INVALID_BORA_API_AND_SECRET_KEY",i[i.ALREADY_CONNECTED_OTHER_BAPP_USN=4909]="ALREADY_CONNECTED_OTHER_BAPP_USN",i[i.BORA_SERVICE_REGION_IS_WRONG=4910]="BORA_SERVICE_REGION_IS_WRONG",i[i.INTERNAL=5e3]="INTERNAL";class l extends Error{static isFaceError(e){return e.isFaceError}isValidErrorCode(r){return!O(t=r)&&"number"==typeof t&&Object.values(e.RpcErrorCode).includes(t)||function(r){return!O(r)&&"number"==typeof r&&Object.values(e.FaceErrorCode).includes(r)}(r);var t}constructor(r){super(),this.isFaceError=!0,this.code=this.isValidErrorCode(r.code)?r.code:e.FaceErrorCode.INTERNAL,this.message=`Face Error: [${this.code}] ${r.message}`,r.origin&&(r.origin.isFaceError&&r.origin.origin?this.origin=r.origin.origin:this.origin=r.origin),r.data&&(this.data=r.data),Object.setPrototypeOf(this,l.prototype),Error.captureStackTrace(this,this.constructor)}}function u(r){return k({message:`invalid ${r}`,code:e.FaceErrorCode.INVALID_ARGUMENT})}function k(e){return new l(e)}function d(e,r,t){if(!e)throw r(...null!=t?t:[])}e.TxType=void 0,(S=e.TxType||(e.TxType={})).COIN="COIN",S.ERC20="ERC20",S.ERC721="ERC721",S.ERC1155="ERC1155",S.FT="FT",S.CONVERT="CONVERT";var h;e.UserStatus=void 0,(h=e.UserStatus||(e.UserStatus={})).isWalletCreated="isWalletCreated",h.isNewUser="isNewUser",h.isRegisteredPinCode="isRegisteredPinCode",h.isAdmin="isAdmin",e.CryptoBuffer=A,e.FaceAuthSessionKey="Face-Auth-Session",e.FaceError=l,e.FaceOAuthResultKey="Face-OAuth-Result",e.FaceVersionLocalKey="Face-Version",e.LoginProvider={Google:"google.com",Apple:"apple.com",Twitter:"twitter.com",Discord:"discord.com",Facebook:"facebook.com",Kakao:"kakao.com"},e.NetworkChainIdMap=o,e.WalletPath="m/44'/60'/1'/0/0",e.alreadyConnectedToOtherBappusn=function(r){return k({message:"already connected to other bappusn",code:e.FaceErrorCode.ALREADY_CONNECTED_OTHER_BAPP_USN,origin:r})},e.assert=d,e.assertArgument=function(e,r,t,o=!0){(o||e)&&d(!!e&&r,u,[t])},e.boraServiceRegionIsWrong=function(r){return new l({message:"bora service region is wrong",code:e.FaceErrorCode.BORA_SERVICE_REGION_IS_WRONG,origin:r})},e.getEthlikeBlockchains=function(){return n},e.getPlatFormCoinDecimalByBlockchain=r=>{switch(r){case e.Blockchain.ETHEREUM:case e.Blockchain.POLYGON:case e.Blockchain.KLAYTN:case e.Blockchain.BNB_SMART_CHAIN:case e.Blockchain.BORA:case e.Blockchain.MEVERSE:case e.Blockchain.PSM:case e.Blockchain.PSM_DEV:case e.Blockchain.PSM_TEST:case e.Blockchain.HOME_VERSE:case e.Blockchain.YOOLDO_VERSE:case e.Blockchain.OASYS:return 18;case e.Blockchain.SOLANA:return 9;case e.Blockchain.NEAR:return 24;case e.Blockchain.APTOS:return 8;default:throw new Error("unsupported blockchain")}},e.invalidApiKeyError=function(r){return k({message:"invalid api key error",code:e.FaceErrorCode.UNAUTHORIZED,origin:r})},e.invalidArgumentError=u,e.invalidBoraPortalIdAndSecretKey=function(r){return k({message:"Not found bapp. please contact FaceWallet Team to register BoraPortal Client Id/SecretKey.",code:e.FaceErrorCode.INVALID_BORA_API_AND_SECRET_KEY,origin:r})},e.invalidEnvironmentError=function(r){return k({message:"invalid environment",code:e.FaceErrorCode.INVALID_ENVIRONMENT,data:{env:r}})},e.invalidHostNameError=function(r){return k({message:"invalid host name error",code:e.FaceErrorCode.UNAUTHORIZED,origin:r})},e.invalidSignatureError=function(r){return k({message:"Invalid Signature message.",code:e.FaceErrorCode.INVALID_SIGNATURE_MESSAGE,origin:r})},e.invalidWallet=function(){return k({message:"invalid wallet error",code:e.FaceErrorCode.INVALID_WALLET})},e.isEthlikeBlockchain=function(e){return-1!==n.indexOf(e)},e.isSupportedNetwork=r=>{switch(r){case e.Network.ETHEREUM:case e.Network.GOERLI:case e.Network.POLYGON:case e.Network.MUMBAI:case e.Network.BNB_SMART_CHAIN:case e.Network.BNB_SMART_CHAIN_TESTNET:case e.Network.KLAYTN:case e.Network.BAOBAB:case e.Network.SOLANA:case e.Network.SOLANA_DEVNET:case e.Network.NEAR:case e.Network.NEAR_TESTNET:case e.Network.BORA:case e.Network.BORA_TESTNET:case e.Network.APTOS:case e.Network.APTOS_TESTNET:case e.Network.MEVERSE:case e.Network.MEVERSE_TESTNET:case e.Network.PSM_TESTNET:case e.Network.PSM_TESTNET_DEV:case e.Network.PSM_TESTNET_TEST:case e.Network.HOME_VERSE:case e.Network.HOME_VERSE_TESTNET:case e.Network.YOOLDO_VERSE:case e.Network.YOOLDO_VERSE_TESTNET:case e.Network.OASYS:case e.Network.OASYS_TESTNET:return!0;default:return!1}},e.kitProvidersAndWalletsConfigError=function(){return k({message:"Both wallets and providers cannot be empty.",code:e.FaceErrorCode.PROVIDERS_AND_WALLETS_CONFIG_ERROR})},e.makeError=k,e.networkToBlockchain=function(r){switch(r){case e.Network.ETHEREUM:case e.Network.ROPSTEN:case e.Network.GOERLI:return e.Blockchain.ETHEREUM;case e.Network.POLYGON:case e.Network.MUMBAI:return e.Blockchain.POLYGON;case e.Network.BNB_SMART_CHAIN:case e.Network.BNB_SMART_CHAIN_TESTNET:return e.Blockchain.BNB_SMART_CHAIN;case e.Network.KLAYTN:case e.Network.BAOBAB:return e.Blockchain.KLAYTN;case e.Network.SOLANA:case e.Network.SOLANA_DEVNET:return e.Blockchain.SOLANA;case e.Network.BORA:case e.Network.BORA_TESTNET:return e.Blockchain.BORA;case e.Network.NEAR:case e.Network.NEAR_TESTNET:return e.Blockchain.NEAR;case e.Network.APTOS:case e.Network.APTOS_TESTNET:return e.Blockchain.APTOS;case e.Network.MEVERSE:case e.Network.MEVERSE_TESTNET:return e.Blockchain.MEVERSE;case e.Network.PSM:case e.Network.PSM_TESTNET:return e.Blockchain.PSM;case e.Network.PSM_TESTNET_TEST:return e.Blockchain.PSM_TEST;case e.Network.PSM_TESTNET_DEV:return e.Blockchain.PSM_DEV;case e.Network.HOME_VERSE:case e.Network.HOME_VERSE_TESTNET:return e.Blockchain.HOME_VERSE;case e.Network.YOOLDO_VERSE:case e.Network.YOOLDO_VERSE_TESTNET:return e.Blockchain.YOOLDO_VERSE;case e.Network.OASYS:case e.Network.OASYS_TESTNET:return e.Blockchain.OASYS}throw new Error(`Unsupported network: ${r}`)},e.noUserDataError=function(){return k({message:"no user data",code:e.FaceErrorCode.NO_USER_DATA})},e.notImplementedError=function(r){return k({message:r,code:e.FaceErrorCode.NOT_IMPLEMENTED})},e.oauthError=function(r,t){return k({message:`OAuth 2.0 Error: ${r}`,code:e.FaceErrorCode.AUTHENTICATION,origin:t})},e.parseFaceSolanaNearTransactionPayload=function(e){return null==e||"object"!=typeof e||null==e.serializedHex||"string"!=typeof e.serializedHex?null:e},e.sendTransactionError=function(r){return k({message:r.message,code:e.FaceErrorCode.SEND_TRANSACTION_FAILED,data:r.data})},e.signError=function(r){return k({message:r,code:e.FaceErrorCode.SIGN_FAILED})},e.unknownError=function(r){return k({message:"unknown error",code:e.FaceErrorCode.INTERNAL,origin:r})},e.unsupportedChainError=function(r){return k({message:"unsupported chain error",code:e.FaceErrorCode.UNSUPPORTED_CHAIN,origin:r})},e.unsupportedProviderError=function(r){return k({message:`${r} login is not supported.`,code:e.FaceErrorCode.UNSUPPORTED_SOCIAL_PROVIDER})},e.unsupportedTokenProviderError=function(r){return k({message:`${r} is not support get id token`,code:e.FaceErrorCode.UNSUPPORTED_SOCIAL_PROVIDER})},e.userRejectedRequest=function(r){return k({code:e.FaceErrorCode.USER_REJECTED_REQUEST,message:"user rejected request",data:{path:r}})},Object.defineProperty(e,"__esModule",{value:!0})})); | ||
//# sourceMappingURL=index.js.map |
@@ -45,3 +45,5 @@ export declare enum Network { | ||
YOOLDO_VERSE = "yooldo_verse", | ||
YOOLDO_VERSE_TESTNET = "yooldo_verse_testnet" | ||
YOOLDO_VERSE_TESTNET = "yooldo_verse_testnet", | ||
OASYS = "oasys", | ||
OASYS_TESTNET = "oasys_testnet" | ||
} | ||
@@ -66,3 +68,4 @@ export declare const isSupportedNetwork: (network?: Network) => boolean; | ||
HOME_VERSE = "HOME_VERSE", | ||
YOOLDO_VERSE = "YOOLDO_VERSE" | ||
YOOLDO_VERSE = "YOOLDO_VERSE", | ||
OASYS = "OASYS" | ||
} | ||
@@ -69,0 +72,0 @@ export declare function networkToBlockchain(network: Network): Blockchain; |
{ | ||
"name": "@haechi-labs/face-types", | ||
"version": "1.10.9", | ||
"version": "1.10.10", | ||
"description": "", | ||
@@ -46,3 +46,3 @@ "author": "", | ||
}, | ||
"gitHead": "b6b2a7434a4424ed8739a4cf1a7dc21a0b579a62", | ||
"gitHead": "4d7ed997fcee1d05ef67cf343bb1b6936d565181", | ||
"publishConfig": { | ||
@@ -49,0 +49,0 @@ "access": "public" |
@@ -46,2 +46,4 @@ export enum Network { | ||
YOOLDO_VERSE_TESTNET = 'yooldo_verse_testnet', | ||
OASYS = 'oasys', | ||
OASYS_TESTNET = 'oasys_testnet', | ||
} | ||
@@ -76,2 +78,4 @@ | ||
case Network.YOOLDO_VERSE_TESTNET: | ||
case Network.OASYS: | ||
case Network.OASYS_TESTNET: | ||
return true; | ||
@@ -111,2 +115,4 @@ default: | ||
[Network.YOOLDO_VERSE_TESTNET]: 20197, | ||
[Network.OASYS]: 248, | ||
[Network.OASYS_TESTNET]: 9372, | ||
@@ -134,2 +140,4 @@ 1: Network.ETHEREUM, | ||
20197: Network.YOOLDO_VERSE_TESTNET, | ||
248: Network.OASYS, | ||
9372: Network.OASYS_TESTNET, | ||
}; | ||
@@ -152,2 +160,3 @@ | ||
YOOLDO_VERSE = 'YOOLDO_VERSE', | ||
OASYS = 'OASYS', | ||
} | ||
@@ -167,2 +176,3 @@ | ||
Blockchain.YOOLDO_VERSE, | ||
Blockchain.OASYS, | ||
]; | ||
@@ -213,2 +223,5 @@ | ||
return Blockchain.YOOLDO_VERSE; | ||
case Network.OASYS: | ||
case Network.OASYS_TESTNET: | ||
return Blockchain.OASYS; | ||
} | ||
@@ -245,2 +258,3 @@ | ||
case Blockchain.YOOLDO_VERSE: | ||
case Blockchain.OASYS: | ||
return 18; | ||
@@ -247,0 +261,0 @@ case Blockchain.SOLANA: |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
207912
3229