diff --git a/.vscode/launch.json b/.vscode/launch.json new file mode 100644 index 0000000..5beac0a --- /dev/null +++ b/.vscode/launch.json @@ -0,0 +1,17 @@ +{ + "version": "0.2.0", + "configurations": [ + { + "name": "Debug WalletMan Server", + "type": "go", + "request": "launch", + "mode": "debug", + "program": "${workspaceFolder}/servers/walletman/cmd/server", + "cwd": "${workspaceFolder}/servers/walletman", + "preLaunchTask": "build walletman", + "env": { + "PATH": "/Users/hybro/go/bin:${env:PATH}" + } + } + ] +} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 0000000..669e959 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,8 @@ +{ + "go.toolsEnvVars": { + "PATH": "/Users/hybro/go/bin:/usr/local/go/bin:${env:PATH}" + }, + "go.alternateTools": { + "dlv": "/Users/hybro/go/bin/dlv" + } +} diff --git a/.vscode/tasks.json b/.vscode/tasks.json new file mode 100644 index 0000000..aafad26 --- /dev/null +++ b/.vscode/tasks.json @@ -0,0 +1,26 @@ +{ + "version": "2.0.0", + "tasks": [ + { + "label": "build walletman", + "type": "shell", + "command": "go", + "args": [ + "build", + "-o", + "${workspaceFolder}/servers/walletman/bin/server", + "./cmd/server" + ], + "options": { + "cwd": "${workspaceFolder}/servers/walletman" + }, + "problemMatcher": [ + "$go" + ], + "group": { + "kind": "build", + "isDefault": true + } + } + ] +} diff --git a/package.json b/package.json index c4c26ac..9ac8612 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "react-native": "0.72.10", "react-native-fs": "^2.20.0", "react-native-webview": "13.6.2", - "rnwalletman": "./rnwalletman" + "rnwalletman": "./libs/rnwalletman" }, "devDependencies": { "@babel/core": "^7.20.0", diff --git a/rnwalletman/README.md b/rnwalletman/README.md deleted file mode 100644 index 5bc24bd..0000000 --- a/rnwalletman/README.md +++ /dev/null @@ -1,184 +0,0 @@ -# RN WalletMan - -纯 TypeScript 实现的 React Native 钱包绑定库。 - -## 安装 - -**重要:必须先安装 react-native-webview** - -```bash -# 1. 安装 react-native-webview(必需) -npm install react-native-webview -# 或 -yarn add react-native-webview - -# 2. iOS 需要 pod install -cd ios && pod install && cd .. - -# 3. 安装 rnwalletman -npm install ./rnwalletman -# 或 -yarn add ./rnwalletman -``` - - -# 使用示例 - -## 基础用法 - -```tsx -import { PaytmBind } from 'rnwalletman'; - - { - // result.type: 'paytm_business' - // result.cookie: SESSION cookie - // result.xCsrfToken: CSRF token - // result.qrData: QR 数据(JSON) - - // 发送到服务端 - fetch('https://your-api.com/bind', { - method: 'POST', - body: JSON.stringify(result) - }); - }} - onError={(error) => { - Alert.alert('绑定失败', error); - }} -/> -``` - -## 完整示例 - -```tsx -import React, { useState } from 'react'; -import { View, Button, Modal } from 'react-native'; -import { PaytmBind, WalletType } from 'rnwalletman'; - -function App() { - const [showBind, setShowBind] = useState(false); - - return ( - -