8 lines
4.0 KiB
JavaScript
8 lines
4.0 KiB
JavaScript
import{A as V}from"./chunk-DHD6EQRZ.js";import{h as J}from"./chunk-6MU5CW3D.js";import{x as U}from"./chunk-X6ZP5JNU.js";import{d as Y}from"./chunk-SN5KMB4Y.js";import{a as j}from"./chunk-EH7ZH6JN.js";import{a as v}from"./chunk-AZADQVKT.js";import{b as B}from"./chunk-TYKWHAGM.js";import{b as z,c as H}from"./chunk-X3ZHB7JM.js";import{h as K}from"./chunk-JJLCPFOT.js";import{o as se}from"./chunk-64WUUNDB.js";import{Z as R}from"./chunk-QY24TFF7.js";import{c as p,e as re}from"./chunk-Z36WOTFJ.js";import{b as W}from"./chunk-5PYIEIB7.js";import{c as L,d as O,e as _}from"./chunk-3XZTE2DB.js";import{n as G}from"./chunk-TUSK34X6.js";import{D as A,I as Z,Id as k,Pd as ee,ma as I,oe as te,ra as $}from"./chunk-I5E2ION7.js";import{Z as D,ra as X}from"./chunk-GSIHKWLV.js";import{f as Q,o as S,q as h}from"./chunk-QTLWQ5AJ.js";S();h();$();te();ee();var u=e=>j(e)?e:I(W(e)),oe=({value:e,toAddr:t,contractAddress:r})=>!r||!J(t)?"":v(t,e),ae="0x0",C=({data:e,value:t,nonce:r,walletId:s,gasPrice:n,gasLimit:i,localType:o,to:x,maxFeePerGas:g,from:m,supportEip1559:d,authorizationList:F,signFn:y,kaiaTxType:E,maxPriorityFeePerGas:M,chainId:N,contractAddress:P,systemToken:w})=>{let b=m&&L(m,o),c=x&&L(x,o),l=N||k(o)?.realChainIdHex,T=e||oe({value:t,toAddr:c,contractAddress:P}),q=F&&F.length>0,a={from:b,walletId:s,data:T,nonce:u(r),chainId:u(l),gasLimit:u(i)};return y&&E&&(a.signFn=y,a.kaiaTxType=E),d?Object.assign(a,{type:G.FEE_MARKET,maxFeePerGas:u(g),maxPriorityFeePerGas:u(M)}):Object.assign(a,{type:G.LEGACY,gasPrice:u(n)}),q&&Object.assign(a,{type:G.AUTH_7702,authorizationList:F}),P?Object.assign(a,{data:T,value:ae,to:L(P,o)}):Object.assign(a,{to:c,value:u(t)}),w&&Object.assign(a,{value:u(t)}),a};var ie=["low","medium","high"],me=(e={})=>ie.map(t=>t==="low"?{level:t,gasPrice:e?.min,maxFeePerGas:e?.min,baseFeePerGas:e?.baseFee,maxPriorityFeePerGas:e?.safePriorityFee}:t==="medium"?{level:t,gasPrice:e?.normal,maxFeePerGas:e?.normal,baseFeePerGas:e?.baseFee,maxPriorityFeePerGas:e?.proposePriorityFee}:{level:t,gasPrice:e?.max,maxFeePerGas:e?.max,baseFeePerGas:e?.baseFee,maxPriorityFeePerGas:e?.fastPriorityFee});S();h();var f=Q(se());X();re();Z();var ke=()=>(0,f.useMemoizedFn)(async e=>{let{coinId:t}=e,r=C(e),n=await U(D(r,["to","data","from","value","gasLimit","gasPrice","maxFeePerGas","maxPriorityFeePerGas"]));return await R({coinId:t},{inputData:n})}),ce=()=>(0,f.useMemoizedFn)(async e=>{let{authorizationList:t}=e,r=(t||[]).map(s=>{let{address:n,chainId:i,nonce:o,fromAddress:x,walletId:g,localType:m,yParity:d,r:F,s:y}=s||{};return d&&F&&y?s:p().signAuthorizationListItem({fromAddress:O(x,m),walletId:g,baseChain:_(m),signParams:{address:n,chainId:i,nonce:o}})});return{...e,authorizationList:await Promise.all(r)}}),Re=({coinId:e,fromAddr:t,walletId:r})=>{let s=Y(e),n=s?.localType,i=s?.systemToken,o=V({fromAddr:O(t,n),walletId:r,localType:_(n)}),x=ce();return(0,f.useMemoizedFn)(async({data:g,from:m,to:d,value:F,gasPrice:y,maxFeePerGas:E,maxPriorityFeePerGas:M,authorizationList:N,needCapture:P,withSignParams:w=!1,...b})=>{let c=C({to:d,data:g,from:m,value:F,gasPrice:y,coinId:e,walletId:r,localType:n,systemToken:i,maxFeePerGas:E,maxPriorityFeePerGas:M,authorizationList:N,contractAddress:s?.address,...b});c.authorizationList&&(c=await x(c));let l=await o({needCapture:P,params:c}),T=l.rawTxResult||l;return w?{signedTx:T,signParams:c}:T})},We=({walletId:e})=>{let t=K(e),r={[A.ETH_SIGN]:[H,p().signMessage],[A.PERSONAL_SIGN]:[H,p().signPersonalMessage],[A.ETH_SIGN_TYPED_DATA]:[z,p().signTypedMessage]};return(0,f.useMemoizedFn)(async({msgParams:s,baseChain:n,type:i})=>{let o=r[i];if(o)return B(t?.initialType)?o[0]({walletId:e,msgParams:s,baseChain:n}):o[1](s,n,e);throw new Error("Not Supported")})},je=()=>(0,f.useMemoizedFn)(async e=>p().encryptionPublicKey(e)),ve=()=>(0,f.useMemoizedFn)(async e=>p().decryptMessageInline(e)),ze=()=>(0,f.useMemoizedFn)(async e=>p().decryptMessage(e));export{u as a,C as b,me as c,ke as d,Re as e,We as f,je as g,ve as h,ze as i};
|
|
|
|
window.inOKXExtension = true;
|
|
window.inMiniApp = false;
|
|
window.ASSETS_BUILD_TYPE = "publish";
|
|
|
|
//# sourceMappingURL=chunk-7W4WKZVL.js.map
|