Skip to content

Commit 6fc66d4

Browse files
committed
Update README.md.(#17)
1 parent cae1acb commit 6fc66d4

7 files changed

Lines changed: 106 additions & 24 deletions

File tree

docs/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ Add the following configuration to `AndroidManifest.xml`:
3939
android:value="GlobalConfig"/>
4040
</application>
4141
```
42+
4243
Call the following method in the `onCreate()` method of the `Application` class:
4344
```kotlin
4445
DoraFund.init(this, "App Name", "App Description", "https://yourdomain.com", arrayOf(
@@ -48,10 +49,21 @@ DoraFund.init(this, "App Name", "App Description", "https://yourdomain.com", arr
4849
EVMChains.AVALANCHE // Support Avalanche C-Chain
4950
))
5051
```
51-
Establish a connection with the cold wallet in an `Activity`:
52+
53+
Connect Wallet from an Activity
54+
```kotlin
55+
DoraFund.connectWallet(this, requestCode)
56+
```
57+
Then, override the onActivityResult method.
58+
59+
Connect Wallet from a Fragment
5260
```kotlin
53-
DoraFund.connectWallet(this)
61+
DoraFund.prepareConnectWallet(fragment, intArrayOf(requestCode), callback)
5462
```
63+
```kotlin
64+
DoraFund.connectWallet(requestCode)
65+
```
66+
5567
(Optional) If only a single `Activity` handles payments, you can set a cold wallet payment listener in that `Activity`. If `PayListener` is registered in the `init()` method of the `Application`, you can send messages in the callback to notify the processing interface.
5668
```kotlin
5769
DoraFund.setPayListener(object : DoraFund.PayListener {
@@ -64,6 +76,7 @@ DoraFund.setPayListener(object : DoraFund.PayListener {
6476
}
6577
})
6678
```
79+
6780
Construct order data to proceed with the payment:
6881
```kotlin
6982
DoraFund.pay(this,
@@ -80,6 +93,7 @@ DoraFund.pay(this,
8093
}
8194
})
8295
```
96+
8397
Query the order payment status:
8498
```kotlin
8599
// Query the transaction of the currently selected chain
@@ -91,6 +105,7 @@ PayUtils.queryTransaction("Fill in the transaction hash of this order", PayUtils
91105
// Query the transaction on the Arbitrum mainnet
92106
PayUtils.queryTransaction("Fill in the transaction hash of this order", PayUtils.DEFAULT_RPC_ARBITRUM)
93107
```
108+
94109
Add proguard rules:
95110
```pro
96111
-keep class org.json.JSONObject { *; }

docs/es/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Añade la siguiente configuración en `AndroidManifest.xml`:
3838
android:value="GlobalConfig"/>
3939
</application>
4040
```
41+
4142
En el método `onCreate()` de la clase `Application`, llama al siguiente método:
4243
```kotlin
4344
DoraFund.init(this, "App Name", "App Description", "https://yourdomain.com", arrayOf(
@@ -47,10 +48,21 @@ DoraFund.init(this, "App Name", "App Description", "https://yourdomain.com", arr
4748
EVMChains.AVALANCHE // Compatible con Avalanche C-Chain
4849
))
4950
```
50-
Establece la conexión con la billetera fría en una `Activity`:
51+
52+
Conexión de la cartera desde un Activity
53+
```kotlin
54+
DoraFund.connectWallet(this, requestCode)
55+
```
56+
Luego, sobrescribe el método onActivityResult.
57+
58+
Conexión de la cartera desde un Fragment
5159
```kotlin
52-
DoraFund.connectWallet(this)
60+
DoraFund.prepareConnectWallet(fragment, intArrayOf(requestCode), callback)
5361
```
62+
```kotlin
63+
DoraFund.connectWallet(requestCode)
64+
```
65+
5466
(Opcional) Si solo una `Activity` maneja los pagos, puedes configurar un oyente de pago de billetera fría en esa `Activity`. Si `PayListener` está registrado en el método `init()` de `Application`, puedes enviar mensajes dentro del callback para notificar a la interfaz de procesamiento.
5567
```kotlin
5668
DoraFund.setPayListener(object : DoraFund.PayListener {
@@ -63,6 +75,7 @@ DoraFund.setPayListener(object : DoraFund.PayListener {
6375
}
6476
})
6577
```
78+
6679
Construye los datos de la orden y procede con el pago:
6780
```kotlin
6881
DoraFund.pay(this,
@@ -79,6 +92,7 @@ DoraFund.pay(this,
7992
}
8093
})
8194
```
95+
8296
Consulta el estado del pago de la orden:
8397
```kotlin
8498
// Consultar la transacción de la cadena seleccionada actualmente
@@ -90,6 +104,7 @@ PayUtils.queryTransaction("Rellena el hash de la transacción de este pedido", P
90104
// Consultar la transacción en la red principal de Arbitrum
91105
PayUtils.queryTransaction("Rellena el hash de la transacción de este pedido", PayUtils.DEFAULT_RPC_ARBITRUM)
92106
```
107+
93108
Agregar reglas de ofuscación:
94109
```pro
95110
-keep class org.json.JSONObject { *; }

docs/fr/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ Ajoutez la configuration suivante dans `AndroidManifest.xml` :
3838
android:value="GlobalConfig"/>
3939
</application>
4040
```
41+
4142
Dans la méthode `onCreate()` de la classe `Application`, appelez la méthode suivante :
4243
```kotlin
4344
DoraFund.init(this, "App Name", "App Description", "https://yourdomain.com", arrayOf(
@@ -47,10 +48,21 @@ DoraFund.init(this, "App Name", "App Description", "https://yourdomain.com", arr
4748
EVMChains.AVALANCHE // Prend en charge Avalanche C-Chain
4849
))
4950
```
50-
Établissez une connexion avec le portefeuille froid dans une `Activity` :
51+
52+
Connexion du portefeuille depuis une Activity
53+
```kotlin
54+
DoraFund.connectWallet(this, requestCode)
55+
```
56+
Ensuite, redéfinissez la méthode onActivityResult.
57+
58+
Connexion du portefeuille depuis un Fragment
5159
```kotlin
52-
DoraFund.connectWallet(this)
60+
DoraFund.prepareConnectWallet(fragment, intArrayOf(requestCode), callback)
5361
```
62+
```kotlin
63+
DoraFund.connectWallet(requestCode)
64+
```
65+
5466
(Facultatif) Si une seule `Activity` gère les paiements, vous pouvez configurer un écouteur de paiement pour le portefeuille froid dans cette `Activity`. Si `PayListener` est enregistré dans la méthode `init()` de `Application`, vous pouvez envoyer des messages via le rappel pour notifier l'interface de traitement.
5567
```kotlin
5668
DoraFund.setPayListener(object : DoraFund.PayListener {
@@ -63,6 +75,7 @@ DoraFund.setPayListener(object : DoraFund.PayListener {
6375
}
6476
})
6577
```
78+
6679
Créez les données de commande et procédez au paiement :
6780
```kotlin
6881
DoraFund.pay(this,
@@ -79,6 +92,7 @@ DoraFund.pay(this,
7992
}
8093
})
8194
```
95+
8296
Interrogez l'état du paiement de la commande :
8397
```kotlin
8498
// Rechercher la transaction de la chaîne actuellement sélectionnée
@@ -90,6 +104,7 @@ PayUtils.queryTransaction("Remplissez le hachage de la transaction de cette comm
90104
// Rechercher la transaction sur le réseau principal Arbitrum
91105
PayUtils.queryTransaction("Remplissez le hachage de la transaction de cette commande", PayUtils.DEFAULT_RPC_ARBITRUM)
92106
```
107+
93108
Ajouter des règles Proguard :
94109
```pro
95110
-keep class org.json.JSONObject { *; }

docs/ko/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ minSdk = 24
3838
android:value="GlobalConfig"/>
3939
</application>
4040
```
41+
4142
`Application` 클래스의 `onCreate()` 메서드에서 다음 메서드를 호출하세요:
4243
```kotlin
4344
DoraFund.init(this, "App Name", "App Description", "https://yourdomain.com", arrayOf(
@@ -47,10 +48,21 @@ DoraFund.init(this, "App Name", "App Description", "https://yourdomain.com", arr
4748
EVMChains.AVALANCHE // 아발란체 C-체인 지원
4849
))
4950
```
50-
`Activity`에서 콜드월렛과 연결을 설정하세요:
51+
52+
Activity에서 지갑 연결
53+
```kotlin
54+
DoraFund.connectWallet(this, requestCode)
55+
```
56+
그런 다음 onActivityResult 메서드를 재정의합니다.
57+
58+
Fragment에서 지갑 연결
5159
```kotlin
52-
DoraFund.connectWallet(this)
60+
DoraFund.prepareConnectWallet(fragment, intArrayOf(requestCode), callback)
5361
```
62+
```kotlin
63+
DoraFund.connectWallet(requestCode)
64+
```
65+
5466
(선택 사항) 단일 `Activity`에서만 결제를 처리하는 경우, 해당 `Activity`에서 콜드월렛 결제 리스너를 설정할 수 있습니다. 만약 `Application``init()` 메서드에서 `PayListener`를 등록하면, 콜백에서 메시지를 전송하여 처리 인터페이스에 알릴 수 있습니다.
5567
```kotlin
5668
DoraFund.setPayListener(object : DoraFund.PayListener {
@@ -63,6 +75,7 @@ DoraFund.setPayListener(object : DoraFund.PayListener {
6375
}
6476
})
6577
```
78+
6679
주문 데이터를 생성하고 결제를 진행하세요:
6780
```kotlin
6881
DoraFund.pay(this,
@@ -79,6 +92,7 @@ DoraFund.pay(this,
7992
}
8093
})
8194
```
95+
8296
주문 결제 상태를 조회하세요:
8397
```kotlin
8498
// 현재 선택된 체인의 거래 조회
@@ -90,6 +104,7 @@ PayUtils.queryTransaction("이 주문의 거래 해시를 입력하세요", PayU
90104
// Arbitrum 메인넷의 거래 조회
91105
PayUtils.queryTransaction("이 주문의 거래 해시를 입력하세요", PayUtils.DEFAULT_RPC_ARBITRUM)
92106
```
107+
93108
프로가드 규칙 추가:
94109
```pro
95110
-keep class org.json.JSONObject { *; }

docs/zh-cn/README.md

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ minSdk = 24
3939
android:value="GlobalConfig"/>
4040
</application>
4141
```
42+
4243
在Application类的onCreate()中调用。
4344
```kotlin
4445
DoraFund.init(this, "App Name", "App Description", "https://yourdomain.com", arrayOf(
@@ -48,10 +49,21 @@ DoraFund.init(this, "App Name", "App Description", "https://yourdomain.com", arr
4849
EVMChains.AVALANCHE // 支持Avalanche C-Chain
4950
))
5051
```
51-
在Activity中与冷钱包建立连接。
52+
53+
Activity 连接钱包
54+
```kotlin
55+
DoraFund.connectWallet(this, requestCode)
56+
```
57+
然后重写onActivityResult方法。
58+
59+
Fragment 连接钱包
60+
```kotlin
61+
DoraFund.prepareConnectWallet(fragment, intArrayOf(requestCode), callback)
62+
```
5263
```kotlin
53-
DoraFund.connectWallet(this)
64+
DoraFund.connectWallet(requestCode)
5465
```
66+
5567
(非必须)如果只有一个Activity进行支付,可在Activity中设置冷钱包支付的监听器。如果PayListener在Application的
5668
init()中注册,则在回调处发送消息给处理界面。
5769
```kotlin
@@ -65,6 +77,7 @@ DoraFund.setPayListener(object : DoraFund.PayListener {
6577
}
6678
})
6779
```
80+
6881
构建订单数据进行支付。
6982
```kotlin
7083
DoraFund.pay(this,
@@ -81,8 +94,8 @@ DoraFund.pay(this,
8194
}
8295
})
8396
```
84-
查询订单支付情况。
8597

98+
查询订单支付情况。
8699
```kotlin
87100
// 查询当前选中链的交易
88101
PayUtils.queryTransaction("填写该笔订单的交易哈希")
@@ -93,6 +106,7 @@ PayUtils.queryTransaction("填写该笔订单的交易哈希", PayUtils.DEFAULT_
93106
// 查询Arbitrum主网的交易
94107
PayUtils.queryTransaction("填写该笔订单的交易哈希", PayUtils.DEFAULT_RPC_ARBITRUM)
95108
```
109+
96110
添加混淆规则。
97111
```pro
98112
-keep class org.json.JSONObject { *; }

docs/zh-tw/README.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ minSdk = 24
3838
android:value="GlobalConfig"/>
3939
</application>
4040
```
41+
4142
`Application` 類的 `onCreate()` 方法中調用以下方法:
4243
```kotlin
4344
DoraFund.init(this, "App Name", "App Description", "https://yourdomain.com", arrayOf(
@@ -47,10 +48,21 @@ DoraFund.init(this, "App Name", "App Description", "https://yourdomain.com", arr
4748
EVMChains.AVALANCHE // 支援Avalanche C-Chain
4849
))
4950
```
50-
`Activity` 中與冷錢包建立連接:
51+
52+
Activity 連接錢包
53+
```kotlin
54+
DoraFund.connectWallet(this, requestCode)
55+
```
56+
然後重寫 onActivityResult 方法。
57+
58+
Fragment 連接錢包
5159
```kotlin
52-
DoraFund.connectWallet(this)
60+
DoraFund.prepareConnectWallet(fragment, intArrayOf(requestCode), callback)
5361
```
62+
```kotlin
63+
DoraFund.connectWallet(requestCode)
64+
```
65+
5466
(選填) 若僅有單個 `Activity` 負責處理支付,可以在該 `Activity` 設置冷錢包支付監聽器。若在 `Application``init()` 方法中註冊了 `PayListener`,則可在回調中發送訊息通知處理介面。
5567
```kotlin
5668
DoraFund.setPayListener(object : DoraFund.PayListener {
@@ -63,6 +75,7 @@ DoraFund.setPayListener(object : DoraFund.PayListener {
6375
}
6476
})
6577
```
78+
6679
構造訂單數據並執行支付:
6780
```kotlin
6881
DoraFund.pay(this,
@@ -79,6 +92,7 @@ DoraFund.pay(this,
7992
}
8093
})
8194
```
95+
8296
查詢訂單支付狀態:
8397
```kotlin
8498
// 查詢當前選中鏈的交易
@@ -90,6 +104,7 @@ PayUtils.queryTransaction("填寫該筆訂單的交易哈希", PayUtils.DEFAULT_
90104
// 查詢Arbitrum主網的交易
91105
PayUtils.queryTransaction("填寫該筆訂單的交易哈希", PayUtils.DEFAULT_RPC_ARBITRUM)
92106
```
107+
93108
添加混淆規則:
94109
```pro
95110
-keep class org.json.JSONObject { *; }

lib/src/main/java/dora/pay/DoraFund.kt

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -159,13 +159,6 @@ object DoraFund {
159159
* Each entry in the map is keyed by an integer request code, allowing the
160160
* Fragment to manage multiple wallet connection launchers simultaneously.
161161
*
162-
* The generic type {@code Int} represents the input parameter passed to the
163-
* {@link WalletContract}, typically used as a request code.
164-
*
165-
* All launchers must be registered before the Fragment is fully created
166-
* (e.g., during {@code onCreate()}), otherwise an {@link IllegalStateException}
167-
* may be thrown.
168-
*
169162
* @since 2.1
170163
*/
171164
private val connectWalletLaunchers = mutableMapOf<Int, ActivityResultLauncher<Unit>>()
@@ -346,11 +339,11 @@ object DoraFund {
346339
}
347340

348341
/**
349-
* Launches the cold wallet connection flow for the specified request code.
342+
* Launches the cold wallet connection flow for the specified request code from a Fragment.
350343
*
351-
* This method retrieves the pre-registered {@link ActivityResultLauncher}
352-
* corresponding to the given request code from {@code connectWalletLaunchers},
353-
* and starts the wallet connection process.
344+
* This method is intended for use within a {@link Fragment} and retrieves the
345+
* pre-registered {@link ActivityResultLauncher} corresponding to the given request code
346+
* from {@code connectWalletLaunchers}, then starts the wallet connection process.
354347
*
355348
* Each request code represents a distinct wallet connection scenario,
356349
* such as login, payment, or authorization.

0 commit comments

Comments
 (0)