@idosgames/wallet 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1 @@
1
+ import {r,b,q,l,k,s,c,u,t,v}from'../chunk-Q6C5EFPV.js';import {http,createConfig,WagmiProvider,useAccount,usePublicClient,useWalletClient}from'wagmi';import {injected,coinbaseWallet,walletConnect}from'wagmi/connectors';import {QueryClient,QueryClientProvider}from'@tanstack/react-query';import {useState}from'react';import {jsx}from'react/jsx-runtime';import {ConnectionProvider,WalletProvider,useWallet}from'@solana/wallet-adapter-react';function I(o){let{chains:r,walletConnectProjectId:e,appName:t,appUrl:n,appIcon:a,transports:i,connectors:l}=o,m=t||n?{name:t??"iDosGames",description:t??"iDosGames game",url:n??"",icons:a?[a]:[]}:void 0,E=l??[injected(),coinbaseWallet({appName:t??"iDosGames"}),...e?[walletConnect({projectId:e,metadata:m,showQrModal:true})]:[]],c={};for(let g of r)c[g.id]=i?.[g.id]??http();return createConfig({chains:r,connectors:E,transports:c})}function F(o){let{wagmiConfig:r,queryClient:e,children:t}=o,[n]=useState(()=>e??new QueryClient);return jsx(WagmiProvider,{config:r,children:jsx(QueryClientProvider,{client:n,children:t})})}function y(){let{address:o}=useAccount(),r=usePublicClient(),{data:e}=useWalletClient();return !o||!r||!e?null:{account:o,publicClient:r,walletClient:e}}var d="Wallet not connected.";function j(o,r$1){let e=y();return {connected:!!e,account:e?.account??null,loginWithWallet:(t,n)=>e?s({client:o,clients:e,networkID:t,walletAddress:n}):Promise.resolve(c("challenge",d)),depositToken:t=>e?k({client:o,clients:e,titleID:r$1,...t}):Promise.resolve(b("approve",d)),depositNft:t=>e?l({client:o,clients:e,titleID:r$1,...t}):Promise.resolve(b("deposit-onchain",d)),withdrawToken:t=>e?q({client:o,clients:e,...t}):Promise.resolve(b("withdraw-onchain",d)),withdrawNft:t=>e?r({client:o,clients:e,...t}):Promise.resolve(b("withdraw-onchain",d))}}function _(o){let{endpoint:r,wallets:e,autoConnect:t=true,children:n}=o;return jsx(ConnectionProvider,{endpoint:r,children:jsx(WalletProvider,{wallets:e,autoConnect:t,children:n})})}var D="Wallet not connected.";function z(o,r,e){let{publicKey:t$1,signMessage:n}=useWallet(),a=t$1?.toBase58()??null;return {connected:!!a,account:a,loginWithWallet:(i,l)=>{let m=l??a;return m?n?v({client:o,networkID:i,walletAddress:m,signMessage:n}):Promise.resolve(c("sign","The connected wallet does not support message signing.")):Promise.resolve(c("challenge",D))},depositToken:i=>t({client:o,adapter:e,titleID:r,...i}),withdrawToken:i=>{let l=i.walletAddress??a;return l?u({client:o,adapter:e,...i,walletAddress:l}):Promise.resolve(b("request",D))}}}export{F as IDosGamesWalletProvider,_ as SolanaWalletBridgeProvider,I as createEvmWalletConfig,j as useEvmBridge,y as useEvmBridgeClients,z as useSolanaBridge};
package/package.json ADDED
@@ -0,0 +1,94 @@
1
+ {
2
+ "name": "@idosgames/wallet",
3
+ "version": "0.1.0",
4
+ "description": "Wallet-bridge companion to @idosgames/core: connect browser & mobile wallets (EVM via wagmi/viem/WalletConnect, Solana via wallet-adapter) and move tokens/NFTs in and out of the game through client.blockchain.",
5
+ "type": "module",
6
+ "license": "MIT",
7
+ "author": "iDos Games",
8
+ "homepage": "https://github.com/iDos-Games/iDosGamesSDK_TS#readme",
9
+ "repository": {
10
+ "type": "git",
11
+ "url": "git+https://github.com/iDos-Games/iDosGamesSDK_TS.git",
12
+ "directory": "packages/wallet"
13
+ },
14
+ "bugs": {
15
+ "url": "https://github.com/iDos-Games/iDosGamesSDK_TS/issues"
16
+ },
17
+ "keywords": [
18
+ "idosgames",
19
+ "sdk",
20
+ "web3",
21
+ "wallet",
22
+ "wagmi",
23
+ "viem",
24
+ "walletconnect",
25
+ "solana",
26
+ "evm"
27
+ ],
28
+ "publishConfig": {
29
+ "access": "public"
30
+ },
31
+ "sideEffects": false,
32
+ "main": "./dist/index.cjs",
33
+ "module": "./dist/index.js",
34
+ "types": "./dist/index.d.ts",
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "import": "./dist/index.js",
39
+ "require": "./dist/index.cjs"
40
+ },
41
+ "./react": {
42
+ "types": "./dist/react/index.d.ts",
43
+ "import": "./dist/react/index.js",
44
+ "require": "./dist/react/index.cjs"
45
+ }
46
+ },
47
+ "files": [
48
+ "dist",
49
+ "README.md",
50
+ "LICENSE"
51
+ ],
52
+ "scripts": {
53
+ "build": "tsup",
54
+ "typecheck": "tsc --noEmit -p tsconfig.json"
55
+ },
56
+ "//": "@idosgames/core не '*': опубликованный пакет обязан назвать диапазон, иначе установка wallet притянет любую версию core, включая будущую ломающую. На 0.x '^' даёт >=0.1.0 <0.2.0 — ровно ту зону, где core обещает совместимость (см. RELEASING.md). Поднимать при мажорном/минорном бампе core.",
57
+ "dependencies": {
58
+ "@idosgames/core": "^0.1.0",
59
+ "@solana/web3.js": "^1.95.0",
60
+ "viem": "^2.21.0"
61
+ },
62
+ "peerDependencies": {
63
+ "@solana/wallet-adapter-base": "^0.9.23",
64
+ "@solana/wallet-adapter-react": "^0.15.35",
65
+ "@tanstack/react-query": "^5.59.0",
66
+ "react": "^18.3.1",
67
+ "wagmi": "^2.12.0"
68
+ },
69
+ "peerDependenciesMeta": {
70
+ "react": {
71
+ "optional": true
72
+ },
73
+ "wagmi": {
74
+ "optional": true
75
+ },
76
+ "@tanstack/react-query": {
77
+ "optional": true
78
+ },
79
+ "@solana/wallet-adapter-base": {
80
+ "optional": true
81
+ },
82
+ "@solana/wallet-adapter-react": {
83
+ "optional": true
84
+ }
85
+ },
86
+ "devDependencies": {
87
+ "@solana/wallet-adapter-base": "^0.9.23",
88
+ "@solana/wallet-adapter-react": "^0.15.35",
89
+ "@tanstack/react-query": "^5.59.0",
90
+ "@types/react": "^18.3.12",
91
+ "react": "^18.3.1",
92
+ "wagmi": "^2.12.0"
93
+ }
94
+ }