@stakekit/widget 0.0.287 → 0.0.288

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (89) hide show
  1. package/dist/bundle/Result-D66k67e4.js +3 -0
  2. package/dist/bundle/Schema-CnO1Nnkx.js +2 -0
  3. package/dist/bundle/{cardano-connector-Cg1NVNSz.js → cardano-connector-BdmhtPwK.js} +1 -1
  4. package/dist/{website/assets/configured-chains-C5lih9lm.js → bundle/configured-chains-BVaAJPl7.js} +1 -1
  5. package/dist/bundle/{cosmos-connector-meta-B3hXlZyj.js → cosmos-connector-meta-CsjY5xv_.js} +1 -1
  6. package/dist/bundle/{current-value-stream-sEIwrVMJ.js → current-value-stream-BphKxe9G.js} +1 -1
  7. package/dist/bundle/{esm-B8ixy8Ti.js → esm-BioWy-zm.js} +1 -1
  8. package/dist/bundle/index.bundle.css +1 -1
  9. package/dist/bundle/index.bundle.js +132 -100
  10. package/dist/bundle/{ledger-connector-ScKbHFK2.js → ledger-connector-BeFXqMQm.js} +2 -2
  11. package/dist/bundle/{network-DRjEa3NO.js → network-BR2dx0lQ.js} +1 -1
  12. package/dist/bundle/{polkadot-ledger-transaction-CSI9csNM.js → polkadot-ledger-transaction-CCpzhicj.js} +1 -1
  13. package/dist/bundle/{safe-connector-BuI_vM2N.js → safe-connector-BW8tBAGV.js} +1 -1
  14. package/dist/bundle/{solana-connector-BXIkWGi1.js → solana-connector-CEoNnJWx.js} +1 -1
  15. package/dist/bundle/{stellar-connector-D5G2p6aO.js → stellar-connector-C3GFN35d.js} +1 -1
  16. package/dist/bundle/{substrate-connector-AJ6EWjQP.js → substrate-connector-B7COXHL7.js} +1 -1
  17. package/dist/{website/assets/ton-connector-DWz2WVCw.js → bundle/ton-connector-DnPSYtXm.js} +1 -1
  18. package/dist/bundle/transaction-3CLRKFvX.js +1 -0
  19. package/dist/{website/assets/transaction-BJ3RmuAw.js → bundle/transaction-BDuN1rLk.js} +2 -2
  20. package/dist/bundle/{transaction-NX-vBbnh.js → transaction-DU8AaOQz.js} +1 -1
  21. package/dist/bundle/{tron-connector-nZfhLwx4.js → tron-connector-iA7bb0__.js} +1 -1
  22. package/dist/bundle/{utils-CfBIlQsz.js → utils-llPzGe7v.js} +1 -1
  23. package/dist/bundle/wagmi-connect-result-DOu6hDDM.js +11 -0
  24. package/dist/bundle/{wallet-errors-Bvwwydi9.js → wallet-errors-MrbcJr3I.js} +1 -1
  25. package/dist/bundle/{wallet-manager-C-MB05Qs.js → wallet-manager-D2AeCPRs.js} +2 -2
  26. package/dist/package/{Result-Cem4lYBf.js → Result-BA6lrqKV.js} +117 -49
  27. package/dist/package/{Schema-DFoi51wt.js → Schema-CUut1r-H.js} +1135 -1310
  28. package/dist/package/{cardano-connector-B9UToMFP.js → cardano-connector-ApyBIRYL.js} +3 -3
  29. package/dist/package/{configured-chains-BfQ8ESmR.js → configured-chains-CeRB7Tdy.js} +1 -1
  30. package/dist/package/{cosmos-connector-meta-UMFrkViG.js → cosmos-connector-meta-NNACISY5.js} +1 -1
  31. package/dist/package/{current-value-stream-BPaLLDf4.js → current-value-stream-Cs2IFPhP.js} +1 -1
  32. package/dist/package/{esm-89IrCtWy.js → esm-3BtHXmV9.js} +1 -1
  33. package/dist/package/index.package.css +21 -0
  34. package/dist/package/index.package.js +8452 -3822
  35. package/dist/package/{ledger-connector-B8D8xJOD.js → ledger-connector-ebEnv7IA.js} +9 -9
  36. package/dist/package/{network-DiYap-9L.js → network-Df21Fcdz.js} +1 -1
  37. package/dist/package/{polkadot-ledger-transaction-Bi14PyTF.js → polkadot-ledger-transaction-Cq_ImU8s.js} +1 -1
  38. package/dist/package/{safe-connector-lVCS_bS5.js → safe-connector-CMgopygU.js} +4 -4
  39. package/dist/package/{solana-connector-P-TqgNNC.js → solana-connector-B2Rf5Tyj.js} +3 -3
  40. package/dist/package/{stellar-connector-BMB2Cql4.js → stellar-connector-DdzqZgoG.js} +4 -4
  41. package/dist/package/{substrate-connector-a7SNpKjf.js → substrate-connector-DO7OAvZ9.js} +2 -2
  42. package/dist/package/{ton-connector-CMzOI2bi.js → ton-connector-CUtYVysK.js} +5 -5
  43. package/dist/package/{transaction-CmOScFm6.js → transaction-BjGgdyu0.js} +5 -5
  44. package/dist/package/{transaction-Do9wZHM8.js → transaction-MMiSjtGI.js} +1 -1
  45. package/dist/package/{transaction-C1e6h8J1.js → transaction-fIZimEky.js} +1 -1
  46. package/dist/package/{tron-connector-PLpMhB65.js → tron-connector-DT1NdAaP.js} +2 -2
  47. package/dist/package/{wagmi-connect-result-BJ91_jis.js → wagmi-connect-result-Bh6qH5iI.js} +593 -462
  48. package/dist/package/{wallet-errors-B4cGcGNy.js → wallet-errors-BMdJQ_kv.js} +1 -1
  49. package/dist/package/{wallet-manager-BsDss9DQ.js → wallet-manager-BbL7EBi6.js} +5 -5
  50. package/dist/types/domain/network/network.d.ts +2 -2
  51. package/dist/types/generated/api/legacy-schema.d.ts +3503 -1952
  52. package/dist/types/generated/api/yield-schema.d.ts +1492 -1113
  53. package/dist/types/public-api/types.d.ts +2 -2
  54. package/dist/website/assets/Result-D66k67e4.js +3 -0
  55. package/dist/website/assets/Schema-CnO1Nnkx.js +2 -0
  56. package/dist/website/assets/{cardano-connector-JluaLQJr.js → cardano-connector-DkgQsbib.js} +1 -1
  57. package/dist/{bundle/configured-chains-C5lih9lm.js → website/assets/configured-chains-BVaAJPl7.js} +1 -1
  58. package/dist/website/assets/{cosmos-connector-meta-B3hXlZyj.js → cosmos-connector-meta-CsjY5xv_.js} +1 -1
  59. package/dist/website/assets/{current-value-stream-sEIwrVMJ.js → current-value-stream-BphKxe9G.js} +1 -1
  60. package/dist/website/assets/{esm-DmRWC3up.js → esm-DJUTv1_r.js} +1 -1
  61. package/dist/website/assets/{index-CYwddl65.css → index-B_e-5cjt.css} +1 -1
  62. package/dist/website/assets/index-Ifmhd5nI.js +592 -0
  63. package/dist/website/assets/{ledger-connector-zHWvy_21.js → ledger-connector-CMFH1Z0M.js} +3 -3
  64. package/dist/website/assets/{network-DRjEa3NO.js → network-BR2dx0lQ.js} +1 -1
  65. package/dist/website/assets/{polkadot-ledger-transaction-CSI9csNM.js → polkadot-ledger-transaction-CCpzhicj.js} +1 -1
  66. package/dist/website/assets/{safe-connector-B_IWbdsx.js → safe-connector-BDc3OqKV.js} +1 -1
  67. package/dist/website/assets/{solana-connector-DUrUEFXI.js → solana-connector-Ij-Dm1HM.js} +1 -1
  68. package/dist/website/assets/{stellar-connector-D5G2p6aO.js → stellar-connector-C3GFN35d.js} +1 -1
  69. package/dist/website/assets/{substrate-connector-DxgYUQY4.js → substrate-connector-B-LTNtpz.js} +1 -1
  70. package/dist/{bundle/ton-connector-DWz2WVCw.js → website/assets/ton-connector-DnPSYtXm.js} +1 -1
  71. package/dist/{bundle/transaction-BJ3RmuAw.js → website/assets/transaction-BDuN1rLk.js} +2 -2
  72. package/dist/website/assets/{transaction-BIBBEBi6.js → transaction-Cth5mVGJ.js} +1 -1
  73. package/dist/website/assets/transaction-peV0IJTV.js +1 -0
  74. package/dist/website/assets/{tron-connector-C3nKPxdx.js → tron-connector-D_NeRPfc.js} +1 -1
  75. package/dist/website/assets/{utils-DVCp0qSW.js → utils-DOZR2zEE.js} +1 -1
  76. package/dist/website/assets/wagmi-connect-result-DOu6hDDM.js +11 -0
  77. package/dist/website/assets/{wallet-errors-Bvwwydi9.js → wallet-errors-MrbcJr3I.js} +1 -1
  78. package/dist/website/assets/{wallet-manager-9-XcN6SR.js → wallet-manager-DGQAWJIz.js} +3 -3
  79. package/dist/website/index.html +13 -13
  80. package/package.json +12 -11
  81. package/dist/bundle/Result-3MQjLy1V.js +0 -3
  82. package/dist/bundle/Schema-DgreXIef.js +0 -2
  83. package/dist/bundle/transaction-BnkP6nIP.js +0 -1
  84. package/dist/bundle/wagmi-connect-result-CqXaJhOa.js +0 -11
  85. package/dist/website/assets/Result-3MQjLy1V.js +0 -3
  86. package/dist/website/assets/Schema-DgreXIef.js +0 -2
  87. package/dist/website/assets/index-CbH5OQ2T.js +0 -560
  88. package/dist/website/assets/transaction-Sqg4_vo7.js +0 -1
  89. package/dist/website/assets/wagmi-connect-result-CqXaJhOa.js +0 -11
@@ -1 +1 @@
1
- import{i as e,r as t}from"./network-DRjEa3NO.js";var n=e=>`https://assets.stakek.it/networks/${e}.svg`,r=e=>`https://assets.stakek.it/tokens/${e}.svg`,i={id:e(`near`),name:`NEAR Protocol`,iconUrl:r(`near`),nativeCurrency:{decimals:24,name:`Near`,symbol:`NEAR`},rpcUrls:{public:{http:[`https://rpc.mainnet.near.org`]},default:{http:[`https://rpc.mainnet.near.org`]}}},a={id:e(`tezos`),name:`Tezos`,iconUrl:r(`xtz`),nativeCurrency:{decimals:6,name:`Tezos`,symbol:`XTZ`},rpcUrls:{public:{http:[`https://rpc.tzbeta.net/`]},default:{http:[`https://rpc.tzbeta.net/`]}}},o={id:e(`solana`),name:`Solana`,iconUrl:r(`sol`),nativeCurrency:{decimals:9,name:`Solana`,symbol:`SOL`},rpcUrls:{public:{http:[`https://api.mainnet-beta.solana.com/`]},default:{http:[`https://api.mainnet-beta.solana.com/`]}}},s={id:e(`tron`),name:`Tron`,iconUrl:r(`trx`),nativeCurrency:{decimals:6,name:`Tron`,symbol:`TRX`},rpcUrls:{public:{http:[`https://api.trongrid.io`]},default:{http:[`https://api.trongrid.io`]}}},c={id:e(`ton`),name:`Ton`,iconUrl:r(`ton`),nativeCurrency:{decimals:9,name:`Toncoin`,symbol:`TON`},rpcUrls:{public:{http:[`https://ton.nownodes.io`]},default:{http:[`https://ton.nownodes.io`]}}},l={id:e(`cardano`),name:`Cardano`,iconUrl:r(`ada`),nativeCurrency:{decimals:6,name:`Cardano`,symbol:`ADA`},rpcUrls:{public:{http:[]},default:{http:[]}}},u={id:e(`stellar`),name:`Stellar`,iconUrl:r(`xlm`),nativeCurrency:{decimals:7,name:`Stellar Lumens`,symbol:`XLM`},rpcUrls:{public:{http:[`https://horizon.stellar.org`]},default:{http:[`https://horizon.stellar.org`]}}},d={near:{network:`near`,protocolFamily:t(`near`),wagmiChain:i},tezos:{network:`tezos`,protocolFamily:t(`tezos`),wagmiChain:a},solana:{network:`solana`,protocolFamily:t(`solana`),wagmiChain:o},tron:{network:`tron`,protocolFamily:t(`tron`),wagmiChain:s},ton:{network:`ton`,protocolFamily:t(`ton`),wagmiChain:c},cardano:{network:`cardano`,protocolFamily:t(`cardano`),wagmiChain:l},stellar:{network:`stellar`,protocolFamily:t(`stellar`),wagmiChain:u}};export{c as a,u as i,d as n,s as o,o as r,n as s,l as t};
1
+ import{i as e,r as t}from"./network-BR2dx0lQ.js";var n=e=>`https://assets.stakek.it/networks/${e}.svg`,r=e=>`https://assets.stakek.it/tokens/${e}.svg`,i={id:e(`near`),name:`NEAR Protocol`,iconUrl:r(`near`),nativeCurrency:{decimals:24,name:`Near`,symbol:`NEAR`},rpcUrls:{public:{http:[`https://rpc.mainnet.near.org`]},default:{http:[`https://rpc.mainnet.near.org`]}}},a={id:e(`tezos`),name:`Tezos`,iconUrl:r(`xtz`),nativeCurrency:{decimals:6,name:`Tezos`,symbol:`XTZ`},rpcUrls:{public:{http:[`https://rpc.tzbeta.net/`]},default:{http:[`https://rpc.tzbeta.net/`]}}},o={id:e(`solana`),name:`Solana`,iconUrl:r(`sol`),nativeCurrency:{decimals:9,name:`Solana`,symbol:`SOL`},rpcUrls:{public:{http:[`https://api.mainnet-beta.solana.com/`]},default:{http:[`https://api.mainnet-beta.solana.com/`]}}},s={id:e(`tron`),name:`Tron`,iconUrl:r(`trx`),nativeCurrency:{decimals:6,name:`Tron`,symbol:`TRX`},rpcUrls:{public:{http:[`https://api.trongrid.io`]},default:{http:[`https://api.trongrid.io`]}}},c={id:e(`ton`),name:`Ton`,iconUrl:r(`ton`),nativeCurrency:{decimals:9,name:`Toncoin`,symbol:`TON`},rpcUrls:{public:{http:[`https://ton.nownodes.io`]},default:{http:[`https://ton.nownodes.io`]}}},l={id:e(`cardano`),name:`Cardano`,iconUrl:r(`ada`),nativeCurrency:{decimals:6,name:`Cardano`,symbol:`ADA`},rpcUrls:{public:{http:[]},default:{http:[]}}},u={id:e(`stellar`),name:`Stellar`,iconUrl:r(`xlm`),nativeCurrency:{decimals:7,name:`Stellar Lumens`,symbol:`XLM`},rpcUrls:{public:{http:[`https://horizon.stellar.org`]},default:{http:[`https://horizon.stellar.org`]}}},d={near:{network:`near`,protocolFamily:t(`near`),wagmiChain:i},tezos:{network:`tezos`,protocolFamily:t(`tezos`),wagmiChain:a},solana:{network:`solana`,protocolFamily:t(`solana`),wagmiChain:o},tron:{network:`tron`,protocolFamily:t(`tron`),wagmiChain:s},ton:{network:`ton`,protocolFamily:t(`ton`),wagmiChain:c},cardano:{network:`cardano`,protocolFamily:t(`cardano`),wagmiChain:l},stellar:{network:`stellar`,protocolFamily:t(`stellar`),wagmiChain:u}};export{c as a,u as i,d as n,s as o,o as r,n as s,l as t};
@@ -1 +1 @@
1
- import{N as e,g as t}from"./Schema-DgreXIef.js";var n=t.pipe(e(`YieldId`)),r=t.pipe(e(`ProviderId`)),i=t.pipe(e(`ActionId`)),a=t.pipe(e(`TransactionId`)),o=t.pipe(e(`WalletAddress`)),s=t.pipe(e(`TokenAddress`)),c=t.pipe(e(`ValidatorAddress`)),l={type:`cosmosProvider`},u=e=>e.type===l.type;export{s as a,o as c,r as i,n as l,u as n,a as o,i as r,c as s,l as t};
1
+ import{N as e,g as t}from"./Schema-CnO1Nnkx.js";var n=t.pipe(e(`YieldId`)),r=t.pipe(e(`ProviderId`)),i=t.pipe(e(`ActionId`)),a=t.pipe(e(`TransactionId`)),o=t.pipe(e(`WalletAddress`)),s=t.pipe(e(`TokenAddress`)),c=t.pipe(e(`ValidatorAddress`)),l={type:`cosmosProvider`},u=e=>e.type===l.type;export{s as a,o as c,r as i,n as l,u as n,a as o,i as r,c as s,l as t};
@@ -1 +1 @@
1
- import{J as e,Mn as t,lt as n,r}from"./wagmi-connect-result-CqXaJhOa.js";var i=16,a=a=>{let o=a,s=new Set;return{changes:r(r=>n(t(()=>{let t=t=>{e(r,t)};return s.add(t),t(o),t}),e=>t(()=>{s.delete(e)})),{bufferSize:i,strategy:`sliding`}),get:()=>o,set:e=>{o=e;for(let t of s)t(e)},subscriberCount:()=>s.size}};export{a as t};
1
+ import{J as e,Mn as t,lt as n,r}from"./wagmi-connect-result-DOu6hDDM.js";var i=16,a=a=>{let o=a,s=new Set;return{changes:r(r=>n(t(()=>{let t=t=>{e(r,t)};return s.add(t),t(o),t}),e=>t(()=>{s.delete(e)})),{bufferSize:i,strategy:`sliding`}),get:()=>o,set:e=>{o=e;for(let t of s)t(e)},subscriberCount:()=>s.size}};export{a as t};
@@ -1 +1 @@
1
- import{d as e,h as t}from"./_esm-DNvytb5d.js";import{u as n}from"./ccip-B_AhQiTz.js";import"./safe-connector-B_IWbdsx.js";var r=()=>`9.1.0`,i=e=>e.toString(16).padStart(2,`0`),a=e=>{let t=new Uint8Array((e||40)/2);return window.crypto.getRandomValues(t),Array.from(t,i).join(``)},o=()=>typeof window<`u`?a(10):new Date().getTime().toString(36),s=class{};s.makeRequest=(e,t)=>({id:o(),method:e,params:t,env:{sdkVersion:r()}}),s.makeResponse=(e,t,n)=>({id:e,success:!0,version:n,data:t}),s.makeErrorResponse=(e,t,n)=>({id:e,success:!1,error:t,version:n});var c;(function(e){e.sendTransactions=`sendTransactions`,e.rpcCall=`rpcCall`,e.getChainInfo=`getChainInfo`,e.getSafeInfo=`getSafeInfo`,e.getTxBySafeTxHash=`getTxBySafeTxHash`,e.getSafeBalances=`getSafeBalances`,e.signMessage=`signMessage`,e.signTypedMessage=`signTypedMessage`,e.getEnvironmentInfo=`getEnvironmentInfo`,e.getOffChainSignature=`getOffChainSignature`,e.requestAddressBook=`requestAddressBook`,e.wallet_getPermissions=`wallet_getPermissions`,e.wallet_requestPermissions=`wallet_requestPermissions`})(c||={});var l;(function(e){e.requestAddressBook=`requestAddressBook`})(l||={});var u=class{constructor(e=null,t=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>`u`,this.isValidMessage=({origin:e,data:t,source:n})=>{let r=!t,i=!this.isServer&&n===window.parent,a=t.version!==void 0&&parseInt(t.version.split(`.`)[0]),o=typeof a==`number`&&a>=1,s=!0;return Array.isArray(this.allowedOrigins)&&(s=this.allowedOrigins.find(t=>t.test(e))!==void 0),!r&&i&&o&&s},this.logIncomingMessage=e=>{},this.onParentMessage=e=>{this.isValidMessage(e)&&(this.debugMode&&this.logIncomingMessage(e),this.handleIncomingMessage(e.data))},this.handleIncomingMessage=e=>{let{id:t}=e,n=this.callbacks.get(t);n&&(n(e),this.callbacks.delete(t))},this.send=(e,t)=>{let n=s.makeRequest(e,t);if(this.isServer)throw Error(`Window doesn't exist`);return window.parent.postMessage(n,`*`),new Promise((e,t)=>{this.callbacks.set(n.id,n=>{if(!n.success){t(Error(n.error));return}e(n)})})},this.allowedOrigins=e,this.debugMode=t,this.isServer||window.addEventListener(`message`,this.onParentMessage)}},d=e=>typeof e==`object`&&!!e&&`domain`in e&&`types`in e&&`message`in e,f=class{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw Error(`Invalid safeTxHash`);return(await this.communicator.send(c.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){let t={message:e};return(await this.communicator.send(c.signMessage,t)).data}async signTypedMessage(e){if(!d(e))throw Error(`Invalid typed data`);return(await this.communicator.send(c.signTypedMessage,{typedData:e})).data}async send({txs:e,params:t}){if(!e||!e.length)throw Error(`No transactions were passed`);let n={txs:e,params:t};return(await this.communicator.send(c.sendTransactions,n)).data}},p={eth_call:`eth_call`,eth_gasPrice:`eth_gasPrice`,eth_getLogs:`eth_getLogs`,eth_getBalance:`eth_getBalance`,eth_getCode:`eth_getCode`,eth_getBlockByHash:`eth_getBlockByHash`,eth_getBlockByNumber:`eth_getBlockByNumber`,eth_getStorageAt:`eth_getStorageAt`,eth_getTransactionByHash:`eth_getTransactionByHash`,eth_getTransactionReceipt:`eth_getTransactionReceipt`,eth_getTransactionCount:`eth_getTransactionCount`,eth_estimateGas:`eth_estimateGas`,safe_setSettings:`safe_setSettings`},m={defaultBlockParam:(e=`latest`)=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e},h=class{constructor(e){this.communicator=e,this.call=this.buildRequest({call:p.eth_call,formatters:[null,m.defaultBlockParam]}),this.getBalance=this.buildRequest({call:p.eth_getBalance,formatters:[null,m.defaultBlockParam]}),this.getCode=this.buildRequest({call:p.eth_getCode,formatters:[null,m.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:p.eth_getStorageAt,formatters:[null,m.blockNumberToHex,m.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:p.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:p.eth_getBlockByHash,formatters:[null,m.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:p.eth_getBlockByNumber,formatters:[m.blockNumberToHex,m.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:p.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:p.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:p.eth_getTransactionCount,formatters:[null,m.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:p.eth_gasPrice}),this.getEstimateGas=e=>this.buildRequest({call:p.eth_estimateGas})([e]),this.setSafeSettings=this.buildRequest({call:p.safe_setSettings})}buildRequest(e){let{call:t,formatters:n}=e;return async e=>{n&&Array.isArray(e)&&n.forEach((t,n)=>{t&&(e[n]=t(e[n]))});let r={call:t,params:e||[]};return(await this.communicator.send(c.rpcCall,r)).data}}},g=`0x1626ba7e`,_=`0x20c13b0b`,v=4001,y=class e extends Error{constructor(t,n,r){super(t),this.code=n,this.data=r,Object.setPrototypeOf(this,e.prototype)}},b=class{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(c.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new y(`Permissions request is invalid`,v);try{return(await this.communicator.send(c.wallet_requestPermissions,e)).data}catch{throw new y(`Permissions rejected`,v)}}isPermissionRequestValid(e){return e.every(e=>typeof e==`object`&&Object.keys(e).every(e=>!!Object.values(l).includes(e)))}},x=(e,t)=>t.some(t=>t.parentCapability===e),S=()=>(e,t,n)=>{let r=n.value;return n.value=async function(){let e=new b(this.communicator),n=await e.getPermissions();if(x(t,n)||(n=await e.requestPermissions([{[t]:{}}])),!x(t,n))throw new y(`Permissions rejected`,v);return r.apply(this)},n},C=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},w=class{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(c.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(c.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e=`usd`}={}){return(await this.communicator.send(c.getSafeBalances,{currency:e})).data}async check1271Signature(e,t=`0x`){let r=await this.getInfo(),i=n({abi:[{constant:!1,inputs:[{name:`_dataHash`,type:`bytes32`},{name:`_signature`,type:`bytes`}],name:`isValidSignature`,outputs:[{name:``,type:`bytes4`}],payable:!1,stateMutability:`nonpayable`,type:`function`}],functionName:`isValidSignature`,args:[e,t]}),a={call:p.eth_call,params:[{to:r.safeAddress,data:i},`latest`]};try{return(await this.communicator.send(c.rpcCall,a)).data.slice(0,10).toLowerCase()===g}catch{return!1}}async check1271SignatureBytes(e,t=`0x`){let r=await this.getInfo(),i=n({abi:[{constant:!1,inputs:[{name:`_data`,type:`bytes`},{name:`_signature`,type:`bytes`}],name:`isValidSignature`,outputs:[{name:``,type:`bytes4`}],payable:!1,stateMutability:`nonpayable`,type:`function`}],functionName:`isValidSignature`,args:[e,t]}),a={call:p.eth_call,params:[{to:r.safeAddress,data:i},`latest`]};try{return(await this.communicator.send(c.rpcCall,a)).data.slice(0,10).toLowerCase()===_}catch{return!1}}calculateMessageHash(e){return t(e)}calculateTypedMessageHash(t){let n=typeof t.domain.chainId==`object`?t.domain.chainId.toNumber():Number(t.domain.chainId),r=t.primaryType;if(!r){let e=Object.values(t.types),n=Object.keys(t.types).filter(t=>e.every(e=>e.every(({type:e})=>e.replace(`[`,``).replace(`]`,``)!==t)));if(n.length===0||n.length>1)throw Error(`Please specify primaryType`);r=n[0]}return e({message:t.message,domain:{...t.domain,chainId:n,verifyingContract:t.domain.verifyingContract,salt:t.domain.salt},types:t.types,primaryType:r})}async getOffChainSignature(e){return(await this.communicator.send(c.getOffChainSignature,e)).data}async isMessageSigned(e,t=`0x`){let n;if(typeof e==`string`&&(n=async()=>{let n=this.calculateMessageHash(e);return await this.isMessageHashSigned(n,t)}),d(e)&&(n=async()=>{let n=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(n,t)}),n)return await n();throw Error(`Invalid message type`)}async isMessageHashSigned(e,t=`0x`){let n=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(let r of n)if(await r(e,t))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(c.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(c.requestAddressBook,void 0)).data}};C([S()],w.prototype,`requestAddressBook`,null);var T=class{constructor(e={}){let{allowedDomains:t=null,debug:n=!1}=e;this.communicator=new u(t,n),this.eth=new h(this.communicator),this.txs=new f(this.communicator),this.safe=new w(this.communicator),this.wallet=new b(this.communicator)}};export{T as default};
1
+ import{d as e,h as t}from"./_esm-DNvytb5d.js";import{u as n}from"./ccip-B_AhQiTz.js";import"./safe-connector-BDc3OqKV.js";var r=()=>`9.1.0`,i=e=>e.toString(16).padStart(2,`0`),a=e=>{let t=new Uint8Array((e||40)/2);return window.crypto.getRandomValues(t),Array.from(t,i).join(``)},o=()=>typeof window<`u`?a(10):new Date().getTime().toString(36),s=class{};s.makeRequest=(e,t)=>({id:o(),method:e,params:t,env:{sdkVersion:r()}}),s.makeResponse=(e,t,n)=>({id:e,success:!0,version:n,data:t}),s.makeErrorResponse=(e,t,n)=>({id:e,success:!1,error:t,version:n});var c;(function(e){e.sendTransactions=`sendTransactions`,e.rpcCall=`rpcCall`,e.getChainInfo=`getChainInfo`,e.getSafeInfo=`getSafeInfo`,e.getTxBySafeTxHash=`getTxBySafeTxHash`,e.getSafeBalances=`getSafeBalances`,e.signMessage=`signMessage`,e.signTypedMessage=`signTypedMessage`,e.getEnvironmentInfo=`getEnvironmentInfo`,e.getOffChainSignature=`getOffChainSignature`,e.requestAddressBook=`requestAddressBook`,e.wallet_getPermissions=`wallet_getPermissions`,e.wallet_requestPermissions=`wallet_requestPermissions`})(c||={});var l;(function(e){e.requestAddressBook=`requestAddressBook`})(l||={});var u=class{constructor(e=null,t=!1){this.allowedOrigins=null,this.callbacks=new Map,this.debugMode=!1,this.isServer=typeof window>`u`,this.isValidMessage=({origin:e,data:t,source:n})=>{let r=!t,i=!this.isServer&&n===window.parent,a=t.version!==void 0&&parseInt(t.version.split(`.`)[0]),o=typeof a==`number`&&a>=1,s=!0;return Array.isArray(this.allowedOrigins)&&(s=this.allowedOrigins.find(t=>t.test(e))!==void 0),!r&&i&&o&&s},this.logIncomingMessage=e=>{},this.onParentMessage=e=>{this.isValidMessage(e)&&(this.debugMode&&this.logIncomingMessage(e),this.handleIncomingMessage(e.data))},this.handleIncomingMessage=e=>{let{id:t}=e,n=this.callbacks.get(t);n&&(n(e),this.callbacks.delete(t))},this.send=(e,t)=>{let n=s.makeRequest(e,t);if(this.isServer)throw Error(`Window doesn't exist`);return window.parent.postMessage(n,`*`),new Promise((e,t)=>{this.callbacks.set(n.id,n=>{if(!n.success){t(Error(n.error));return}e(n)})})},this.allowedOrigins=e,this.debugMode=t,this.isServer||window.addEventListener(`message`,this.onParentMessage)}},d=e=>typeof e==`object`&&!!e&&`domain`in e&&`types`in e&&`message`in e,f=class{constructor(e){this.communicator=e}async getBySafeTxHash(e){if(!e)throw Error(`Invalid safeTxHash`);return(await this.communicator.send(c.getTxBySafeTxHash,{safeTxHash:e})).data}async signMessage(e){let t={message:e};return(await this.communicator.send(c.signMessage,t)).data}async signTypedMessage(e){if(!d(e))throw Error(`Invalid typed data`);return(await this.communicator.send(c.signTypedMessage,{typedData:e})).data}async send({txs:e,params:t}){if(!e||!e.length)throw Error(`No transactions were passed`);let n={txs:e,params:t};return(await this.communicator.send(c.sendTransactions,n)).data}},p={eth_call:`eth_call`,eth_gasPrice:`eth_gasPrice`,eth_getLogs:`eth_getLogs`,eth_getBalance:`eth_getBalance`,eth_getCode:`eth_getCode`,eth_getBlockByHash:`eth_getBlockByHash`,eth_getBlockByNumber:`eth_getBlockByNumber`,eth_getStorageAt:`eth_getStorageAt`,eth_getTransactionByHash:`eth_getTransactionByHash`,eth_getTransactionReceipt:`eth_getTransactionReceipt`,eth_getTransactionCount:`eth_getTransactionCount`,eth_estimateGas:`eth_estimateGas`,safe_setSettings:`safe_setSettings`},m={defaultBlockParam:(e=`latest`)=>e,returnFullTxObjectParam:(e=!1)=>e,blockNumberToHex:e=>Number.isInteger(e)?`0x${e.toString(16)}`:e},h=class{constructor(e){this.communicator=e,this.call=this.buildRequest({call:p.eth_call,formatters:[null,m.defaultBlockParam]}),this.getBalance=this.buildRequest({call:p.eth_getBalance,formatters:[null,m.defaultBlockParam]}),this.getCode=this.buildRequest({call:p.eth_getCode,formatters:[null,m.defaultBlockParam]}),this.getStorageAt=this.buildRequest({call:p.eth_getStorageAt,formatters:[null,m.blockNumberToHex,m.defaultBlockParam]}),this.getPastLogs=this.buildRequest({call:p.eth_getLogs}),this.getBlockByHash=this.buildRequest({call:p.eth_getBlockByHash,formatters:[null,m.returnFullTxObjectParam]}),this.getBlockByNumber=this.buildRequest({call:p.eth_getBlockByNumber,formatters:[m.blockNumberToHex,m.returnFullTxObjectParam]}),this.getTransactionByHash=this.buildRequest({call:p.eth_getTransactionByHash}),this.getTransactionReceipt=this.buildRequest({call:p.eth_getTransactionReceipt}),this.getTransactionCount=this.buildRequest({call:p.eth_getTransactionCount,formatters:[null,m.defaultBlockParam]}),this.getGasPrice=this.buildRequest({call:p.eth_gasPrice}),this.getEstimateGas=e=>this.buildRequest({call:p.eth_estimateGas})([e]),this.setSafeSettings=this.buildRequest({call:p.safe_setSettings})}buildRequest(e){let{call:t,formatters:n}=e;return async e=>{n&&Array.isArray(e)&&n.forEach((t,n)=>{t&&(e[n]=t(e[n]))});let r={call:t,params:e||[]};return(await this.communicator.send(c.rpcCall,r)).data}}},g=`0x1626ba7e`,_=`0x20c13b0b`,v=4001,y=class e extends Error{constructor(t,n,r){super(t),this.code=n,this.data=r,Object.setPrototypeOf(this,e.prototype)}},b=class{constructor(e){this.communicator=e}async getPermissions(){return(await this.communicator.send(c.wallet_getPermissions,void 0)).data}async requestPermissions(e){if(!this.isPermissionRequestValid(e))throw new y(`Permissions request is invalid`,v);try{return(await this.communicator.send(c.wallet_requestPermissions,e)).data}catch{throw new y(`Permissions rejected`,v)}}isPermissionRequestValid(e){return e.every(e=>typeof e==`object`&&Object.keys(e).every(e=>!!Object.values(l).includes(e)))}},x=(e,t)=>t.some(t=>t.parentCapability===e),S=()=>(e,t,n)=>{let r=n.value;return n.value=async function(){let e=new b(this.communicator),n=await e.getPermissions();if(x(t,n)||(n=await e.requestPermissions([{[t]:{}}])),!x(t,n))throw new y(`Permissions rejected`,v);return r.apply(this)},n},C=function(e,t,n,r){var i=arguments.length,a=i<3?t:r===null?r=Object.getOwnPropertyDescriptor(t,n):r,o;if(typeof Reflect==`object`&&typeof Reflect.decorate==`function`)a=Reflect.decorate(e,t,n,r);else for(var s=e.length-1;s>=0;s--)(o=e[s])&&(a=(i<3?o(a):i>3?o(t,n,a):o(t,n))||a);return i>3&&a&&Object.defineProperty(t,n,a),a},w=class{constructor(e){this.communicator=e}async getChainInfo(){return(await this.communicator.send(c.getChainInfo,void 0)).data}async getInfo(){return(await this.communicator.send(c.getSafeInfo,void 0)).data}async experimental_getBalances({currency:e=`usd`}={}){return(await this.communicator.send(c.getSafeBalances,{currency:e})).data}async check1271Signature(e,t=`0x`){let r=await this.getInfo(),i=n({abi:[{constant:!1,inputs:[{name:`_dataHash`,type:`bytes32`},{name:`_signature`,type:`bytes`}],name:`isValidSignature`,outputs:[{name:``,type:`bytes4`}],payable:!1,stateMutability:`nonpayable`,type:`function`}],functionName:`isValidSignature`,args:[e,t]}),a={call:p.eth_call,params:[{to:r.safeAddress,data:i},`latest`]};try{return(await this.communicator.send(c.rpcCall,a)).data.slice(0,10).toLowerCase()===g}catch{return!1}}async check1271SignatureBytes(e,t=`0x`){let r=await this.getInfo(),i=n({abi:[{constant:!1,inputs:[{name:`_data`,type:`bytes`},{name:`_signature`,type:`bytes`}],name:`isValidSignature`,outputs:[{name:``,type:`bytes4`}],payable:!1,stateMutability:`nonpayable`,type:`function`}],functionName:`isValidSignature`,args:[e,t]}),a={call:p.eth_call,params:[{to:r.safeAddress,data:i},`latest`]};try{return(await this.communicator.send(c.rpcCall,a)).data.slice(0,10).toLowerCase()===_}catch{return!1}}calculateMessageHash(e){return t(e)}calculateTypedMessageHash(t){let n=typeof t.domain.chainId==`object`?t.domain.chainId.toNumber():Number(t.domain.chainId),r=t.primaryType;if(!r){let e=Object.values(t.types),n=Object.keys(t.types).filter(t=>e.every(e=>e.every(({type:e})=>e.replace(`[`,``).replace(`]`,``)!==t)));if(n.length===0||n.length>1)throw Error(`Please specify primaryType`);r=n[0]}return e({message:t.message,domain:{...t.domain,chainId:n,verifyingContract:t.domain.verifyingContract,salt:t.domain.salt},types:t.types,primaryType:r})}async getOffChainSignature(e){return(await this.communicator.send(c.getOffChainSignature,e)).data}async isMessageSigned(e,t=`0x`){let n;if(typeof e==`string`&&(n=async()=>{let n=this.calculateMessageHash(e);return await this.isMessageHashSigned(n,t)}),d(e)&&(n=async()=>{let n=this.calculateTypedMessageHash(e);return await this.isMessageHashSigned(n,t)}),n)return await n();throw Error(`Invalid message type`)}async isMessageHashSigned(e,t=`0x`){let n=[this.check1271Signature.bind(this),this.check1271SignatureBytes.bind(this)];for(let r of n)if(await r(e,t))return!0;return!1}async getEnvironmentInfo(){return(await this.communicator.send(c.getEnvironmentInfo,void 0)).data}async requestAddressBook(){return(await this.communicator.send(c.requestAddressBook,void 0)).data}};C([S()],w.prototype,`requestAddressBook`,null);var T=class{constructor(e={}){let{allowedDomains:t=null,debug:n=!1}=e;this.communicator=new u(t,n),this.eth=new h(this.communicator),this.txs=new f(this.communicator),this.safe=new w(this.communicator),this.wallet=new b(this.communicator)}};export{T as default};