react-native-rgb 0.2.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/LICENSE +20 -0
- package/README.md +165 -0
- package/Rgb.podspec +23 -0
- package/android/build.gradle +80 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/java/com/rgb/AppConstants.kt +57 -0
- package/android/src/main/java/com/rgb/RgbModule.kt +1959 -0
- package/android/src/main/java/com/rgb/RgbPackage.kt +33 -0
- package/android/src/main/java/com/rgb/WalletStore.kt +49 -0
- package/ios/AppConstants.swift +71 -0
- package/ios/Rgb.h +5 -0
- package/ios/Rgb.mm +1740 -0
- package/ios/Rgb.swift +1916 -0
- package/ios/RgbLib.swift +7615 -0
- package/ios/WalletStore.swift +61 -0
- package/lib/module/Interfaces.js +65 -0
- package/lib/module/Interfaces.js.map +1 -0
- package/lib/module/NativeRgb.js +5 -0
- package/lib/module/NativeRgb.js.map +1 -0
- package/lib/module/RgbError.js +65 -0
- package/lib/module/RgbError.js.map +1 -0
- package/lib/module/Wallet.js +854 -0
- package/lib/module/Wallet.js.map +1 -0
- package/lib/module/index.js +39 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/package.json +1 -0
- package/lib/typescript/package.json +1 -0
- package/lib/typescript/src/Interfaces.d.ts +390 -0
- package/lib/typescript/src/Interfaces.d.ts.map +1 -0
- package/lib/typescript/src/NativeRgb.d.ts +417 -0
- package/lib/typescript/src/NativeRgb.d.ts.map +1 -0
- package/lib/typescript/src/RgbError.d.ts +28 -0
- package/lib/typescript/src/RgbError.d.ts.map +1 -0
- package/lib/typescript/src/Wallet.d.ts +648 -0
- package/lib/typescript/src/Wallet.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +28 -0
- package/lib/typescript/src/index.d.ts.map +1 -0
- package/package.json +174 -0
- package/src/Interfaces.ts +376 -0
- package/src/NativeRgb.ts +630 -0
- package/src/RgbError.ts +84 -0
- package/src/Wallet.ts +1118 -0
- package/src/index.tsx +46 -0
package/src/index.tsx
ADDED
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import Rgb from './NativeRgb';
|
|
2
|
+
import * as Interfaces from './Interfaces';
|
|
3
|
+
import { Wallet } from './Wallet';
|
|
4
|
+
|
|
5
|
+
export * from './Interfaces';
|
|
6
|
+
export * from './Wallet';
|
|
7
|
+
export * from './RgbError';
|
|
8
|
+
|
|
9
|
+
export { Interfaces, Wallet };
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Generates new keys for a wallet.
|
|
13
|
+
* @param bitcoinNetwork - The Bitcoin network to use (MAINNET, TESTNET, TESTNET4, REGTEST, SIGNET)
|
|
14
|
+
* @returns Promise resolving to Keys containing mnemonic, xpub, accountXpubVanilla, accountXpubColored, and masterFingerprint
|
|
15
|
+
* @throws {RgbError} Throws RgbError with a code from {@link RgbLibErrors} if:
|
|
16
|
+
* - Invalid Bitcoin network
|
|
17
|
+
* - Key generation fails
|
|
18
|
+
*/
|
|
19
|
+
export async function generateKeys(
|
|
20
|
+
bitcoinNetwork: Interfaces.BitcoinNetwork
|
|
21
|
+
): Promise<Interfaces.Keys> {
|
|
22
|
+
return Rgb.generateKeys(bitcoinNetwork);
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* Restores a wallet from a mnemonic.
|
|
27
|
+
* @param bitcoinNetwork - The Bitcoin network to use (MAINNET, TESTNET, TESTNET4, REGTEST, SIGNET)
|
|
28
|
+
* @param mnemonic - The mnemonic to restore the wallet from
|
|
29
|
+
* @returns Promise resolving to Keys containing mnemonic, xpub, accountXpubVanilla, accountXpubColored, and masterFingerprint
|
|
30
|
+
* @throws {RgbError} Throws RgbError with a code from {@link RgbLibErrors} if:
|
|
31
|
+
* - Invalid Bitcoin network
|
|
32
|
+
* - Invalid mnemonic
|
|
33
|
+
* - Key restoration fails
|
|
34
|
+
*/
|
|
35
|
+
export async function restoreKeys(
|
|
36
|
+
bitcoinNetwork: Interfaces.BitcoinNetwork,
|
|
37
|
+
mnemonic: string
|
|
38
|
+
): Promise<Interfaces.Keys> {
|
|
39
|
+
return Rgb.restoreKeys(bitcoinNetwork, mnemonic);
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
export async function decodeInvoice(
|
|
43
|
+
invoice: string
|
|
44
|
+
): Promise<Interfaces.InvoiceData> {
|
|
45
|
+
return Rgb.decodeInvoice(invoice) as Promise<Interfaces.InvoiceData>;
|
|
46
|
+
}
|