rise-wallet 0.1.4-beta.1 → 0.2.28

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 (486) hide show
  1. package/README.md +64 -34
  2. package/dist/cli/Dialog.d.ts +34 -0
  3. package/dist/cli/Dialog.js +60 -0
  4. package/dist/cli/Dialog.js.map +1 -0
  5. package/dist/cli/Messenger.d.ts +7 -0
  6. package/dist/cli/Messenger.js +123 -0
  7. package/dist/cli/Messenger.js.map +1 -0
  8. package/dist/cli/bin/commands-D7N5ucUu.js +50 -0
  9. package/dist/cli/bin/index.js +9 -0
  10. package/dist/cli/index.d.ts +2 -0
  11. package/dist/cli/index.js +3 -0
  12. package/dist/cli/index.js.map +1 -0
  13. package/dist/cli/internal/http.d.ts +6 -0
  14. package/dist/cli/internal/http.js +17 -0
  15. package/dist/cli/internal/http.js.map +1 -0
  16. package/dist/cli/tsdown.config.d.ts +2 -0
  17. package/dist/cli/tsdown.config.js +28 -0
  18. package/dist/cli/tsdown.config.js.map +1 -0
  19. package/dist/core/Chains.d.ts +210 -0
  20. package/dist/core/Chains.js +20 -0
  21. package/dist/core/Chains.js.map +1 -0
  22. package/dist/core/Dialog.d.ts +307 -0
  23. package/dist/core/Dialog.js +809 -0
  24. package/dist/core/Dialog.js.map +1 -0
  25. package/dist/core/Messenger.d.ts +164 -0
  26. package/dist/core/Messenger.js +207 -0
  27. package/dist/core/Messenger.js.map +1 -0
  28. package/dist/core/Mode.d.ts +4 -0
  29. package/dist/core/Mode.js +5 -0
  30. package/dist/core/Mode.js.map +1 -0
  31. package/dist/core/Porto.d.ts +1608 -0
  32. package/dist/core/Porto.js +105 -0
  33. package/dist/core/Porto.js.map +1 -0
  34. package/dist/core/RpcSchema.d.ts +81 -0
  35. package/dist/core/RpcSchema.js +2 -0
  36. package/dist/core/RpcSchema.js.map +1 -0
  37. package/dist/core/Storage.d.ts +14 -0
  38. package/dist/core/Storage.js +109 -0
  39. package/dist/core/Storage.js.map +1 -0
  40. package/dist/core/Transport.d.ts +22 -0
  41. package/dist/core/Transport.js +37 -0
  42. package/dist/core/Transport.js.map +1 -0
  43. package/dist/core/internal/_generated/chains.d.ts +1 -0
  44. package/dist/core/internal/_generated/chains.js +3 -0
  45. package/dist/core/internal/_generated/chains.js.map +1 -0
  46. package/dist/core/internal/_generated/contracts/IthacaAccount.d.ts +1120 -0
  47. package/dist/core/internal/_generated/contracts/IthacaAccount.js +1453 -0
  48. package/dist/core/internal/_generated/contracts/IthacaAccount.js.map +1 -0
  49. package/dist/core/internal/call.d.ts +163 -0
  50. package/dist/core/internal/call.js +115 -0
  51. package/dist/core/internal/call.js.map +1 -0
  52. package/dist/core/internal/erc8010.d.ts +17 -0
  53. package/dist/core/internal/erc8010.js +29 -0
  54. package/dist/core/internal/erc8010.js.map +1 -0
  55. package/dist/core/internal/intersectionObserver.d.ts +1 -0
  56. package/dist/core/internal/intersectionObserver.js +5 -0
  57. package/dist/core/internal/intersectionObserver.js.map +1 -0
  58. package/dist/core/internal/logger.d.ts +21 -0
  59. package/dist/core/internal/logger.js +24 -0
  60. package/dist/core/internal/logger.js.map +1 -0
  61. package/dist/core/internal/mode.d.ts +344 -0
  62. package/dist/core/internal/mode.js +110 -0
  63. package/dist/core/internal/mode.js.map +1 -0
  64. package/dist/core/internal/modes/dialog.d.ts +799 -0
  65. package/dist/core/internal/modes/dialog.js +760 -0
  66. package/dist/core/internal/modes/dialog.js.map +1 -0
  67. package/dist/core/internal/modes/reactNative.d.ts +1401 -0
  68. package/dist/core/internal/modes/reactNative.js +19 -0
  69. package/dist/core/internal/modes/reactNative.js.map +1 -0
  70. package/dist/core/internal/modes/relay.d.ts +684 -0
  71. package/dist/core/internal/modes/relay.js +708 -0
  72. package/dist/core/internal/modes/relay.js.map +1 -0
  73. package/dist/core/internal/permissions.d.ts +59 -0
  74. package/dist/core/internal/permissions.js +30 -0
  75. package/dist/core/internal/permissions.js.map +1 -0
  76. package/dist/core/internal/permissionsRequest.d.ts +71 -0
  77. package/dist/core/internal/permissionsRequest.js +58 -0
  78. package/dist/core/internal/permissionsRequest.js.map +1 -0
  79. package/dist/core/internal/porto.d.ts +13 -0
  80. package/dist/core/internal/porto.js +2 -0
  81. package/dist/core/internal/porto.js.map +1 -0
  82. package/dist/core/internal/promise.d.ts +8 -0
  83. package/dist/core/internal/promise.js +11 -0
  84. package/dist/core/internal/promise.js.map +1 -0
  85. package/dist/core/internal/provider.d.ts +29 -0
  86. package/dist/core/internal/provider.js +941 -0
  87. package/dist/core/internal/provider.js.map +1 -0
  88. package/dist/core/internal/relay/rpcSchema.d.ts +75 -0
  89. package/dist/core/internal/relay/rpcSchema.js +7 -0
  90. package/dist/core/internal/relay/rpcSchema.js.map +1 -0
  91. package/dist/core/internal/relay/schema/capabilities.d.ts +164 -0
  92. package/dist/core/internal/relay/schema/capabilities.js +112 -0
  93. package/dist/core/internal/relay/schema/capabilities.js.map +1 -0
  94. package/dist/core/internal/relay/schema/intent.d.ts +167 -0
  95. package/dist/core/internal/relay/schema/intent.js +170 -0
  96. package/dist/core/internal/relay/schema/intent.js.map +1 -0
  97. package/dist/core/internal/relay/schema/key.d.ts +43 -0
  98. package/dist/core/internal/relay/schema/key.js +30 -0
  99. package/dist/core/internal/relay/schema/key.js.map +1 -0
  100. package/dist/core/internal/relay/schema/permission.d.ts +39 -0
  101. package/dist/core/internal/relay/schema/permission.js +29 -0
  102. package/dist/core/internal/relay/schema/permission.js.map +1 -0
  103. package/dist/core/internal/relay/schema/preCall.d.ts +62 -0
  104. package/dist/core/internal/relay/schema/preCall.js +36 -0
  105. package/dist/core/internal/relay/schema/preCall.js.map +1 -0
  106. package/dist/core/internal/relay/schema/quotes.d.ts +369 -0
  107. package/dist/core/internal/relay/schema/quotes.js +89 -0
  108. package/dist/core/internal/relay/schema/quotes.js.map +1 -0
  109. package/dist/core/internal/relay/schema/rpc.d.ts +1528 -0
  110. package/dist/core/internal/relay/schema/rpc.js +638 -0
  111. package/dist/core/internal/relay/schema/rpc.js.map +1 -0
  112. package/dist/core/internal/relay/schema/token.d.ts +13 -0
  113. package/dist/core/internal/relay/schema/token.js +13 -0
  114. package/dist/core/internal/relay/schema/token.js.map +1 -0
  115. package/dist/core/internal/requiredFunds.d.ts +18 -0
  116. package/dist/core/internal/requiredFunds.js +25 -0
  117. package/dist/core/internal/requiredFunds.js.map +1 -0
  118. package/dist/core/internal/schema/capabilities.d.ts +313 -0
  119. package/dist/core/internal/schema/capabilities.js +133 -0
  120. package/dist/core/internal/schema/capabilities.js.map +1 -0
  121. package/dist/core/internal/schema/key.d.ts +164 -0
  122. package/dist/core/internal/schema/key.js +75 -0
  123. package/dist/core/internal/schema/key.js.map +1 -0
  124. package/dist/core/internal/schema/permissions.d.ts +102 -0
  125. package/dist/core/internal/schema/permissions.js +28 -0
  126. package/dist/core/internal/schema/permissions.js.map +1 -0
  127. package/dist/core/internal/schema/request.d.ts +937 -0
  128. package/dist/core/internal/schema/request.js +57 -0
  129. package/dist/core/internal/schema/request.js.map +1 -0
  130. package/dist/core/internal/schema/rpc.d.ts +3314 -0
  131. package/dist/core/internal/schema/rpc.js +599 -0
  132. package/dist/core/internal/schema/rpc.js.map +1 -0
  133. package/dist/core/internal/schema/token.d.ts +1 -0
  134. package/dist/core/internal/schema/token.js +2 -0
  135. package/dist/core/internal/schema/token.js.map +1 -0
  136. package/dist/core/internal/schema/utils.d.ts +18 -0
  137. package/dist/core/internal/schema/utils.js +213 -0
  138. package/dist/core/internal/schema/utils.js.map +1 -0
  139. package/dist/core/internal/siwe.d.ts +32 -0
  140. package/dist/core/internal/siwe.js +92 -0
  141. package/dist/core/internal/siwe.js.map +1 -0
  142. package/dist/core/internal/store.d.ts +2 -0
  143. package/dist/core/internal/store.js +9 -0
  144. package/dist/core/internal/store.js.map +1 -0
  145. package/dist/core/internal/tokens.d.ts +57 -0
  146. package/dist/core/internal/tokens.js +69 -0
  147. package/dist/core/internal/tokens.js.map +1 -0
  148. package/dist/core/internal/types.d.ts +298 -0
  149. package/dist/core/internal/types.js +2 -0
  150. package/dist/core/internal/types.js.map +1 -0
  151. package/dist/core/internal/urlString.d.ts +1 -0
  152. package/dist/core/internal/urlString.js +8 -0
  153. package/dist/core/internal/urlString.js.map +1 -0
  154. package/dist/core/internal/userAgent.d.ts +10 -0
  155. package/dist/core/internal/userAgent.js +19 -0
  156. package/dist/core/internal/userAgent.js.map +1 -0
  157. package/dist/core/internal/utils.d.ts +24 -0
  158. package/dist/core/internal/utils.js +62 -0
  159. package/dist/core/internal/utils.js.map +1 -0
  160. package/dist/core/react-native/Porto.d.ts +1480 -0
  161. package/dist/core/react-native/Porto.js +17 -0
  162. package/dist/core/react-native/Porto.js.map +1 -0
  163. package/dist/core/react-native/configure.d.ts +9 -0
  164. package/dist/core/react-native/configure.js +24 -0
  165. package/dist/core/react-native/configure.js.map +1 -0
  166. package/dist/core/react-native/environment.d.ts +26 -0
  167. package/dist/core/react-native/environment.js +13 -0
  168. package/dist/core/react-native/environment.js.map +1 -0
  169. package/dist/core/react-native/index.d.ts +4 -0
  170. package/dist/core/react-native/index.js +5 -0
  171. package/dist/core/react-native/index.js.map +1 -0
  172. package/dist/core/react-native/utils.d.ts +1 -0
  173. package/dist/core/react-native/utils.js +12 -0
  174. package/dist/core/react-native/utils.js.map +1 -0
  175. package/dist/index.d.ts +16 -2
  176. package/dist/index.js +15 -2
  177. package/dist/index.js.map +1 -0
  178. package/dist/internal/index.d.ts +3 -0
  179. package/dist/internal/index.js +4 -0
  180. package/dist/internal/index.js.map +1 -0
  181. package/dist/react-native/crypto.d.ts +1 -0
  182. package/dist/react-native/crypto.js +12 -0
  183. package/dist/react-native/crypto.js.map +1 -0
  184. package/dist/react-native/index.d.ts +7 -0
  185. package/dist/react-native/index.js +12 -0
  186. package/dist/react-native/index.js.map +1 -0
  187. package/dist/react-native/register.d.ts +2 -0
  188. package/dist/react-native/register.js +15 -0
  189. package/dist/react-native/register.js.map +1 -0
  190. package/dist/register/index.d.ts +14 -0
  191. package/dist/register/index.js +2 -0
  192. package/dist/register/index.js.map +1 -0
  193. package/dist/remote/Actions.d.ts +33 -0
  194. package/dist/remote/Actions.js +76 -0
  195. package/dist/remote/Actions.js.map +1 -0
  196. package/dist/remote/Events.d.ts +46 -0
  197. package/dist/remote/Events.js +132 -0
  198. package/dist/remote/Events.js.map +1 -0
  199. package/dist/remote/Hooks.d.ts +3800 -0
  200. package/dist/remote/Hooks.js +106 -0
  201. package/dist/remote/Hooks.js.map +1 -0
  202. package/dist/remote/Porto.d.ts +857 -0
  203. package/dist/remote/Porto.js +66 -0
  204. package/dist/remote/Porto.js.map +1 -0
  205. package/dist/remote/index.d.ts +4 -0
  206. package/dist/remote/index.js +5 -0
  207. package/dist/remote/index.js.map +1 -0
  208. package/dist/remote/internal/methodPolicies.d.ts +96 -0
  209. package/dist/remote/internal/methodPolicies.js +102 -0
  210. package/dist/remote/internal/methodPolicies.js.map +1 -0
  211. package/dist/server/Route.d.ts +87 -0
  212. package/dist/server/Route.js +189 -0
  213. package/dist/server/Route.js.map +1 -0
  214. package/dist/server/Router.d.ts +23 -0
  215. package/dist/server/Router.js +29 -0
  216. package/dist/server/Router.js.map +1 -0
  217. package/dist/server/index.d.ts +2 -0
  218. package/dist/server/index.js +3 -0
  219. package/dist/server/index.js.map +1 -0
  220. package/dist/server/internal/merchantSchema.d.ts +64 -0
  221. package/dist/server/internal/merchantSchema.js +7 -0
  222. package/dist/server/internal/merchantSchema.js.map +1 -0
  223. package/dist/server/internal/requestListener.d.ts +123 -0
  224. package/dist/server/internal/requestListener.js +172 -0
  225. package/dist/server/internal/requestListener.js.map +1 -0
  226. package/dist/theme/Theme.d.ts +121 -0
  227. package/dist/theme/Theme.js +18 -0
  228. package/dist/theme/Theme.js.map +1 -0
  229. package/dist/theme/index.d.ts +2 -0
  230. package/dist/theme/index.js +2 -0
  231. package/dist/theme/index.js.map +1 -0
  232. package/dist/trusted-hosts.d.ts +1 -0
  233. package/dist/trusted-hosts.js +41 -0
  234. package/dist/trusted-hosts.js.map +1 -0
  235. package/dist/viem/Account.d.ts +110 -0
  236. package/dist/viem/Account.js +132 -0
  237. package/dist/viem/Account.js.map +1 -0
  238. package/dist/viem/AccountActions.d.ts +10 -0
  239. package/dist/viem/AccountActions.js +14 -0
  240. package/dist/viem/AccountActions.js.map +1 -0
  241. package/dist/viem/CapabilitiesSchema.d.ts +14 -0
  242. package/dist/viem/CapabilitiesSchema.js +2 -0
  243. package/dist/viem/CapabilitiesSchema.js.map +1 -0
  244. package/dist/viem/ContractActions.d.ts +208 -0
  245. package/dist/viem/ContractActions.js +350 -0
  246. package/dist/viem/ContractActions.js.map +1 -0
  247. package/dist/viem/Key.d.ts +1155 -0
  248. package/dist/viem/Key.js +924 -0
  249. package/dist/viem/Key.js.map +1 -0
  250. package/dist/viem/RelayActions.d.ts +435 -0
  251. package/dist/viem/RelayActions.js +385 -0
  252. package/dist/viem/RelayActions.js.map +1 -0
  253. package/dist/viem/RelayClient.d.ts +26 -0
  254. package/dist/viem/RelayClient.js +44 -0
  255. package/dist/viem/RelayClient.js.map +1 -0
  256. package/dist/viem/RpcSchema.d.ts +22 -0
  257. package/dist/viem/RpcSchema.js +2 -0
  258. package/dist/viem/RpcSchema.js.map +1 -0
  259. package/dist/viem/WalletActions.d.ts +86 -0
  260. package/dist/viem/WalletActions.js +220 -0
  261. package/dist/viem/WalletActions.js.map +1 -0
  262. package/dist/viem/WalletClient.d.ts +20 -0
  263. package/dist/viem/WalletClient.js +23 -0
  264. package/dist/viem/WalletClient.js.map +1 -0
  265. package/dist/viem/index.d.ts +13 -0
  266. package/dist/viem/index.js +12 -0
  267. package/dist/viem/index.js.map +1 -0
  268. package/dist/viem/internal/relayActions.d.ts +364 -0
  269. package/dist/viem/internal/relayActions.js +783 -0
  270. package/dist/viem/internal/relayActions.js.map +1 -0
  271. package/dist/viem/internal/utils.d.ts +15 -0
  272. package/dist/viem/internal/utils.js +2 -0
  273. package/dist/viem/internal/utils.js.map +1 -0
  274. package/dist/wagmi/Actions.d.ts +1 -0
  275. package/dist/wagmi/Actions.js +2 -0
  276. package/dist/wagmi/Actions.js.map +1 -0
  277. package/dist/wagmi/Connector.d.ts +26 -0
  278. package/dist/wagmi/Connector.js +238 -0
  279. package/dist/wagmi/Connector.js.map +1 -0
  280. package/dist/wagmi/Hooks.d.ts +1 -0
  281. package/dist/wagmi/Hooks.js +2 -0
  282. package/dist/wagmi/Hooks.js.map +1 -0
  283. package/dist/wagmi/Query.d.ts +1 -0
  284. package/dist/wagmi/Query.js +2 -0
  285. package/dist/wagmi/Query.js.map +1 -0
  286. package/dist/wagmi/index.d.ts +4 -0
  287. package/dist/wagmi/index.js +5 -0
  288. package/dist/wagmi/index.js.map +1 -0
  289. package/dist/wagmi/internal/core.d.ts +83 -0
  290. package/dist/wagmi/internal/core.js +229 -0
  291. package/dist/wagmi/internal/core.js.map +1 -0
  292. package/dist/wagmi/internal/query.d.ts +32 -0
  293. package/dist/wagmi/internal/query.js +23 -0
  294. package/dist/wagmi/internal/query.js.map +1 -0
  295. package/dist/wagmi/internal/react.d.ts +90 -0
  296. package/dist/wagmi/internal/react.js +256 -0
  297. package/dist/wagmi/internal/react.js.map +1 -0
  298. package/dist/wagmi/internal/types.d.ts +10 -0
  299. package/dist/wagmi/internal/types.js +2 -0
  300. package/dist/wagmi/internal/types.js.map +1 -0
  301. package/dist/wagmi/internal/utils.d.ts +1 -0
  302. package/dist/wagmi/internal/utils.js +18 -0
  303. package/dist/wagmi/internal/utils.js.map +1 -0
  304. package/package.json +286 -34
  305. package/src/cli/Dialog.ts +75 -0
  306. package/src/cli/Messenger.ts +148 -0
  307. package/src/cli/bin/index.ts +37 -0
  308. package/src/cli/bin/tsconfig.json +8 -0
  309. package/src/cli/index.ts +2 -0
  310. package/src/cli/internal/commands.ts +212 -0
  311. package/src/cli/internal/context.ts +56 -0
  312. package/src/cli/internal/http.ts +28 -0
  313. package/src/cli/internal/utils.ts +28 -0
  314. package/src/cli/tsdown.config.ts +37 -0
  315. package/src/core/Chains.ts +25 -0
  316. package/src/core/Dialog.ts +1059 -0
  317. package/src/core/Messenger.ts +394 -0
  318. package/src/core/Mode.ts +4 -0
  319. package/src/core/Porto.ts +287 -0
  320. package/src/core/RpcSchema.ts +124 -0
  321. package/src/core/Storage.ts +122 -0
  322. package/src/core/Transport.ts +45 -0
  323. package/src/core/internal/_generated/chains.ts +2 -0
  324. package/src/core/internal/_generated/contracts/EIP7702Proxy.ts +25 -0
  325. package/src/core/internal/_generated/contracts/Escrow.ts +330 -0
  326. package/src/core/internal/_generated/contracts/ExperimentERC20.ts +569 -0
  327. package/src/core/internal/_generated/contracts/ExperimentERC721.ts +588 -0
  328. package/src/core/internal/_generated/contracts/GuardedExecutor.ts +623 -0
  329. package/src/core/internal/_generated/contracts/ICallChecker.ts +34 -0
  330. package/src/core/internal/_generated/contracts/ICommon.ts +4 -0
  331. package/src/core/internal/_generated/contracts/IEscrow.ts +114 -0
  332. package/src/core/internal/_generated/contracts/IFunder.ts +80 -0
  333. package/src/core/internal/_generated/contracts/IFunderV4.ts +45 -0
  334. package/src/core/internal/_generated/contracts/IIthacaAccount.ts +107 -0
  335. package/src/core/internal/_generated/contracts/IOAppCore.ts +142 -0
  336. package/src/core/internal/_generated/contracts/IOAppMsgInspector.ts +45 -0
  337. package/src/core/internal/_generated/contracts/IOAppReceiver.ts +161 -0
  338. package/src/core/internal/_generated/contracts/IOrchestrator.ts +95 -0
  339. package/src/core/internal/_generated/contracts/ISettler.ts +52 -0
  340. package/src/core/internal/_generated/contracts/ISigner.ts +34 -0
  341. package/src/core/internal/_generated/contracts/IthacaAccount.ts +1454 -0
  342. package/src/core/internal/_generated/contracts/IthacaAccountNew.ts +1454 -0
  343. package/src/core/internal/_generated/contracts/IthacaAccountOld.ts +1454 -0
  344. package/src/core/internal/_generated/contracts/LayerZeroSettler.ts +811 -0
  345. package/src/core/internal/_generated/contracts/LibNonce.ts +15 -0
  346. package/src/core/internal/_generated/contracts/LibTStack.ts +4 -0
  347. package/src/core/internal/_generated/contracts/MultiSigSigner.ts +203 -0
  348. package/src/core/internal/_generated/contracts/OApp.ts +412 -0
  349. package/src/core/internal/_generated/contracts/OAppCore.ts +229 -0
  350. package/src/core/internal/_generated/contracts/OAppReceiver.ts +396 -0
  351. package/src/core/internal/_generated/contracts/OAppSender.ts +245 -0
  352. package/src/core/internal/_generated/contracts/Orchestrator.ts +390 -0
  353. package/src/core/internal/_generated/contracts/SimpleFunder.ts +534 -0
  354. package/src/core/internal/_generated/contracts/SimpleSettler.ts +360 -0
  355. package/src/core/internal/_generated/contracts/Simulator.ts +170 -0
  356. package/src/core/internal/_generated/contracts/TokenTransferLib.ts +4 -0
  357. package/src/core/internal/_snapshots/provider.browser.test.ts.snap +119 -0
  358. package/src/core/internal/_snapshots/provider.test.ts.snap +1103 -0
  359. package/src/core/internal/call.test.ts +116 -0
  360. package/src/core/internal/call.ts +245 -0
  361. package/src/core/internal/erc8010.test.ts +74 -0
  362. package/src/core/internal/erc8010.ts +44 -0
  363. package/src/core/internal/intersectionObserver.ts +5 -0
  364. package/src/core/internal/logger.ts +42 -0
  365. package/src/core/internal/mode.ts +498 -0
  366. package/src/core/internal/modes/dialog.ts +1051 -0
  367. package/src/core/internal/modes/reactNative.ts +29 -0
  368. package/src/core/internal/modes/relay.ts +893 -0
  369. package/src/core/internal/permissions.ts +43 -0
  370. package/src/core/internal/permissionsRequest.ts +88 -0
  371. package/src/core/internal/porto.ts +16 -0
  372. package/src/core/internal/promise.ts +19 -0
  373. package/src/core/internal/provider.browser.test.ts +311 -0
  374. package/src/core/internal/provider.test.ts +3552 -0
  375. package/src/core/internal/provider.ts +1277 -0
  376. package/src/core/internal/relay/rpcSchema.ts +101 -0
  377. package/src/core/internal/relay/schema/capabilities.test.ts +663 -0
  378. package/src/core/internal/relay/schema/capabilities.ts +156 -0
  379. package/src/core/internal/relay/schema/intent.test.ts +433 -0
  380. package/src/core/internal/relay/schema/intent.ts +174 -0
  381. package/src/core/internal/relay/schema/key.test.ts +424 -0
  382. package/src/core/internal/relay/schema/key.ts +34 -0
  383. package/src/core/internal/relay/schema/permission.test.ts +499 -0
  384. package/src/core/internal/relay/schema/permission.ts +34 -0
  385. package/src/core/internal/relay/schema/preCall.ts +39 -0
  386. package/src/core/internal/relay/schema/quotes.test.ts +901 -0
  387. package/src/core/internal/relay/schema/quotes.ts +98 -0
  388. package/src/core/internal/relay/schema/rpc.ts +822 -0
  389. package/src/core/internal/relay/schema/token.ts +16 -0
  390. package/src/core/internal/requiredFunds.test.ts +141 -0
  391. package/src/core/internal/requiredFunds.ts +45 -0
  392. package/src/core/internal/schema/capabilities.test.ts +1334 -0
  393. package/src/core/internal/schema/capabilities.ts +162 -0
  394. package/src/core/internal/schema/key.test.ts +570 -0
  395. package/src/core/internal/schema/key.ts +98 -0
  396. package/src/core/internal/schema/permissions.test.ts +948 -0
  397. package/src/core/internal/schema/permissions.ts +31 -0
  398. package/src/core/internal/schema/request.bench.ts +35 -0
  399. package/src/core/internal/schema/request.ts +90 -0
  400. package/src/core/internal/schema/rpc.ts +821 -0
  401. package/src/core/internal/schema/token.ts +1 -0
  402. package/src/core/internal/schema/utils.test.ts +572 -0
  403. package/src/core/internal/schema/utils.ts +236 -0
  404. package/src/core/internal/siwe.test.ts +473 -0
  405. package/src/core/internal/siwe.ts +144 -0
  406. package/src/core/internal/store.ts +9 -0
  407. package/src/core/internal/tokens.test.ts +317 -0
  408. package/src/core/internal/tokens.ts +125 -0
  409. package/src/core/internal/types.ts +448 -0
  410. package/src/core/internal/urlString.ts +5 -0
  411. package/src/core/internal/userAgent.ts +35 -0
  412. package/src/core/internal/utils.test.ts +35 -0
  413. package/src/core/internal/utils.ts +67 -0
  414. package/src/core/react-native/Porto.ts +22 -0
  415. package/src/core/react-native/configure.ts +31 -0
  416. package/src/core/react-native/environment.ts +43 -0
  417. package/src/core/react-native/index.ts +4 -0
  418. package/src/core/react-native/utils.ts +18 -0
  419. package/src/index.ts +17 -0
  420. package/src/internal/index.ts +3 -0
  421. package/src/react-native/crypto.ts +19 -0
  422. package/src/react-native/index.ts +15 -0
  423. package/src/react-native/register.ts +24 -0
  424. package/src/register/index.ts +17 -0
  425. package/src/remote/Actions.ts +115 -0
  426. package/src/remote/Events.ts +193 -0
  427. package/src/remote/Hooks.ts +194 -0
  428. package/src/remote/Porto.ts +144 -0
  429. package/src/remote/index.ts +4 -0
  430. package/src/remote/internal/methodPolicies.ts +124 -0
  431. package/src/server/Route.test.ts +347 -0
  432. package/src/server/Route.ts +259 -0
  433. package/src/server/Router.test.ts +32 -0
  434. package/src/server/Router.ts +59 -0
  435. package/src/server/index.ts +2 -0
  436. package/src/server/internal/merchantSchema.ts +11 -0
  437. package/src/server/internal/requestListener.ts +284 -0
  438. package/src/theme/Theme.ts +163 -0
  439. package/src/theme/index.ts +2 -0
  440. package/src/trusted-hosts.ts +40 -0
  441. package/src/tsconfig.build.tsbuildinfo +1 -0
  442. package/src/tsconfig.json +15 -0
  443. package/src/viem/Account.test.ts +270 -0
  444. package/src/viem/Account.ts +278 -0
  445. package/src/viem/AccountActions.test.ts +3 -0
  446. package/src/viem/AccountActions.ts +30 -0
  447. package/src/viem/CapabilitiesSchema.ts +18 -0
  448. package/src/viem/ContractActions.test.ts +980 -0
  449. package/src/viem/ContractActions.ts +624 -0
  450. package/src/viem/Key.test.ts +1420 -0
  451. package/src/viem/Key.ts +1318 -0
  452. package/src/viem/RelayActions.test.ts +1730 -0
  453. package/src/viem/RelayActions.ts +1082 -0
  454. package/src/viem/RelayClient.test.ts +127 -0
  455. package/src/viem/RelayClient.ts +87 -0
  456. package/src/viem/RpcSchema.ts +27 -0
  457. package/src/viem/WalletActions.test.ts +646 -0
  458. package/src/viem/WalletActions.ts +476 -0
  459. package/src/viem/WalletClient.test.ts +36 -0
  460. package/src/viem/WalletClient.ts +74 -0
  461. package/src/viem/index.ts +13 -0
  462. package/src/viem/internal/relayActions.test.ts +1296 -0
  463. package/src/viem/internal/relayActions.ts +1222 -0
  464. package/src/viem/internal/utils.ts +27 -0
  465. package/src/wagmi/Actions.ts +13 -0
  466. package/src/wagmi/Connector.ts +304 -0
  467. package/src/wagmi/Hooks.ts +14 -0
  468. package/src/wagmi/Query.ts +5 -0
  469. package/src/wagmi/index.ts +4 -0
  470. package/src/wagmi/internal/core.test.ts +12 -0
  471. package/src/wagmi/internal/core.ts +468 -0
  472. package/src/wagmi/internal/query.ts +52 -0
  473. package/src/wagmi/internal/react.test.ts +12 -0
  474. package/src/wagmi/internal/react.ts +705 -0
  475. package/src/wagmi/internal/types.ts +21 -0
  476. package/src/wagmi/internal/utils.ts +25 -0
  477. package/dist/chain.cjs +0 -17
  478. package/dist/chain.d.cts +0 -41
  479. package/dist/chain.d.ts +0 -41
  480. package/dist/chain.js +0 -13
  481. package/dist/config.cjs +0 -19
  482. package/dist/config.d.cts +0 -3
  483. package/dist/config.d.ts +0 -3
  484. package/dist/config.js +0 -16
  485. package/dist/index.cjs +0 -18
  486. package/dist/index.d.cts +0 -2
@@ -0,0 +1,394 @@
1
+ import * as Json from 'ox/Json'
2
+ import type * as RpcRequest from 'ox/RpcRequest'
3
+ import type * as RpcResponse from 'ox/RpcResponse'
4
+ import type * as MethodPolicies from '../remote/internal/methodPolicies.js'
5
+ import type * as Theme from '../theme/Theme.js'
6
+ import * as promise from './internal/promise.js'
7
+ import * as Utils from './internal/utils.js'
8
+ import type * as Porto from './Porto.js'
9
+
10
+ /** Messenger interface. */
11
+ export type Messenger = {
12
+ destroy: () => void
13
+ on: <const topic extends Topic>(
14
+ topic: topic | Topic,
15
+ listener: (payload: Payload<topic>, event: MessageEvent) => void,
16
+ id?: string | undefined,
17
+ ) => () => void
18
+ send: <const topic extends Topic>(
19
+ topic: topic | Topic,
20
+ payload: Payload<topic>,
21
+ targetOrigin?: string | undefined,
22
+ ) => Promise<{ id: string; topic: topic; payload: Payload<topic> }>
23
+ sendAsync: <const topic extends Topic>(
24
+ topic: topic | Topic,
25
+ payload: Payload<topic>,
26
+ targetOrigin?: string | undefined,
27
+ ) => Promise<Response<topic>>
28
+ }
29
+
30
+ export type WithReady = Messenger & {
31
+ ready: (options: ReadyOptions) => void
32
+ }
33
+
34
+ export type ReadyOptions = {
35
+ chainIds: readonly [number, ...number[]]
36
+ methodPolicies?: MethodPolicies.MethodPolicies | undefined
37
+ trustedHosts?: string[] | undefined
38
+ }
39
+
40
+ /** Bridge messenger. */
41
+ export type Bridge = WithReady & {
42
+ waitForReady: () => Promise<ReadyOptions>
43
+ }
44
+
45
+ /** CLI relay messenger. */
46
+ export type CliRelay = WithReady
47
+
48
+ /** Messenger schema. */
49
+ export type Schema = [
50
+ {
51
+ topic: 'close'
52
+ payload: undefined
53
+ response: undefined
54
+ },
55
+ {
56
+ topic: 'ready'
57
+ payload: ReadyOptions
58
+ response: undefined
59
+ },
60
+ {
61
+ topic: 'rpc-requests'
62
+ payload: readonly Porto.QueuedRequest[]
63
+ response: undefined
64
+ },
65
+ {
66
+ topic: 'rpc-response'
67
+ payload: RpcResponse.RpcResponse & {
68
+ _request: RpcRequest.RpcRequest
69
+ }
70
+ response: undefined
71
+ },
72
+ {
73
+ topic: 'success'
74
+ payload: {
75
+ title: string
76
+ content: string
77
+ }
78
+ response: undefined
79
+ },
80
+ {
81
+ topic: '__internal'
82
+ payload:
83
+ | {
84
+ type: 'init'
85
+ chainIds?: readonly number[] | undefined
86
+ mode:
87
+ | 'inline-iframe'
88
+ | 'iframe'
89
+ | 'popup'
90
+ | 'popup-standalone'
91
+ | 'page'
92
+ referrer: {
93
+ icon?: string | { light: string; dark: string } | undefined
94
+ title: string
95
+ }
96
+ theme?: Theme.ThemeFragment | undefined
97
+ }
98
+ | {
99
+ type: 'switch'
100
+ mode:
101
+ | 'inline-iframe'
102
+ | 'iframe'
103
+ | 'popup'
104
+ | 'popup-standalone'
105
+ | 'page'
106
+ }
107
+ | {
108
+ type: 'resize'
109
+ height?: number | undefined
110
+ width?: number | undefined
111
+ }
112
+ | {
113
+ type: 'set-theme'
114
+ theme: Theme.ThemeFragment
115
+ }
116
+ | {
117
+ // backward compatibility from 0.2.7 (to be removed in a future version)
118
+ type: 'dialog-lifecycle'
119
+ action: 'request:close' | 'done:close'
120
+ }
121
+ response: undefined
122
+ },
123
+ ]
124
+
125
+ export type Topic = Schema[number]['topic']
126
+
127
+ export type Payload<topic extends Topic> = Extract<
128
+ Schema[number],
129
+ { topic: topic }
130
+ >['payload']
131
+
132
+ export type Response<topic extends Topic> = Extract<
133
+ Schema[number],
134
+ { topic: topic }
135
+ >['response']
136
+
137
+ /**
138
+ * Instantiates a messenger.
139
+ *
140
+ * @param messenger - Messenger.
141
+ * @returns Instantiated messenger.
142
+ */
143
+ export function from(messenger: Messenger): Messenger {
144
+ return messenger
145
+ }
146
+
147
+ /**
148
+ * Instantiates a messenger from a window instance.
149
+ *
150
+ * @param w - Window.
151
+ * @param options - Options.
152
+ * @returns Instantiated messenger.
153
+ */
154
+ export function fromWindow(
155
+ w: Window,
156
+ options: fromWindow.Options = {},
157
+ ): Messenger {
158
+ const { targetOrigin } = options
159
+ const listeners = new Map<string, (event: any) => any>()
160
+ return from({
161
+ destroy() {
162
+ for (const listener of listeners.values()) {
163
+ w.removeEventListener('message', listener)
164
+ }
165
+ },
166
+ on(topic, listener, id) {
167
+ function handler(event: MessageEvent) {
168
+ if (event.data.topic !== topic) return
169
+ if (id && event.data.id !== id) return
170
+ if (targetOrigin && event.origin !== targetOrigin) return
171
+ listener(event.data.payload, event)
172
+ }
173
+ w.addEventListener('message', handler)
174
+ listeners.set(topic, handler)
175
+ return () => w.removeEventListener('message', handler)
176
+ },
177
+ async send(topic, payload, target) {
178
+ const id = Utils.uuidv4()
179
+ w.postMessage(
180
+ Utils.normalizeValue({ id, payload, topic }),
181
+ target ?? targetOrigin ?? '*',
182
+ )
183
+ return { id, payload, topic } as never
184
+ },
185
+ async sendAsync(topic, payload, target) {
186
+ const { id } = await this.send(topic, payload, target)
187
+ return new Promise<any>((resolve) => this.on(topic as Topic, resolve, id))
188
+ },
189
+ })
190
+ }
191
+
192
+ export declare namespace fromWindow {
193
+ export type Options = {
194
+ /**
195
+ * Target origin.
196
+ */
197
+ targetOrigin?: string | undefined
198
+ }
199
+ }
200
+
201
+ /**
202
+ * Bridges two messengers for cross-window (e.g. parent to iframe) communication.
203
+ *
204
+ * @param parameters - Parameters.
205
+ * @returns Instantiated messenger.
206
+ */
207
+ export function bridge(parameters: bridge.Parameters): Bridge {
208
+ const { from: from_, to, waitForReady = false } = parameters
209
+
210
+ let pending = false
211
+
212
+ const ready = promise.withResolvers<ReadyOptions>()
213
+ from_.on('ready', ready.resolve)
214
+
215
+ const messenger = from({
216
+ destroy() {
217
+ from_.destroy()
218
+ to.destroy()
219
+ if (pending) ready.reject()
220
+ },
221
+ on(topic, listener, id) {
222
+ return from_.on(topic, listener, id)
223
+ },
224
+ async send(topic, payload) {
225
+ pending = true
226
+ if (waitForReady) await ready.promise.finally(() => (pending = false))
227
+ return to.send(topic, payload)
228
+ },
229
+ async sendAsync(topic, payload) {
230
+ pending = true
231
+ if (waitForReady) await ready.promise.finally(() => (pending = false))
232
+ return to.sendAsync(topic, payload)
233
+ },
234
+ })
235
+
236
+ return {
237
+ ...messenger,
238
+ ready(options) {
239
+ void messenger.send('ready', options)
240
+ },
241
+ waitForReady() {
242
+ return ready.promise
243
+ },
244
+ }
245
+ }
246
+
247
+ export declare namespace bridge {
248
+ export type Parameters = {
249
+ /**
250
+ * Source messenger.
251
+ */
252
+ from: Messenger
253
+ /**
254
+ * Target messenger.
255
+ */
256
+ to: Messenger
257
+ /**
258
+ * Whether to wait for the target messenger to indicate that it is ready via
259
+ * `messenger.ready()`.
260
+ */
261
+ waitForReady?: boolean | undefined
262
+ }
263
+ }
264
+
265
+ export function noop(): Bridge {
266
+ return {
267
+ destroy() {},
268
+ on() {
269
+ return () => {}
270
+ },
271
+ ready() {},
272
+ send() {
273
+ return Promise.resolve(undefined as never)
274
+ },
275
+ sendAsync() {
276
+ return Promise.resolve(undefined as never)
277
+ },
278
+ waitForReady() {
279
+ return Promise.resolve(undefined as never)
280
+ },
281
+ }
282
+ }
283
+
284
+ /**
285
+ * Creates a CLI relay messenger that sends messages via fetch to a relay URL
286
+ * and receives events via server-sent events.
287
+ *
288
+ * @param options - Options.
289
+ * @returns Local relay messenger.
290
+ */
291
+ export function cliRelay(options: cliRelay.Options): CliRelay {
292
+ const { relayUrl } = options
293
+
294
+ let eventSource: EventSource | null = null
295
+ const listenerSets = new Map<
296
+ string,
297
+ Set<(payload: any, event: any) => void>
298
+ >()
299
+
300
+ function connect() {
301
+ if (!relayUrl || eventSource) return
302
+
303
+ eventSource = new EventSource(relayUrl)
304
+
305
+ eventSource.onmessage = (event) => {
306
+ try {
307
+ const data = JSON.parse(event.data)
308
+ if (!data.topic) return
309
+ if (!data.payload) return
310
+
311
+ const listeners = listenerSets.get(data.topic)
312
+ if (!listeners) return
313
+
314
+ for (const listener of listeners)
315
+ listener(data.payload, { data, origin: relayUrl })
316
+ } catch (error) {
317
+ console.error('Error parsing SSE message:', error)
318
+ }
319
+ }
320
+
321
+ eventSource.onerror = (error) => {
322
+ console.error('SSE connection error:', error)
323
+ eventSource?.close()
324
+ eventSource = null
325
+ // attempt to reconnect in 1s
326
+ setTimeout(connect, 1000)
327
+ }
328
+ }
329
+ connect()
330
+
331
+ async function request(topic: Topic, payload: any) {
332
+ const id = Utils.uuidv4()
333
+ const data = { id, payload, topic }
334
+
335
+ const response = await fetch(relayUrl, {
336
+ body: Json.stringify(data),
337
+ headers: {
338
+ 'Content-Type': 'application/json',
339
+ },
340
+ method: 'POST',
341
+ })
342
+
343
+ return { id, payload, response, topic }
344
+ }
345
+
346
+ return {
347
+ destroy() {
348
+ eventSource?.close()
349
+ eventSource = null
350
+ listenerSets.clear()
351
+ },
352
+ on(topic, listener) {
353
+ if (!listenerSets.has(topic)) listenerSets.set(topic, new Set())
354
+ listenerSets.get(topic)!.add(listener)
355
+
356
+ return () => {
357
+ const listeners = listenerSets.get(topic)
358
+ if (!listeners) return
359
+
360
+ listeners.delete(listener)
361
+ if (listeners.size === 0) listenerSets.delete(topic)
362
+ }
363
+ },
364
+ async ready(options) {
365
+ await new Promise((resolve) => setTimeout(resolve, 32))
366
+ void this.send('ready', options)
367
+ },
368
+ async send(topic, payload) {
369
+ const { id } = await request(topic, payload)
370
+ return { id, payload, topic } as never
371
+ },
372
+ async sendAsync(topic, payload) {
373
+ const { response } = await request(topic, payload)
374
+
375
+ if (!response.ok)
376
+ throw new Error(`HTTP ${response.status}: ${response.statusText}`)
377
+
378
+ const contentType = response.headers.get('content-type')
379
+ if (contentType?.includes('application/json'))
380
+ return await response.json()
381
+
382
+ return undefined as never
383
+ },
384
+ }
385
+ }
386
+
387
+ export declare namespace cliRelay {
388
+ export type Options = {
389
+ /**
390
+ * Relay URL for both sending messages (POST) and receiving events (GET).
391
+ */
392
+ relayUrl: string
393
+ }
394
+ }
@@ -0,0 +1,4 @@
1
+ export { from, type Mode } from './internal/mode.js'
2
+ export { dialog } from './internal/modes/dialog.js'
3
+ export { reactNative } from './internal/modes/reactNative.js'
4
+ export { relay } from './internal/modes/relay.js'
@@ -0,0 +1,287 @@
1
+ import type * as Mipd from 'mipd'
2
+ import type * as Address from 'ox/Address'
3
+ import type * as Hex from 'ox/Hex'
4
+ import type * as RpcRequest from 'ox/RpcRequest'
5
+ import type * as RpcResponse from 'ox/RpcResponse'
6
+ import { http, type Transport } from 'viem'
7
+ import { devtools, persist, subscribeWithSelector } from 'zustand/middleware'
8
+ import { createStore, type Mutate, type StoreApi } from 'zustand/vanilla'
9
+ import type * as Account from '../viem/Account.js'
10
+ import * as Chains from './Chains.js'
11
+ import { hostUrls } from './Dialog.js'
12
+ import type * as Mode from './internal/mode.js'
13
+ import { dialog } from './internal/modes/dialog.js'
14
+ import { relay } from './internal/modes/relay.js'
15
+ import type * as internal from './internal/porto.js'
16
+ import * as Provider from './internal/provider.js'
17
+ import type * as Token from './internal/schema/token.js'
18
+ import type * as Siwe from './internal/siwe.js'
19
+ import type { ExactPartial, OneOf } from './internal/types.js'
20
+ import * as Utils from './internal/utils.js'
21
+ import * as Storage from './Storage.js'
22
+ import { relayUrls } from './Transport.js'
23
+
24
+ const browser = typeof window !== 'undefined' && typeof document !== 'undefined'
25
+
26
+ export const defaultConfig = {
27
+ announceProvider: true,
28
+ chains: Chains.all,
29
+ mode: browser ? dialog({ host: hostUrls.prod }) : relay(),
30
+ relay: http(relayUrls.prod.http),
31
+ storage:
32
+ browser && typeof indexedDB !== 'undefined'
33
+ ? Storage.idb()
34
+ : Storage.memory(),
35
+ storageKey: 'porto.store',
36
+ } as const satisfies ExactPartial<Config>
37
+
38
+ /**
39
+ * Instantiates an Porto instance.
40
+ *
41
+ * @example
42
+ * ```ts twoslash
43
+ * import { Porto } from 'porto'
44
+ *
45
+ * const porto = Porto.create()
46
+ *
47
+ * const blockNumber = await porto.provider.request({ method: 'eth_blockNumber' })
48
+ * ```
49
+ */
50
+ export function create<
51
+ const chains extends readonly [Chains.Chain, ...Chains.Chain[]],
52
+ >(parameters?: ExactPartial<Config<chains>> | undefined): Porto<chains>
53
+ export function create(
54
+ parameters: ExactPartial<Config> | undefined = {},
55
+ ): Porto {
56
+ const chains = parameters.chains ?? defaultConfig.chains
57
+ const transports = Object.fromEntries(
58
+ chains!.map((chain) => [
59
+ chain.id,
60
+ parameters.transports?.[chain.id] ?? http(),
61
+ ]),
62
+ )
63
+
64
+ const config = {
65
+ announceProvider:
66
+ parameters.announceProvider ?? defaultConfig.announceProvider,
67
+ authUrl: parameters.authUrl,
68
+ chains,
69
+ feeToken: parameters.feeToken,
70
+ merchantUrl: parameters.merchantUrl,
71
+ mode: parameters.mode ?? defaultConfig.mode,
72
+ relay: parameters.relay ?? defaultConfig.relay,
73
+ storage: parameters.storage ?? defaultConfig.storage,
74
+ storageKey: parameters.storageKey ?? defaultConfig.storageKey,
75
+ transports,
76
+ } satisfies Config
77
+
78
+ const store = createStore(
79
+ devtools(
80
+ subscribeWithSelector(
81
+ persist<State>(
82
+ (_) => ({
83
+ accounts: [],
84
+ chainIds: config.chains.map((chain) => chain.id) as [
85
+ number,
86
+ ...number[],
87
+ ],
88
+ feeToken: config.feeToken,
89
+ requestQueue: [],
90
+ }),
91
+ {
92
+ merge(p, currentState) {
93
+ const persistedState = p as State
94
+ const currentChainId =
95
+ config.chains.find(
96
+ (chain) => chain.id === persistedState.chainIds[0],
97
+ )?.id ?? config.chains[0].id
98
+ const chainIds = [
99
+ currentChainId,
100
+ ...config.chains
101
+ .map((chain) => chain.id)
102
+ .filter((id) => id !== currentChainId),
103
+ ] as const
104
+ return {
105
+ ...currentState,
106
+ ...persistedState,
107
+ chainIds,
108
+ }
109
+ },
110
+ name: config.storageKey,
111
+ partialize: (state) =>
112
+ ({
113
+ accounts: state.accounts.map((account) =>
114
+ // omit non-serializable properties (e.g. functions).
115
+ Utils.normalizeValue(account),
116
+ ),
117
+ chainIds: state.chainIds,
118
+ }) as unknown as State,
119
+ storage: config.storage,
120
+ version: 5,
121
+ },
122
+ ),
123
+ ),
124
+ ),
125
+ )
126
+
127
+ let mode = config.mode
128
+
129
+ const internal = {
130
+ config,
131
+ getMode() {
132
+ return mode
133
+ },
134
+ id: Utils.uuidv4(),
135
+ setMode(i) {
136
+ destroy?.()
137
+ mode = i
138
+ destroy = i.setup({
139
+ internal,
140
+ })
141
+ return destroy
142
+ },
143
+ store,
144
+ } satisfies internal.Internal
145
+
146
+ const provider = Provider.from(internal)
147
+
148
+ let destroy =
149
+ mode !== null
150
+ ? mode.setup({
151
+ internal,
152
+ })
153
+ : () => {}
154
+
155
+ return {
156
+ _internal: internal,
157
+ config,
158
+ destroy() {
159
+ destroy()
160
+ provider._internal.destroy()
161
+ },
162
+ provider,
163
+ }
164
+ }
165
+
166
+ export type Config<
167
+ chains extends readonly [Chains.Chain, ...Chains.Chain[]] = readonly [
168
+ Chains.Chain,
169
+ ...Chains.Chain[],
170
+ ],
171
+ > = {
172
+ /**
173
+ * Whether to announce the provider via EIP-6963.
174
+ * Also accepts EIP-6963 provider info.
175
+ * @default true
176
+ */
177
+ announceProvider: boolean | Partial<Mipd.EIP6963ProviderInfo>
178
+ /**
179
+ * API URL(s) to use for offchain SIWE authentication.
180
+ */
181
+ authUrl?: string | Siwe.AuthUrl | undefined
182
+ /**
183
+ * List of supported chains.
184
+ */
185
+ chains: chains
186
+ /**
187
+ * Token to use to pay for fees.
188
+ * @default 'native'
189
+ */
190
+ feeToken?: State['feeToken'] | undefined
191
+ /**
192
+ * Mode to use.
193
+ * @default Mode.dialog()
194
+ */
195
+ mode: Mode.Mode | null
196
+ /**
197
+ * URL to use for merchant server.
198
+ */
199
+ merchantUrl?: string | undefined
200
+ /**
201
+ * Relay RPC Transport override.
202
+ */
203
+ relay: Transport
204
+ /**
205
+ * Storage to use.
206
+ * @default Storage.idb()
207
+ */
208
+ storage: Storage.Storage
209
+ /**
210
+ * Key to use for store.
211
+ */
212
+ storageKey?: string | undefined
213
+ /**
214
+ * Public RPC Transport overrides to use for each chain.
215
+ */
216
+ transports: Record<chains[number]['id'], Transport>
217
+ }
218
+
219
+ export type Porto<
220
+ chains extends readonly [Chains.Chain, ...Chains.Chain[]] = readonly [
221
+ Chains.Chain,
222
+ ...Chains.Chain[],
223
+ ],
224
+ > = {
225
+ config: Config<chains>
226
+ destroy: () => void
227
+ provider: Provider.Provider
228
+ /**
229
+ * Not part of versioned API, proceed with caution.
230
+ * @deprecated
231
+ */
232
+ _internal: internal.Internal<chains>
233
+ }
234
+
235
+ export type State<
236
+ chains extends readonly [Chains.Chain, ...Chains.Chain[]] = readonly [
237
+ Chains.Chain,
238
+ ...Chains.Chain[],
239
+ ],
240
+ > = {
241
+ accounts: readonly Account.Account[]
242
+ chainIds: readonly [chains[number]['id'], ...chains[number]['id'][]]
243
+ feeToken: Token.Symbol | undefined
244
+ requestQueue: readonly QueuedRequest[]
245
+ }
246
+
247
+ export type Store<
248
+ chains extends readonly [Chains.Chain, ...Chains.Chain[]] = readonly [
249
+ Chains.Chain,
250
+ ...Chains.Chain[],
251
+ ],
252
+ > = Mutate<
253
+ StoreApi<State<chains>>,
254
+ [['zustand/subscribeWithSelector', never], ['zustand/persist', any]]
255
+ >
256
+
257
+ export type QueuedRequest<result = unknown> = {
258
+ /** Account to assert the request for, and sync if neccessary. */
259
+ account:
260
+ | {
261
+ /** Address of the account. */
262
+ address: Address.Address
263
+ /** Active key of the account. */
264
+ key?:
265
+ | {
266
+ /** Credential ID. May be `undefined` when the key is not a WebAuthn credential. */
267
+ credentialId?: string | undefined
268
+ /** Public key */
269
+ publicKey: Hex.Hex
270
+ }
271
+ | undefined
272
+ }
273
+ | undefined
274
+ request: RpcRequest.RpcRequest & { _internal?: unknown }
275
+ } & OneOf<
276
+ | {
277
+ status: 'pending'
278
+ }
279
+ | {
280
+ result: result
281
+ status: 'success'
282
+ }
283
+ | {
284
+ error: RpcResponse.ErrorObject
285
+ status: 'error'
286
+ }
287
+ >