Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/dora4/dora-walletconnect-support
集成朵拉支付,让app可以调用用户冷钱包购买虚拟商品(开发中)。https://youtube.com/shorts/he3vj4eJERk
https://github.com/dora4/dora-walletconnect-support
blockchain cryptocurrency doratrade ethereum walletconnect web3 web3pay
Last synced: 19 days ago
JSON representation
集成朵拉支付,让app可以调用用户冷钱包购买虚拟商品(开发中)。https://youtube.com/shorts/he3vj4eJERk
- Host: GitHub
- URL: https://github.com/dora4/dora-walletconnect-support
- Owner: dora4
- License: apache-2.0
- Created: 2024-11-04T07:25:37.000Z (3 months ago)
- Default Branch: main
- Last Pushed: 2025-01-07T18:39:04.000Z (about 1 month ago)
- Last Synced: 2025-01-07T19:50:51.244Z (about 1 month ago)
- Topics: blockchain, cryptocurrency, doratrade, ethereum, walletconnect, web3, web3pay
- Language: Kotlin
- Homepage: https://dorachat.com/payment.html
- Size: 439 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
dora-walletconnect-support
![Release](https://jitpack.io/v/dora4/dora-walletconnect-support.svg)
--------------------------------#### Gradle依赖配置
添加以下代码到项目根目录下的settings.gradle.kts
```kotlin
dependencyResolutionManagement {
repositories {
maven { setUrl("https://jitpack.io") }
}
}
```
添加以下代码到app模块的build.gradle.kts
```kotlin
dependencies {
// 扩展包必须在有主框架dora的情况下使用
implementation("com.github.dora4:dora:1.2.36")
implementation("com.github.dora4:dview-alert-dialog:1.18")
implementation("com.github.dora4:dora-walletconnect-support:1.1")
}
```#### 使用方式
在AndroidManifest中加入配置。
```xml
```
在Application类的onCreate()中调用。
```kotlin
// 通过chainId指定支持的以太坊兼容链
val chains = arrayOf(
Web3ModalChainsPresets.ethChains["1"], // 支持Ethereum
Web3ModalChainsPresets.ethChains["137"], // 支持Polygon
Web3ModalChainsPresets.ethChains["42161"] // 支持Arbitrum
)
DoraTrade.init(this, "App Name", "App Description", "https://yourdomain.com", chains)
```
与冷钱包建立连接。
```kotlin
DoraTrade.connectWallet()
```
在Activity中设置支付结果监听器,请提示用户不要关闭界面,等待支付完成,否则无法发货。如果PayListener在Application的
init()中注册,则在回调处发送消息给处理界面。
```kotlin
DoraTrade.setPayListener(object : DoraTrade.PayListener {
override fun onPaySuccess() {
// 支付成功,在此发货商品
}override fun onPayFailure() {
// 支付失败,一般为点了冷钱包的取消发送
}
})
```
构建订单数据进行支付。
```kotlin
DoraTrade.pay("填写朵拉支付的accessKey",
"填写订单信息,便于框架给你弹窗,以让用户知晓正在支付",
"填写商品详细描述,便于框架给你弹窗,以让用户知晓正在支付",
"填写收款方的钱包地址",
"填写发送代币数量")
```
另外,请录制支付教程给用户看确实能发货。被用户举报诈骗,一经核实,则永久封禁accessKey。