react-native-pirate-wallet 0.2.1 → 0.3.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.
- package/README.md +20 -14
- package/package.json +5 -6
- package/react-native-pirate-wallet.podspec +10 -0
- package/test/smoke.js +9 -0
package/README.md
CHANGED
|
@@ -76,8 +76,8 @@ await sdk.configureAccountStorage({
|
|
|
76
76
|
- `scripts/`
|
|
77
77
|
- `src/`
|
|
78
78
|
|
|
79
|
-
|
|
80
|
-
|
|
79
|
+
Native libraries are distributed in exact-version Android ARM, Android x86_64,
|
|
80
|
+
iOS device, and iOS simulator companion packages.
|
|
81
81
|
|
|
82
82
|
## Preparing native artifacts in this repo
|
|
83
83
|
|
|
@@ -89,8 +89,8 @@ bash scripts/prepare-react-native-plugin.sh
|
|
|
89
89
|
|
|
90
90
|
That copies:
|
|
91
91
|
|
|
92
|
-
- Android JNI libraries into
|
|
93
|
-
-
|
|
92
|
+
- Android JNI libraries into the two Android companion packages
|
|
93
|
+
- iOS XCFramework slices into the two iOS companion packages
|
|
94
94
|
|
|
95
95
|
There is also a minimal consumer app in:
|
|
96
96
|
|
|
@@ -289,13 +289,18 @@ Receive-address APIs are shielded and wallet-scoped:
|
|
|
289
289
|
- returns generated external receive addresses
|
|
290
290
|
- `listAddressBalances(walletId, keyId?)`
|
|
291
291
|
- RPC: `list_address_balances`
|
|
292
|
-
- returns
|
|
292
|
+
- without `keyId`, returns external receive-address balance entries only
|
|
293
|
+
- with `keyId`, also returns internal change-address entries for that key group
|
|
293
294
|
|
|
294
295
|
These APIs return shielded receive addresses. Newly generated addresses use
|
|
295
|
-
Sapling before Ironwood activation and Ironwood after activation.
|
|
296
|
-
|
|
297
|
-
`listAddresses(walletId)` can contain both
|
|
298
|
-
|
|
296
|
+
Sapling before Ironwood activation and Ironwood after activation. At activation,
|
|
297
|
+
both current- and next-address calls select Ironwood; existing Sapling addresses
|
|
298
|
+
remain valid, so `listAddresses(walletId)` can contain both pools over time.
|
|
299
|
+
|
|
300
|
+
Internal change is always included in `getBalance(walletId)`. Do not sum an
|
|
301
|
+
unfiltered `listAddressBalances(walletId)` response to calculate the wallet
|
|
302
|
+
total, because its default external-only view intentionally omits internal
|
|
303
|
+
address rows.
|
|
299
304
|
|
|
300
305
|
- `getBalance(walletId)`
|
|
301
306
|
- RPC: `get_balance`
|
|
@@ -529,9 +534,10 @@ npm install react-native-pirate-wallet
|
|
|
529
534
|
cd ios && pod install
|
|
530
535
|
```
|
|
531
536
|
|
|
532
|
-
On Android, npm installs the exact-version
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
libraries to the build.
|
|
537
|
+
On Android, npm installs the exact-version ARM and x86_64 companions
|
|
538
|
+
automatically. The wrapper autolinks as a standard React Native native module
|
|
539
|
+
and adds their JNI libraries to the build.
|
|
536
540
|
|
|
537
|
-
On
|
|
541
|
+
On macOS, npm installs the exact-version device and simulator companions.
|
|
542
|
+
During `pod install`, the podspec assembles and links
|
|
543
|
+
`PirateWalletNative.xcframework` from those packages.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-native-pirate-wallet",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "React Native wrapper for the Pirate Unified Wallet native SDK surfaces",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react-native",
|
|
@@ -43,7 +43,6 @@
|
|
|
43
43
|
"test": "node test/smoke.js",
|
|
44
44
|
"verify:package": "node scripts/verify-package.js",
|
|
45
45
|
"prepare:native": "node scripts/assemble-ios-framework.js",
|
|
46
|
-
"postinstall": "npm run prepare:native",
|
|
47
46
|
"prepack": "node scripts/verify-package.js --publish-layout"
|
|
48
47
|
},
|
|
49
48
|
"engines": {
|
|
@@ -53,10 +52,10 @@
|
|
|
53
52
|
"react-native": ">=0.71.0 <1.0.0"
|
|
54
53
|
},
|
|
55
54
|
"optionalDependencies": {
|
|
56
|
-
"react-native-pirate-wallet-android": "0.
|
|
57
|
-
"react-native-pirate-wallet-android-x86_64": "0.
|
|
58
|
-
"react-native-pirate-wallet-ios-device": "0.
|
|
59
|
-
"react-native-pirate-wallet-ios-simulator": "0.
|
|
55
|
+
"react-native-pirate-wallet-android": "0.3.0",
|
|
56
|
+
"react-native-pirate-wallet-android-x86_64": "0.3.0",
|
|
57
|
+
"react-native-pirate-wallet-ios-device": "0.3.0",
|
|
58
|
+
"react-native-pirate-wallet-ios-simulator": "0.3.0"
|
|
60
59
|
},
|
|
61
60
|
"publishConfig": {
|
|
62
61
|
"access": "public"
|
|
@@ -2,6 +2,16 @@ require "json"
|
|
|
2
2
|
|
|
3
3
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
4
4
|
|
|
5
|
+
assembly_script = File.join(__dir__, "scripts", "assemble-ios-framework.js")
|
|
6
|
+
framework_path = File.join(__dir__, "ios", "Frameworks", "PirateWalletNative.xcframework")
|
|
7
|
+
|
|
8
|
+
# npm may block dependency lifecycle scripts, so assemble the split iOS binary
|
|
9
|
+
# packages when CocoaPods actually needs the framework.
|
|
10
|
+
Pod::Executable.execute_command("node", [assembly_script, "--force"])
|
|
11
|
+
unless File.directory?(framework_path)
|
|
12
|
+
raise Pod::Informative, "PirateWalletNative.xcframework could not be assembled"
|
|
13
|
+
end
|
|
14
|
+
|
|
5
15
|
Pod::Spec.new do |s|
|
|
6
16
|
s.name = package["name"]
|
|
7
17
|
s.version = package["version"]
|
package/test/smoke.js
CHANGED
|
@@ -48,6 +48,12 @@ function createMockNativeModule() {
|
|
|
48
48
|
])
|
|
49
49
|
case 'get_active_wallet':
|
|
50
50
|
return ok('wallet-1')
|
|
51
|
+
case 'current_receive_address':
|
|
52
|
+
assert.strictEqual(request.wallet_id, 'wallet-1')
|
|
53
|
+
return ok('pirate1current')
|
|
54
|
+
case 'next_receive_address':
|
|
55
|
+
assert.strictEqual(request.wallet_id, 'wallet-1')
|
|
56
|
+
return ok('pirate1next')
|
|
51
57
|
case 'get_balance':
|
|
52
58
|
return ok({ total: '1000', spendable: '900', pending: '100' })
|
|
53
59
|
case 'format_amount':
|
|
@@ -158,6 +164,9 @@ async function main() {
|
|
|
158
164
|
const latestBirthdayHeight = await sdk.getLatestBirthdayHeight('wallet-1')
|
|
159
165
|
assert.strictEqual(latestBirthdayHeight, 345678)
|
|
160
166
|
|
|
167
|
+
assert.strictEqual(await sdk.getCurrentAddress('wallet-1'), 'pirate1current')
|
|
168
|
+
assert.strictEqual(await sdk.getNextAddress('wallet-1'), 'pirate1next')
|
|
169
|
+
|
|
161
170
|
const groups = await sdk.advancedKeyManagement.listKeyGroups('wallet-1')
|
|
162
171
|
assert.strictEqual(groups.length, 1)
|
|
163
172
|
|