@babylonlabs-io/wallet-connector 0.4.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 (127) hide show
  1. package/LICENSE +141 -0
  2. package/README.md +234 -0
  3. package/dist/components/ChainButton/index.d.ts +11 -0
  4. package/dist/components/Chains/container.d.ts +8 -0
  5. package/dist/components/Chains/index.d.ts +13 -0
  6. package/dist/components/Chains/index.stories.d.ts +6 -0
  7. package/dist/components/ConnectedWallet/index.d.ts +10 -0
  8. package/dist/components/Error/container.d.ts +5 -0
  9. package/dist/components/Error/index.d.ts +12 -0
  10. package/dist/components/FieldControl/index.d.ts +7 -0
  11. package/dist/components/Inscriptions/container.d.ts +6 -0
  12. package/dist/components/Inscriptions/index.d.ts +7 -0
  13. package/dist/components/Loader/index.d.ts +6 -0
  14. package/dist/components/ResponsiveDialog/ResponsiveDialog.d.ts +2 -0
  15. package/dist/components/TermsOfService/container.d.ts +6 -0
  16. package/dist/components/TermsOfService/index.d.ts +8 -0
  17. package/dist/components/WalletButton/index.d.ts +12 -0
  18. package/dist/components/WalletProvider/components/Screen.d.ts +17 -0
  19. package/dist/components/WalletProvider/components/WalletDialog.d.ts +6 -0
  20. package/dist/components/WalletProvider/constants.d.ts +2 -0
  21. package/dist/components/WalletProvider/index.d.ts +9 -0
  22. package/dist/components/WalletProvider/tesnet.d.ts +4 -0
  23. package/dist/components/Wallets/container.d.ts +11 -0
  24. package/dist/components/Wallets/index.d.ts +10 -0
  25. package/dist/context/Chain.context.d.ts +24 -0
  26. package/dist/context/Inscriptions.context.d.ts +12 -0
  27. package/dist/context/State.context.d.ts +42 -0
  28. package/dist/core/Wallet.d.ts +27 -0
  29. package/dist/core/WalletConnector.d.ts +23 -0
  30. package/dist/core/index.d.ts +6 -0
  31. package/dist/core/types.d.ts +214 -0
  32. package/dist/core/utils/bip322.d.ts +41 -0
  33. package/dist/core/utils/mempool.d.ts +10 -0
  34. package/dist/core/utils/wallet.d.ts +8 -0
  35. package/dist/core/wallets/bbn/index.d.ts +3 -0
  36. package/dist/core/wallets/bbn/injectable/index.d.ts +3 -0
  37. package/dist/core/wallets/bbn/keplr/index.d.ts +3 -0
  38. package/dist/core/wallets/bbn/keplr/provider.d.ts +22 -0
  39. package/dist/core/wallets/bbn/leap/index.d.ts +3 -0
  40. package/dist/core/wallets/bbn/leap/provider.d.ts +17 -0
  41. package/dist/core/wallets/bbn/okx/index.d.ts +3 -0
  42. package/dist/core/wallets/bbn/okx/provider.d.ts +17 -0
  43. package/dist/core/wallets/btc/index.d.ts +3 -0
  44. package/dist/core/wallets/btc/injectable/index.d.ts +3 -0
  45. package/dist/core/wallets/btc/keystone/index.d.ts +3 -0
  46. package/dist/core/wallets/btc/keystone/provider.d.ts +42 -0
  47. package/dist/core/wallets/btc/okx/index.d.ts +3 -0
  48. package/dist/core/wallets/btc/okx/provider.d.ts +21 -0
  49. package/dist/core/wallets/btc/onekey/index.d.ts +3 -0
  50. package/dist/core/wallets/btc/onekey/provider.d.ts +20 -0
  51. package/dist/core/wallets/btc/unisat/index.d.ts +3 -0
  52. package/dist/core/wallets/btc/unisat/provider.d.ts +21 -0
  53. package/dist/core/wallets/index.d.ts +5 -0
  54. package/dist/fonts/Px-Grotesk/Px-Grotesk-Black-Italic.otf +0 -0
  55. package/dist/fonts/Px-Grotesk/Px-Grotesk-Black-Italic.woff +0 -0
  56. package/dist/fonts/Px-Grotesk/Px-Grotesk-Black-Italic.woff2 +0 -0
  57. package/dist/fonts/Px-Grotesk/Px-Grotesk-Black.otf +0 -0
  58. package/dist/fonts/Px-Grotesk/Px-Grotesk-Black.woff +0 -0
  59. package/dist/fonts/Px-Grotesk/Px-Grotesk-Black.woff2 +0 -0
  60. package/dist/fonts/Px-Grotesk/Px-Grotesk-Bold-Italic.otf +0 -0
  61. package/dist/fonts/Px-Grotesk/Px-Grotesk-Bold-Italic.woff +0 -0
  62. package/dist/fonts/Px-Grotesk/Px-Grotesk-Bold-Italic.woff2 +0 -0
  63. package/dist/fonts/Px-Grotesk/Px-Grotesk-Bold.otf +0 -0
  64. package/dist/fonts/Px-Grotesk/Px-Grotesk-Bold.woff +0 -0
  65. package/dist/fonts/Px-Grotesk/Px-Grotesk-Bold.woff2 +0 -0
  66. package/dist/fonts/Px-Grotesk/Px-Grotesk-Italic.otf +0 -0
  67. package/dist/fonts/Px-Grotesk/Px-Grotesk-Italic.woff +0 -0
  68. package/dist/fonts/Px-Grotesk/Px-Grotesk-Italic.woff2 +0 -0
  69. package/dist/fonts/Px-Grotesk/Px-Grotesk-Light-Italic.otf +0 -0
  70. package/dist/fonts/Px-Grotesk/Px-Grotesk-Light-Italic.woff +0 -0
  71. package/dist/fonts/Px-Grotesk/Px-Grotesk-Light-Italic.woff2 +0 -0
  72. package/dist/fonts/Px-Grotesk/Px-Grotesk-Light.otf +0 -0
  73. package/dist/fonts/Px-Grotesk/Px-Grotesk-Light.woff +0 -0
  74. package/dist/fonts/Px-Grotesk/Px-Grotesk-Light.woff2 +0 -0
  75. package/dist/fonts/Px-Grotesk/Px-Grotesk-Regular.otf +0 -0
  76. package/dist/fonts/Px-Grotesk/Px-Grotesk-Regular.woff +0 -0
  77. package/dist/fonts/Px-Grotesk/Px-Grotesk-Regular.woff2 +0 -0
  78. package/dist/fonts/Px-Grotesk/Px-Grotesk-Screen.eot +0 -0
  79. package/dist/fonts/Px-Grotesk/Px-Grotesk-Screen.otf +0 -0
  80. package/dist/fonts/Px-Grotesk/Px-Grotesk-Screen.woff +0 -0
  81. package/dist/fonts/Px-Grotesk/Px-Grotesk-Screen.woff2 +0 -0
  82. package/dist/fonts/Px-Grotesk/Px-Grotesk-Thin-Italic.otf +0 -0
  83. package/dist/fonts/Px-Grotesk/Px-Grotesk-Thin-Italic.woff +0 -0
  84. package/dist/fonts/Px-Grotesk/Px-Grotesk-Thin-Italic.woff2 +0 -0
  85. package/dist/fonts/Px-Grotesk/Px-Grotesk-Thin.otf +0 -0
  86. package/dist/fonts/Px-Grotesk/Px-Grotesk-Thin.woff +0 -0
  87. package/dist/fonts/Px-Grotesk/Px-Grotesk-Thin.woff2 +0 -0
  88. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Bold-Italic.otf +0 -0
  89. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Bold-Italic.woff +0 -0
  90. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Bold-Italic.woff2 +0 -0
  91. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Bold.otf +0 -0
  92. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Bold.woff +0 -0
  93. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Bold.woff2 +0 -0
  94. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Italic.otf +0 -0
  95. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Italic.woff +0 -0
  96. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Italic.woff2 +0 -0
  97. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Light-Italic.otf +0 -0
  98. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Light-Italic.woff +0 -0
  99. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Light-Italic.woff2 +0 -0
  100. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Light.otf +0 -0
  101. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Light.woff +0 -0
  102. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Light.woff2 +0 -0
  103. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Regular.otf +0 -0
  104. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Regular.woff +0 -0
  105. package/dist/fonts/Px-Grotesk-Mono/Px-Grotesk-Mono-Regular.woff2 +0 -0
  106. package/dist/hooks/useChainConnector.d.ts +3 -0
  107. package/dist/hooks/useIsMobileView.d.ts +1 -0
  108. package/dist/hooks/usePersistState.d.ts +2 -0
  109. package/dist/hooks/useWalletConnect.d.ts +6 -0
  110. package/dist/hooks/useWalletConnectors.d.ts +5 -0
  111. package/dist/hooks/useWalletWidgets.d.ts +1 -0
  112. package/dist/hooks/useWidgetState.d.ts +1 -0
  113. package/dist/images/chains/babylon.jpeg +0 -0
  114. package/dist/images/chains/bitcoin.png +0 -0
  115. package/dist/images/wallets/binance.png +0 -0
  116. package/dist/images/wallets/binance.webp +0 -0
  117. package/dist/images/wallets/keystone.svg +4 -0
  118. package/dist/images/wallets/okx.png +0 -0
  119. package/dist/images/wallets/tomo.png +0 -0
  120. package/dist/index.cjs.js +80 -0
  121. package/dist/index.cjs.js.map +1 -0
  122. package/dist/index.d.ts +10 -0
  123. package/dist/index.es.js +81912 -0
  124. package/dist/index.es.js.map +1 -0
  125. package/dist/style.css +1 -0
  126. package/dist/utils/wallet.d.ts +1 -0
  127. package/package.json +113 -0
package/LICENSE ADDED
@@ -0,0 +1,141 @@
1
+ Business Source License 1.1
2
+
3
+ License text copyright (c) 2017 MariaDB Corporation Ab, All Rights Reserved. "Business Source License" is a trademark of
4
+ MariaDB Corporation Ab.
5
+
6
+ ---
7
+
8
+ Parameters
9
+
10
+ Licensor: Babylon Labs Ltd.
11
+
12
+ Licensed Work: @babylonlabs-io/wallet-connect The Licensed Work is (c) 2024 Babylon Labs Ltd.
13
+
14
+ Additional Use Grant:
15
+
16
+ In addition to the uses permitted under the non-production license below, we grant you a limited, non-exclusive,
17
+ non-transferable, non-sublicensable, revocable license, limited as set forth below, to use the Licensed Work in this
18
+ repository for production commercial uses built on or using and integrated with the Babylon Protocol, not including
19
+ Competing Uses.
20
+
21
+ Any use beyond the scope of this license, including uses that are not built on or using and integrated with the Babylon
22
+ Protocol, or are Competing Uses, will terminate this license to you, automatically and without notice.
23
+
24
+ This License applies separately and solely to the specific versions of the Licensed Work in the specified repository on
25
+ or before the date of this License, and we may require a different license and different provisions for each subsequent
26
+ version of the Licensed Work released by us.
27
+
28
+ "Babylon Labs", "we", "our", or "us" means Babylon Labs Ltd.
29
+
30
+ "Babylon Protocol" means the Bitcoin staking protocol as further described in the documentation here
31
+ (https://docs.babylonlabs.io/docs/introduction/babylon-overview), as updated from time to time.
32
+
33
+ "Competing Use" means any use of the Licensed Work in any product, software, protocol, network, application, or service
34
+ that is made available to any party and that (i) substitutes for the use of the Babylon Protocol, (ii) offers the same
35
+ or substantially similar functionality as the Babylon Protocol or (iii) is built on or uses a protocol with
36
+ substantially similar functionality as the Babylon Protocol or otherwise facilitates the staking of bitcoin other than
37
+ by utilizing the Babylon Protocol.
38
+
39
+ The provisions in this License apply to each individual, entity, group, or association (each and collectively, "you" or
40
+ "your") who uses the Licensed Work for production, and you agree to such provisions. Your production use of the Licensed
41
+ Work is conditional on your agreement to this License. If you do not agree and consent to be bound to this License, do
42
+ not so use the Software.
43
+
44
+ If you do not fall within the limited scope of this license as described above or below, or are otherwise not in strict
45
+ compliance with this License, then this production license does not extend to you and does not grant you any production
46
+ use, including any copying, distributing, or making any derivative use of the Licensed Work for production purposes.
47
+
48
+ Limited Scope of License. Your commercial production license to the Licensed Work under this License does not extend to
49
+ any use:
50
+
51
+ 1. unless you have legal capacity to consent and agree to be bound by this License;
52
+ 2. unless you have the technical knowledge necessary or advisable to understand and evaluate the risks of using the
53
+ Licensed Work and the Babylon Protocol;
54
+ 3. if you are a resident or agent of, or an entity organized, incorporated or doing business in, Afghanistan, Belarus,
55
+ Bosnia and Herzegovina, Burundi, Central African Republic, Crimea, Cuba, Democratic People's Republic of Korea,
56
+ Democratic Republic of the Congo, Donetsk or Luhansk Regions of Ukraine, Eritrea, Guinea, Guinea-Bissau, Haiti,
57
+ Iran, Iraq, Lebanon, Libya, Mali, Myanmar, Nicaragua, Russia, Somalia, South Sudan, Sudan, Syria, Venezuela, Yemen,
58
+ or Zimbabwe or any other country to which the United States, the United Kingdom, the European Union or any of its
59
+ member states or the United Nations or any of its member states (collectively, the "Major Jurisdictions") embargoes
60
+ goods or imposes sanctions (such embargoed or sanctioned territories, collectively, the "Restricted Territories");
61
+ 4. if you are, or if you directly or indirectly own or control, from any person or entity that is listed on any
62
+ sanctions list or equivalent maintained by any of the Major Jurisdictions (collectively, "Sanctions Lists Persons");
63
+ 5. to transact in or with any Restricted Territories or Sanctions List Persons;
64
+ 6. if you are a U.S. Person as defined in 17 CFR § 230.902, or currently or ordinarily located or resident in (or
65
+ incorporated or organized in) the United States of America, Canada, or Australia (collectively, "Excluded
66
+ Jurisdictions"), or to transact in or with Excluded Jurisdictions;
67
+ 7. to defraud, or otherwise materially mislead, any person;
68
+ 8. in violation of applicable laws, rules or regulations in your relevant jurisdiction;
69
+ 9. that circumvents any sanctions or export controls targeting you or the country or territory where you are located;
70
+ or
71
+ 10. in any activity that transmits, exchanges, or is otherwise supported by the direct or indirect proceeds of criminal
72
+ or fraudulent activity.
73
+
74
+ Any production use of the Licensed Work by you confirms your agreement to the foregoing limitations, and your
75
+ understanding and agreement that they are limitations and not restrictions.
76
+
77
+ Change Date: 2027-03-15 (March 15th, 2027)
78
+
79
+ Change License: Apache 2.0
80
+
81
+ ---
82
+
83
+ Terms
84
+
85
+ The Licensor hereby grants you the right to copy, modify, create derivative works, redistribute, and make non-production
86
+ use of the Licensed Work. The Licensor may make an Additional Use Grant, above, permitting limited production use.
87
+
88
+ Effective on the Change Date, or the fourth anniversary of the first publicly available distribution of a specific
89
+ version of the Licensed Work under this License, whichever comes first, the Licensor hereby grants you rights under the
90
+ terms of the Change License, and the rights granted in the paragraph above terminate.
91
+
92
+ If your use of the Licensed Work does not comply with the requirements currently in effect as described in this License,
93
+ you must purchase a commercial license from the Licensor, its affiliated entities, or authorized resellers, or you must
94
+ refrain from using the Licensed Work.
95
+
96
+ All copies of the original and modified Licensed Work, and derivative works of the Licensed Work, are subject to this
97
+ License. This License applies separately for each version of the Licensed Work and the Change Date may vary for each
98
+ version of the Licensed Work released by Licensor.
99
+
100
+ You must conspicuously display this License on each original or modified copy of the Licensed Work. If you receive the
101
+ Licensed Work in original or modified form from a third party, the terms and conditions set forth in this License apply
102
+ to your use of that work.
103
+
104
+ Any use of the Licensed Work in violation of this License will automatically terminate your rights under this License
105
+ for the current and all other versions of the Licensed Work.
106
+
107
+ This License does not grant you any right in any trademark or logo of Licensor or its affiliates (provided that you may
108
+ use a trademark or logo of Licensor as expressly required by this License).
109
+
110
+ TO THE EXTENT PERMITTED BY APPLICABLE LAW, THE LICENSED WORK IS PROVIDED ON AN "AS IS" BASIS. LICENSOR HEREBY DISCLAIMS
111
+ ALL WARRANTIES AND CONDITIONS, EXPRESS OR IMPLIED, INCLUDING (WITHOUT LIMITATION) WARRANTIES OF MERCHANTABILITY, FITNESS
112
+ FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT, AND TITLE.
113
+
114
+ MariaDB hereby grants you permission to use this License’s text to license your works, and to refer to it using the
115
+ trademark "Business Source License", as long as you comply with the Covenants of Licensor below.
116
+
117
+ ---
118
+
119
+ Covenants of Licensor
120
+
121
+ In consideration of the right to use this License’s text and the "Business Source License" name and trademark, Licensor
122
+ covenants to MariaDB, and to all other recipients of the licensed work to be provided by Licensor:
123
+
124
+ 1. To specify as the Change License the GPL Version 2.0 or any later version, or a license that is compatible with GPL
125
+ Version 2.0 or a later version, where "compatible" means that software provided under the Change License can be
126
+ included in a program with software provided under GPL Version 2.0 or a later version. Licensor may specify
127
+ additional Change Licenses without limitation.
128
+
129
+ 2. To either: (a) specify an additional grant of rights to use that does not impose any additional restriction on the
130
+ right granted in this License, as the Additional Use Grant; or (b) insert the text "None".
131
+
132
+ 3. To specify a Change Date.
133
+
134
+ 4. Not to modify this License in any other way.
135
+
136
+ ---
137
+
138
+ Notice
139
+
140
+ The Business Source License (this document, or the "License") is not an Open Source license. However, the Licensed Work
141
+ will eventually be made available under an Open Source License, as stated in this License.
package/README.md ADDED
@@ -0,0 +1,234 @@
1
+ <p align="center">
2
+ <img
3
+ alt="Babylon Logo"
4
+ src="https://github.com/user-attachments/assets/dc74271e-90f1-44bd-9122-2b7438ab375c"
5
+ width="100"
6
+ />
7
+ <h3 align="center">@babylonlabs-io/wallet-connect</h3>
8
+ <p align="center">Babylon Wallet Connector</p>
9
+ </p>
10
+ <br/>
11
+
12
+ - [Key Features](#key-features)
13
+ - [Overview](#overview)
14
+ - [Installation](#installation)
15
+ - [Version Release](#version-release)
16
+ - [Stable version](#stable-version)
17
+ - [Storybook](#storybook)
18
+ - [Wallet Integration](#wallet-integration)
19
+ - [1. Browser extension wallets](#1-browser-extension-wallets)
20
+ - [2. Mobile wallets](#2-mobile-wallets)
21
+ - [IBTCProvider](#ibtcprovider)
22
+ - [IBBNProvider](#ibbnprovider)
23
+
24
+ The Babylon Wallet Connector repository provides the wallet connection component
25
+ used in the Babylon Staking Dashboard. This component enables the connection of
26
+ both Bitcoin and Babylon chain wallets.
27
+
28
+ ## Key Features
29
+
30
+ - Unified interfaces for Bitcoin and Babylon wallet connections
31
+ - Support for browser extension wallets
32
+ - Support for hardware wallets
33
+ - Mobile wallet compatibility through injectable interfaces
34
+ - Tomo Connect integration for broader wallet ecosystem
35
+
36
+ ## Overview
37
+
38
+ The Babylon Wallet Connector provides a unified interface for integrating both
39
+ Bitcoin and Babylon wallets into Babylon dApp. It supports both native wallet
40
+ extensions and injectable mobile wallets.
41
+
42
+ The main architectural difference is that native wallets are built into the
43
+ library, while injectable wallets can be dynamically added by injecting their
44
+ implementation into the webpage's `window` object before the dApp loads.
45
+
46
+ ## Installation
47
+
48
+ ```bash
49
+ npm i @babylonlabs-io/wallet-connect
50
+ ```
51
+
52
+ ## Version Release
53
+
54
+ ### Stable version
55
+
56
+ Stable release versions are manually released from the main branch.
57
+
58
+ ## Storybook
59
+
60
+ ```bash
61
+ npm run dev
62
+ ```
63
+
64
+ ## Wallet Integration
65
+
66
+ > ⚠️ **IMPORTANT**: Breaking changes to the wallet methods used by the Babylon
67
+ > web application are likely to cause incompatibility with it or lead to
68
+ > unexpected behavior with severe consequences.
69
+ >
70
+ > Please make sure to always maintain backwards compatibility and test
71
+ > thoroughly all changes affecting the methods required by the Babylon web
72
+ > application. If you are unsure about a change, please reach out to the Babylon
73
+ > Labs team.
74
+
75
+ This guide explains how to integrate wallets with the Babylon staking app. The
76
+ dApp supports both Bitcoin and Babylon wallets through two integration paths:
77
+
78
+ ### 1. Browser extension wallets
79
+
80
+ The recommended way to integrate your wallet with Babylon staking app is through
81
+ [Tomo Connect SDK Lite](https://docs.tomo.inc/tomo-sdk/tomo-connect-sdk-lite).
82
+ Please refer to Tomo's documentation for integration details.
83
+
84
+ ### 2. Mobile wallets
85
+
86
+ Full interface definitions can be found in
87
+ [src/core/types.ts](src/core/types.ts).
88
+
89
+ Below we outline the interfaces for Bitcoin and Babylon wallets that need to be
90
+ implemented for integration with the Babylon staking app.
91
+
92
+ #### IBTCProvider
93
+
94
+ ```ts
95
+ interface IBTCProvider extends IProvider {
96
+ /**
97
+ * Connects to the wallet and returns the instance of the wallet provider.
98
+ * Currently only supports "native segwit" and "taproot" address types.
99
+ * @returns A promise that resolves to an instance of the wrapper wallet provider in babylon friendly format.
100
+ * @throws An error if the wallet is not installed or if connection fails.
101
+ */
102
+ connectWallet(): Promise<void>;
103
+
104
+ /**
105
+ * Gets the address of the connected wallet.
106
+ * @returns A promise that resolves to the address of the connected wallet.
107
+ */
108
+ getAddress(): Promise<string>;
109
+
110
+ /**
111
+ * Gets the public key of the connected wallet.
112
+ * @returns A promise that resolves to the public key of the connected wallet.
113
+ */
114
+ getPublicKeyHex(): Promise<string>;
115
+
116
+ /**
117
+ * Signs the given PSBT in hex format.
118
+ * @param psbtHex - The hex string of the unsigned PSBT to sign.
119
+ * @returns A promise that resolves to the hex string of the signed PSBT.
120
+ */
121
+ signPsbt(psbtHex: string): Promise<string>;
122
+
123
+ /**
124
+ * Signs multiple PSBTs in hex format.
125
+ * @param psbtsHexes - The hex strings of the unsigned PSBTs to sign.
126
+ * @returns A promise that resolves to an array of hex strings, each representing a signed PSBT.
127
+ */
128
+ signPsbts(psbtsHexes: string[]): Promise<string[]>;
129
+
130
+ /**
131
+ * Gets the network of the current account.
132
+ * @returns A promise that resolves to the network of the current account.
133
+ */
134
+ getNetwork(): Promise<Network>;
135
+
136
+ /**
137
+ * Signs a message using the specified signing method.
138
+ * @param message - The message to sign.
139
+ * @param type - The signing method to use.
140
+ * @returns A promise that resolves to the signed message.
141
+ */
142
+ signMessage(message: string, type: "ecdsa"): Promise<string>;
143
+
144
+ /**
145
+ * Retrieves the inscriptions for the connected wallet.
146
+ * @returns A promise that resolves to an array of inscriptions.
147
+ */
148
+ getInscriptions(): Promise<InscriptionIdentifier[]>;
149
+
150
+ /**
151
+ * Registers an event listener for the specified event.
152
+ * At the moment, only the "accountChanged" event is supported.
153
+ * @param eventName - The name of the event to listen for.
154
+ * @param callBack - The callback function to be executed when the event occurs.
155
+ */
156
+ on(eventName: string, callBack: () => void): void;
157
+
158
+ /**
159
+ * Unregisters an event listener for the specified event.
160
+ * @param eventName - The name of the event to listen for.
161
+ * @param callBack - The callback function to be executed when the event occurs.
162
+ */
163
+ off(eventName: string, callBack: () => void): void;
164
+
165
+ /**
166
+ * Gets the name of the wallet provider.
167
+ * @returns A promise that resolves to the name of the wallet provider.
168
+ */
169
+ getWalletProviderName(): Promise<string>;
170
+
171
+ /**
172
+ * Gets the icon of the wallet provider.
173
+ * @returns A promise that resolves to the icon of the wallet provider.
174
+ */
175
+ getWalletProviderIcon(): Promise<string>;
176
+ }
177
+ ```
178
+
179
+ #### IBBNProvider
180
+
181
+ ```ts
182
+ export interface IBBNProvider extends IProvider {
183
+ /**
184
+ * Connects to the wallet and returns the instance of the wallet provider.
185
+ * @returns A promise that resolves to an instance of the wrapper wallet provider.
186
+ * @throws An error if the wallet is not installed or if connection fails.
187
+ */
188
+ connectWallet(): Promise<void>;
189
+
190
+ /**
191
+ * Gets the address of the connected wallet.
192
+ * @returns A promise that resolves to the address of the connected wallet.
193
+ */
194
+ getAddress(): Promise<string>;
195
+
196
+ /**
197
+ * Gets the public key of the connected wallet.
198
+ * @returns A promise that resolves to the public key of the connected wallet.
199
+ */
200
+ getPublicKeyHex(): Promise<string>;
201
+
202
+ /**
203
+ * Gets the name of the wallet provider.
204
+ * @returns A promise that resolves to the name of the wallet provider.
205
+ */
206
+ getWalletProviderName(): Promise<string>;
207
+
208
+ /**
209
+ * Gets the icon of the wallet provider.
210
+ * @returns A promise that resolves to the icon of the wallet provider.
211
+ */
212
+ getWalletProviderIcon(): Promise<string>;
213
+
214
+ /**
215
+ * Retrieves an offline signer that supports both Amino and Direct signing methods.
216
+ * This signer is used for signing transactions offline before broadcasting them to the network.
217
+ *
218
+ * @returns {Promise<OfflineAminoSigner & OfflineDirectSigner>} A promise that resolves to a signer supporting both Amino and Direct signing
219
+ * @throws {Error} If wallet connection is not established or signer cannot be retrieved
220
+ */
221
+ getOfflineSigner(): Promise<OfflineAminoSigner & OfflineDirectSigner>;
222
+ }
223
+ ```
224
+
225
+ 1. Implement provider interface
226
+ 2. Inject into `window` before loading dApp:
227
+
228
+ ```ts
229
+ // For Bitcoin wallets
230
+ window.btcwallet = new BTCWalletImplementation();
231
+
232
+ // For Babylon wallets
233
+ window.bbnwallet = new BBNWalletImplementation();
234
+ ```
@@ -0,0 +1,11 @@
1
+ import { JSX, PropsWithChildren } from 'react';
2
+ interface ChainButtonProps extends PropsWithChildren {
3
+ className?: string;
4
+ disabled?: boolean;
5
+ logo?: string | JSX.Element;
6
+ title?: string | JSX.Element;
7
+ alt?: string;
8
+ onClick?: () => void;
9
+ }
10
+ export declare function ChainButton({ className, disabled, alt, logo, title, children, onClick }: ChainButtonProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,8 @@
1
+ interface ContainerProps {
2
+ className?: string;
3
+ onClose?: () => void;
4
+ onConfirm?: () => void;
5
+ onDisconnectWallet?: (chainId: string) => void;
6
+ }
7
+ export declare function ChainsContainer(props: ContainerProps): import("react/jsx-runtime").JSX.Element;
8
+ export {};
@@ -0,0 +1,13 @@
1
+ import { IChain, IWallet } from '../../core/types';
2
+ interface ChainsProps {
3
+ disabled?: boolean;
4
+ chains: IChain[];
5
+ className?: string;
6
+ selectedWallets?: Record<string, IWallet | undefined>;
7
+ onClose?: () => void;
8
+ onConfirm?: () => void;
9
+ onDisconnectWallet?: (chainId: string) => void;
10
+ onSelectChain?: (chain: IChain) => void;
11
+ }
12
+ export declare const Chains: import('react').MemoExoticComponent<({ disabled, chains, selectedWallets, className, onClose, onConfirm, onSelectChain, onDisconnectWallet, }: ChainsProps) => import("react/jsx-runtime").JSX.Element>;
13
+ export {};
@@ -0,0 +1,6 @@
1
+ import { Meta, StoryObj } from '@storybook/react';
2
+ import { Chains } from './index';
3
+ declare const meta: Meta<typeof Chains>;
4
+ export default meta;
5
+ type Story = StoryObj<typeof meta>;
6
+ export declare const Default: Story;
@@ -0,0 +1,10 @@
1
+ interface ConnectedWalletProps {
2
+ className?: string;
3
+ chainId: string;
4
+ logo: string;
5
+ name: string;
6
+ address: string;
7
+ onDisconnect?: (chainId: string) => void;
8
+ }
9
+ export declare const ConnectedWallet: import('react').MemoExoticComponent<({ className, chainId, logo, name, address, onDisconnect }: ConnectedWalletProps) => import("react/jsx-runtime").JSX.Element>;
10
+ export {};
@@ -0,0 +1,5 @@
1
+ interface ErrorContainer {
2
+ className?: string;
3
+ }
4
+ export declare function ErrorContainer({ className }: ErrorContainer): import("react/jsx-runtime").JSX.Element;
5
+ export {};
@@ -0,0 +1,12 @@
1
+ interface ErrorProps {
2
+ className?: string;
3
+ icon?: JSX.Element;
4
+ title: string | JSX.Element;
5
+ description: string | JSX.Element;
6
+ cancelButton?: string | JSX.Element;
7
+ submitButton?: string | JSX.Element;
8
+ onCancel?: () => void;
9
+ onSubmit?: () => void;
10
+ }
11
+ export declare function Error({ className, icon, title, description, cancelButton, submitButton, onCancel, onSubmit, }: ErrorProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,7 @@
1
+ import { PropsWithChildren } from 'react';
2
+ interface FieldControl {
3
+ label: string | JSX.Element;
4
+ className?: string;
5
+ }
6
+ export declare function FieldControl({ label, className, children }: PropsWithChildren<FieldControl>): import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,6 @@
1
+ interface InscriptionsContainerProps {
2
+ className?: string;
3
+ onSubmit?: (value: boolean, showAgain: boolean) => void;
4
+ }
5
+ export declare function InscriptionsContainer({ className, onSubmit }: InscriptionsContainerProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,7 @@
1
+ import { BTCConfig } from '../../core/types';
2
+ export interface Props {
3
+ className?: string;
4
+ onSubmit?: (value: boolean, showAgain: boolean) => void;
5
+ config?: BTCConfig;
6
+ }
7
+ export declare function Inscriptions({ className, config, onSubmit }: Props): import("react/jsx-runtime").JSX.Element | null;
@@ -0,0 +1,6 @@
1
+ interface LoaderProps {
2
+ className?: string;
3
+ title?: string;
4
+ }
5
+ export declare function LoaderScreen({ className, title }: LoaderProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ import { DialogProps } from '@babylonlabs-io/core-ui';
2
+ export declare function ResponsiveDialog(props: DialogProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,6 @@
1
+ export interface TermsOfServiceContainerProps {
2
+ className?: string;
3
+ onClose?: () => void;
4
+ onSubmit?: () => void;
5
+ }
6
+ export declare function TermsOfServiceContainer(props: TermsOfServiceContainerProps): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,8 @@
1
+ import { BTCConfig } from '../../core/types';
2
+ export interface Props {
3
+ className?: string;
4
+ config?: BTCConfig;
5
+ onClose?: () => void;
6
+ onSubmit?: () => void;
7
+ }
8
+ export declare function TermsOfService({ className, onClose, onSubmit }: Props): import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,12 @@
1
+ interface WalletButtonProps {
2
+ className?: string;
3
+ logo: string;
4
+ disabled?: boolean;
5
+ name: string;
6
+ label?: string;
7
+ fallbackLink?: string;
8
+ installed?: boolean;
9
+ onClick?: () => void;
10
+ }
11
+ export declare function WalletButton({ className, disabled, name, logo, label, fallbackLink, installed, onClick, }: WalletButtonProps): import("react/jsx-runtime").JSX.Element;
12
+ export {};
@@ -0,0 +1,17 @@
1
+ import { JSX } from 'react';
2
+ import { Screen } from '../../../context/State.context';
3
+ import { IChain, IWallet } from '../../../core/types';
4
+ interface ScreenProps {
5
+ className?: string;
6
+ current: Screen;
7
+ lockInscriptions?: boolean;
8
+ widgets?: Record<string, JSX.Element | undefined>;
9
+ onSelectWallet?: (chain: IChain, wallet: IWallet) => void;
10
+ onDisconnectWallet?: (chainId: string) => void;
11
+ onAccepTermsOfService?: () => void;
12
+ onToggleInscriptions?: (value: boolean, showAgain: boolean) => void;
13
+ onClose?: () => void;
14
+ onConfirm?: () => void;
15
+ }
16
+ export declare function Screen(props: ScreenProps): import("react/jsx-runtime").JSX.Element;
17
+ export {};
@@ -0,0 +1,6 @@
1
+ interface WalletDialogProps {
2
+ onError?: (e: Error) => void;
3
+ config: any;
4
+ }
5
+ export declare function WalletDialog({ config, onError }: WalletDialogProps): import("react/jsx-runtime").JSX.Element;
6
+ export {};
@@ -0,0 +1,2 @@
1
+ import { ChainConfigArr } from '../../context/Chain.context';
2
+ export declare const config: ChainConfigArr;
@@ -0,0 +1,9 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { ChainConfigArr } from '../../context/Chain.context';
3
+ interface WalletProviderProps {
4
+ context?: any;
5
+ config: Readonly<ChainConfigArr>;
6
+ onError?: (e: Error) => void;
7
+ }
8
+ export declare function WalletProvider({ children, config, context, onError, }: PropsWithChildren<WalletProviderProps>): import("react/jsx-runtime").JSX.Element;
9
+ export {};
@@ -0,0 +1,4 @@
1
+ import { ChainInfo } from '@keplr-wallet/types';
2
+ export declare const BBN_TESTNET_RPC_URL = "https://rpc-dapp.testnet.babylonlabs.io/";
3
+ export declare const BBN_TESTNET_LCD_URL = "https://lcd-dapp.testnet.babylonlabs.io/";
4
+ export declare const bbnTestnet: ChainInfo;
@@ -0,0 +1,11 @@
1
+ import { JSX } from 'react';
2
+ import { IChain, IWallet } from '../../core/types';
3
+ interface WalletContainerProps {
4
+ widgets?: Record<string, JSX.Element | undefined>;
5
+ className?: string;
6
+ onClose?: () => void;
7
+ append?: JSX.Element;
8
+ onSelectWallet?: (chain: IChain, wallet: IWallet) => void;
9
+ }
10
+ export declare function WalletsContainer({ widgets, ...props }: WalletContainerProps): import("react/jsx-runtime").JSX.Element;
11
+ export {};
@@ -0,0 +1,10 @@
1
+ import { IChain, IWallet } from '../../core/types';
2
+ export interface WalletsProps {
3
+ chain: IChain;
4
+ className?: string;
5
+ append?: JSX.Element;
6
+ onClose?: () => void;
7
+ onSelectWallet?: (chain: IChain, wallet: IWallet) => void;
8
+ onBack?: () => void;
9
+ }
10
+ export declare const Wallets: import('react').MemoExoticComponent<({ chain, className, append, onClose, onBack, onSelectWallet }: WalletsProps) => import("react/jsx-runtime").JSX.Element>;
@@ -0,0 +1,24 @@
1
+ import { PropsWithChildren } from 'react';
2
+ import { WalletConnector } from '../core/WalletConnector';
3
+ import { BBNConfig, BTCConfig, ExternalConnector, IBBNProvider, IBTCProvider, IProvider } from '../core/types';
4
+ interface ChainConfig<K extends string = string, P extends IProvider = IProvider, C = any> {
5
+ chain: K;
6
+ name?: string;
7
+ icon?: string;
8
+ config: C;
9
+ connectors?: ExternalConnector<P>[];
10
+ }
11
+ export type ChainConfigArr = (ChainConfig<"BTC", IBTCProvider, BTCConfig> | ChainConfig<"BBN", IBBNProvider, BBNConfig>)[];
12
+ interface ProviderProps {
13
+ context: any;
14
+ config: Readonly<ChainConfigArr>;
15
+ onError?: (e: Error) => void;
16
+ }
17
+ export interface Connectors {
18
+ BTC: WalletConnector<"BTC", IBTCProvider, BTCConfig> | null;
19
+ BBN: WalletConnector<"BBN", IBBNProvider, BBNConfig> | null;
20
+ }
21
+ export declare const Context: import('react').Context<Connectors>;
22
+ export declare function ChainProvider({ children, context, config, onError }: PropsWithChildren<ProviderProps>): import("react/jsx-runtime").JSX.Element;
23
+ export declare const useChainProviders: () => Connectors;
24
+ export {};
@@ -0,0 +1,12 @@
1
+ import { PropsWithChildren } from 'react';
2
+ interface InscriptionContext {
3
+ lockInscriptions: boolean;
4
+ showAgain: boolean;
5
+ toggleLockInscriptions?: (value: boolean) => void;
6
+ toggleShowAgain?: (value: boolean) => void;
7
+ }
8
+ export declare function InscriptionProvider({ children, context }: PropsWithChildren<{
9
+ context: any;
10
+ }>): import("react/jsx-runtime").JSX.Element;
11
+ export declare const useInscriptionProvider: () => InscriptionContext;
12
+ export {};