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.
Files changed (44) hide show
  1. package/LICENSE +20 -0
  2. package/README.md +165 -0
  3. package/Rgb.podspec +23 -0
  4. package/android/build.gradle +80 -0
  5. package/android/gradle.properties +5 -0
  6. package/android/src/main/AndroidManifest.xml +2 -0
  7. package/android/src/main/java/com/rgb/AppConstants.kt +57 -0
  8. package/android/src/main/java/com/rgb/RgbModule.kt +1959 -0
  9. package/android/src/main/java/com/rgb/RgbPackage.kt +33 -0
  10. package/android/src/main/java/com/rgb/WalletStore.kt +49 -0
  11. package/ios/AppConstants.swift +71 -0
  12. package/ios/Rgb.h +5 -0
  13. package/ios/Rgb.mm +1740 -0
  14. package/ios/Rgb.swift +1916 -0
  15. package/ios/RgbLib.swift +7615 -0
  16. package/ios/WalletStore.swift +61 -0
  17. package/lib/module/Interfaces.js +65 -0
  18. package/lib/module/Interfaces.js.map +1 -0
  19. package/lib/module/NativeRgb.js +5 -0
  20. package/lib/module/NativeRgb.js.map +1 -0
  21. package/lib/module/RgbError.js +65 -0
  22. package/lib/module/RgbError.js.map +1 -0
  23. package/lib/module/Wallet.js +854 -0
  24. package/lib/module/Wallet.js.map +1 -0
  25. package/lib/module/index.js +39 -0
  26. package/lib/module/index.js.map +1 -0
  27. package/lib/module/package.json +1 -0
  28. package/lib/typescript/package.json +1 -0
  29. package/lib/typescript/src/Interfaces.d.ts +390 -0
  30. package/lib/typescript/src/Interfaces.d.ts.map +1 -0
  31. package/lib/typescript/src/NativeRgb.d.ts +417 -0
  32. package/lib/typescript/src/NativeRgb.d.ts.map +1 -0
  33. package/lib/typescript/src/RgbError.d.ts +28 -0
  34. package/lib/typescript/src/RgbError.d.ts.map +1 -0
  35. package/lib/typescript/src/Wallet.d.ts +648 -0
  36. package/lib/typescript/src/Wallet.d.ts.map +1 -0
  37. package/lib/typescript/src/index.d.ts +28 -0
  38. package/lib/typescript/src/index.d.ts.map +1 -0
  39. package/package.json +174 -0
  40. package/src/Interfaces.ts +376 -0
  41. package/src/NativeRgb.ts +630 -0
  42. package/src/RgbError.ts +84 -0
  43. package/src/Wallet.ts +1118 -0
  44. 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
+ }