@mezo-org/passport 0.1.0-dev.0 → 0.1.0-dev.1

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 CHANGED
@@ -1 +1,303 @@
1
1
  # mezo-org/passport
2
+
3
+ **Table of contents:**
4
+
5
+ - [Introduction](#introduction)
6
+ - [Purpose](#purpose)
7
+ - [Key features](#key-features)
8
+ - [Getting Started](#getting-started)
9
+ - [Step-by-step setup](#step-by-step-setup)
10
+ - [Installation](#installation)
11
+ - [Configure](#configure)
12
+ - [Bitcoin wallet config](#bitcoin-wallet-config)
13
+ - [Wrap providers](#wrap-providers)
14
+ - [Final steps](#final-steps)
15
+ - [Connecting a wallet](#connecting-a-wallet)
16
+ - [through RainbowKit](#final-steps)
17
+ - [through wagmi](#final-steps)
18
+ - [Getting addresses and wallet balances](#getting-addresses-wallet-balances)
19
+ - [Signing a message](#signing-a-message)
20
+ - [BTC transactions](#btc-transactions)
21
+ - [ETH transactions](#eth-transactions)
22
+
23
+ ## Introduction
24
+
25
+ ### Purpose
26
+
27
+ The Mezo Passport package is built on top of RainbowKit, expanding its
28
+ functionality to provide additional wallet connection options specifically
29
+ tailored for Bitcoin wallets and Mezo Matsnet. With this package, developers can
30
+ integrate Bitcoin wallet support alongside existing Mezo Matsnet (and other
31
+ Ethereum-compatible (EVM) wallets), creating a more versatile connection
32
+ experience for users.
33
+
34
+ One of the key features of this package is its ability to "masquerade" or
35
+ simulate Bitcoin wallets as Matsnet wallets, allowing them to interact with
36
+ matsnet-based applications seamlessly. Under the hood, it manages a supporting
37
+ provider, with it's underlying Matsnet account, that enables standard EVM
38
+ operations (such as reading data and interacting with smart contracts) while
39
+ keeping signing operations (such as authorizing transactions) routed to the
40
+ Bitcoin wallet itself.
41
+
42
+ Additionally, the package directs transaction execution to a backing smart
43
+ account, which handles the technical details on the Matnset side. This setup
44
+ enables users to use their Bitcoin wallet for both matsnet transactions and
45
+ Bitcoin-specific signing operations without needing to switch wallets or
46
+ providers manually. Each Mezo Passport Bitcoin wallet has an underlying smart
47
+ account on n Matsnet chain that validates signatures from the Bitcoin wallet and
48
+ issues Matsnet transactions.
49
+
50
+ In essence, this package allows for a more flexible and integrated multi-chain
51
+ wallet experience by enabling Bitcoin wallets to operate within an EVM
52
+ environment, making it easier for users to access both Bitcoin and EVM
53
+ functionalities through a unified connection interface.
54
+
55
+ ### Key Features
56
+
57
+ - **Wallet Management**
58
+
59
+ The Mezo Passport package provides a set of components that enable users to
60
+ connect their Bitcoin wallets to your dApp. Beyond simple connection and
61
+ disconnection, it also supports features like displaying balances, switching
62
+ networks, and more.
63
+
64
+ - **Interoperability**
65
+
66
+ The Mezo Passport package provides integrations with the popular viem an wagmi
67
+ libraries, making it easier to incorporate Bitcoin wallet support into
68
+ applications that already utilize these libraries. By leveraging these
69
+ integrations, developers can seamlessly manage wallet connections and
70
+ streamline interactions across both Bitcoin and EVM ecosystems.
71
+
72
+ ## Getting started
73
+
74
+ ### Step by step setup
75
+
76
+ Note: Because RainbowKit is a React library, Mezo Passport is also designed as a
77
+ React library to ensure seamless integration.
78
+
79
+ #### Installation
80
+
81
+ Install Mezo Passport library, RainbowKit and all of it's dependencies:
82
+
83
+ ```
84
+ npm install @mezo-org/passport @rainbow-me/rainbowkit wagmi viem@2.x @tanstack/react-query
85
+ ```
86
+
87
+ #### Configure
88
+
89
+ Note: We recommend reading through
90
+ [RainbowKit documentation](https://www.rainbowkit.com/) first to fully
91
+ understand the configuration process.
92
+
93
+ The configuration process is basically the same as in RainbowKit. Normally, you
94
+ would create a wagmi config using `createDefaultConfig` from RainbowKit, but
95
+ Mezo Passport provides a `getConfig` method, which returns a default
96
+ configuration for Mezo Matsnet. We just have to pass it further to
97
+ `WagmiProvider`:
98
+
99
+ ```
100
+ import { RainbowKitProvider } from "@rainbow-me/rainbowkit"
101
+ import { QueryClient, QueryClientProvider } from "@tanstack/react-query"
102
+ import { WagmiProvider } from "wagmi"
103
+ import "@rainbow-me/rainbowkit/styles.css"
104
+ import { getConfig, matsnetTestnetChain } from "@mezo-org/passport"
105
+
106
+ const queryClient = new QueryClient()
107
+
108
+ ReactDOM.createRoot(document.getElementById("root")!).render(
109
+ <React.StrictMode>
110
+ <WagmiProvider config={getConfig({ appName: "Your app name" })}>
111
+ <QueryClientProvider client={queryClient}>
112
+ <RainbowKitProvider initialChain={matsnetTestnetChain}>
113
+ {/* Your App component */}
114
+ </RainbowKitProvider>
115
+ </QueryClientProvider>
116
+ </WagmiProvider>
117
+ </React.StrictMode>,
118
+ )
119
+ ```
120
+
121
+ You can pass the same configuration options to `getConfig` as you would to
122
+ `createDefaultConfig` from RainbowKit. For default config you only need to
123
+ provide the `appName`.
124
+
125
+ #### Final steps
126
+
127
+ That's pretty much it when it comes to configuration! As stated earlier, we
128
+ recommend to read through the RainbowKit documentation for better understanding.
129
+
130
+ To start adding functionalities, please see
131
+ [Connecting a wallet](#connecting-a-wallet).
132
+
133
+ ### Connecting a wallet
134
+
135
+ There are two ways to connect the Mezo Passport wallet:
136
+
137
+ 1. through Wagmi,
138
+ 2. through RainbowKit,
139
+
140
+ #### through Wagmi
141
+
142
+ We can connect to the specific wallet directly through `wagmi`:
143
+
144
+ ```
145
+ import {
146
+ useChainId,
147
+ useConnect,
148
+ } from "wagmi"
149
+
150
+ export const YourApp = () => {
151
+ const chainId = useChainId()
152
+ const { connectors, connect } = useConnect()
153
+
154
+ return (
155
+ <div>
156
+ {connectors.map((connector) => (
157
+ <button
158
+ type="button"
159
+ onClick={() => {
160
+ connect({ connector, chainId })
161
+ }}
162
+ key={connector.id}
163
+ >
164
+ {connector.name}
165
+ </button>
166
+ ))}
167
+ </div>
168
+ )
169
+
170
+ };
171
+ ```
172
+
173
+ This will render a button for each wallet that we've added to the rainbowKit
174
+ config. This gives us more control over connectors and how we want it to be
175
+ displayed in our dApp.
176
+
177
+ #### through RainbowKit
178
+
179
+ We can also implement wallet connection through RainbowKit, where we import the
180
+ `ConnectButton` component, which will handle the connection process under the
181
+ hood:
182
+
183
+ ```
184
+ import { ConnectButton } from "@rainbow-me/rainbowkit"
185
+
186
+ export const YourApp = () => {
187
+ return <ConnectButton label="Connect wallet"/>;
188
+ };
189
+ ```
190
+
191
+ ### Getting addresses and wallet balances
192
+
193
+ #### Bitcoin account
194
+
195
+ For bitcoin account Mezo Passport exports a helper hook -
196
+ `useBitcoinAccount()` - which can be used to obtain address and balance of the
197
+ connected bitcoin account:
198
+
199
+ ```
200
+ import { useBitcoinAccount } from "@mezo-org/passport"
201
+
202
+ const { btcAddress, btcBalance } = useBitcoinAccount()
203
+
204
+ useEffect(() => {
205
+ console.log("btcAddress: ", btcAddress)
206
+ console.log("btcBalance (in satoshi): ", btcBalance.total)
207
+ }, [btcAddress, btcBalance])
208
+ ```
209
+
210
+ This hook returns the bitcoin balance in satoshis, in the following format:
211
+
212
+ ```
213
+ {
214
+ confirmed: number,
215
+ unconfirmed: number,
216
+ total: number
217
+ }
218
+ ```
219
+
220
+ #### Mezo Matsnet account
221
+
222
+ To get an address and a balance of the underlying Mezo Matsnet account, we can
223
+ use `wagmi` hooks:
224
+
225
+ ```
226
+ const { address } = useAccount()
227
+ const { data } = useBalance({ address })
228
+
229
+ useEffect(() => {
230
+ console.log("ethAddress: ", address)
231
+ console.log("balance: ", data.value.toString())
232
+ }, [address, data])
233
+ ```
234
+
235
+ ### Signing a message
236
+
237
+ The Mezo Passport wallets supports message signing from `wagmi` lib, so signing
238
+ functions the same way as it does in `wagmi`:
239
+
240
+ ```
241
+ import { useSignMessage } from 'wagmi'
242
+
243
+ function App() {
244
+ const { signMessage } = useSignMessage()
245
+
246
+ return (
247
+ <button onClick={() => signMessage({ message: 'hello world' })}>
248
+ Sign message
249
+ </button>
250
+ )
251
+ }
252
+ ```
253
+
254
+ ### Mezo Matsnet transactions
255
+
256
+ Contracts integrations are handled the same way as in RainbowKit and Wagmi.
257
+
258
+ To send a specific Mezo Matsnet transaction from the underlying Mezo Matsnet
259
+ account, we can use a `useSendTransaction` hook from `@mezo-org/passport`:
260
+
261
+ ```
262
+ import { useSendTransaction } from "@mezo-org/passport"
263
+
264
+ const { sendTransaction } = useSendTransaction()
265
+
266
+ const onSendTransaction = async () => {
267
+ const result = await sendTransaction(
268
+ "<eth_address>",
269
+ 100000n,
270
+ "0x00", // can also pass some specific tx data
271
+ )
272
+
273
+ console.log(result?.hash)
274
+ }
275
+ ```
276
+
277
+ `sendTransaction` function takes three arguments:
278
+
279
+ - <string> address for which we want to send eth to
280
+ - <bigint> amount of matsnet btc (in matsnet sats) that we want to send
281
+ - <string> additional data that we would like to send with the transaction
282
+
283
+ ### BTC transactions
284
+
285
+ With `@mezo-org/passport` it's also possible to send BTC transactions from your
286
+ original Bitcoin account (not the underlying Mezo Matsnet account). For that, we
287
+ can use `useSendBitcoin` hook:
288
+
289
+ ```
290
+ import { useSendBitcoin } from "@mezo-org/passport"
291
+
292
+ const { sendBitcoin } = useSendBitcoin()
293
+
294
+ const onSendBitcoin = async () => {
295
+ const txHash = await sendBitcoin("<btc_address>", 1500)
296
+ console.log("txHash: ", txHash)
297
+ }
298
+ ```
299
+
300
+ `sendBitcoin` function takes two arguments:
301
+
302
+ - <string> address for which we want to send bitoins to
303
+ - <number> amount of bitcoins (in satoshis) that we want to send
@@ -8,7 +8,7 @@ export declare const defaultConfig: {
8
8
  chains: [Chain, ...Chain[]];
9
9
  multiInjectedProviderDiscovery: boolean;
10
10
  };
11
- export declare function getDefaultWallets(relayApiKey: string): WalletList;
11
+ export declare function getDefaultWallets(): WalletList;
12
12
  type WagmiConfigParameters = Omit<CreateConfigParameters, "client" | "connectors" | "chains" | "wallets" | "transports">;
13
13
  type GetDefaultConfigParameters = WagmiConfigParameters & {
14
14
  appName: string;
@@ -18,8 +18,7 @@ type GetDefaultConfigParameters = WagmiConfigParameters & {
18
18
  bitcoinWallets?: WalletList;
19
19
  walletConnectProjectId?: string;
20
20
  chains?: [Chain, ...Chain[]];
21
- relayApiKey: string;
22
21
  };
23
- export declare function getConfig({ appName, relayApiKey, bitcoinWallets, walletConnectProjectId, ...restParameters }: GetDefaultConfigParameters): Config;
22
+ export declare function getConfig({ appName, bitcoinWallets, walletConnectProjectId, ...restParameters }: GetDefaultConfigParameters): Config;
24
23
  export {};
25
24
  //# sourceMappingURL=config.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,KAAK,EAAoB,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC5E,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAQtD,eAAO,MAAM,aAAa;;;;;;;CAKzB,CAAA;AAED,wBAAgB,iBAAiB,CAAC,WAAW,EAAE,MAAM,GAAG,UAAU,CAkBjE;AAED,KAAK,qBAAqB,GAAG,IAAI,CAC/B,sBAAsB,EACtB,QAAQ,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,CAC9D,CAAA;AACD,KAAK,0BAA0B,GAAG,qBAAqB,GAAG;IACxD,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,UAAU,CAAA;IAC3B,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,CAAA;IAC5B,WAAW,EAAE,MAAM,CAAA;CACpB,CAAA;AAED,wBAAgB,SAAS,CAAC,EACxB,OAAO,EACP,WAAW,EACX,cAAc,EACd,sBAAsB,EACtB,GAAG,cAAc,EAClB,EAAE,0BAA0B,GAAG,MAAM,CAQrC"}
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,KAAK,EAAoB,UAAU,EAAE,MAAM,wBAAwB,CAAA;AAC5E,OAAO,EAAE,MAAM,EAAE,sBAAsB,EAAE,MAAM,OAAO,CAAA;AAQtD,eAAO,MAAM,aAAa;;;;;;;CAKzB,CAAA;AAED,wBAAgB,iBAAiB,IAAI,UAAU,CAkB9C;AAED,KAAK,qBAAqB,GAAG,IAAI,CAC/B,sBAAsB,EACtB,QAAQ,GAAG,YAAY,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,CAC9D,CAAA;AACD,KAAK,0BAA0B,GAAG,qBAAqB,GAAG;IACxD,OAAO,EAAE,MAAM,CAAA;IACf,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,cAAc,CAAC,EAAE,UAAU,CAAA;IAC3B,sBAAsB,CAAC,EAAE,MAAM,CAAA;IAC/B,MAAM,CAAC,EAAE,CAAC,KAAK,EAAE,GAAG,KAAK,EAAE,CAAC,CAAA;CAC7B,CAAA;AAED,wBAAgB,SAAS,CAAC,EACxB,OAAO,EACP,cAAc,EACd,sBAAsB,EACtB,GAAG,cAAc,EAClB,EAAE,0BAA0B,GAAG,MAAM,CAQrC"}
@@ -1,7 +1,6 @@
1
1
  import { http } from "viem";
2
- import { matsnetTestnetChain } from "@mezo-org/orangekit";
3
2
  import { getDefaultConfig } from "@rainbow-me/rainbowkit";
4
- import { CHAIN_ID, RPC_BY_NETWORK } from "./constants";
3
+ import { CHAIN_ID, matsnetTestnetChain, RPC_BY_NETWORK } from "./constants";
5
4
  import { getOKXWallet, getUnisatWallet, getXverseWallet } from "./wallet";
6
5
  const transports = {
7
6
  [CHAIN_ID.testnet]: http(RPC_BY_NETWORK.testnet),
@@ -12,12 +11,12 @@ export const defaultConfig = {
12
11
  chains: [matsnetTestnetChain],
13
12
  multiInjectedProviderDiscovery: true,
14
13
  };
15
- export function getDefaultWallets(relayApiKey) {
14
+ export function getDefaultWallets() {
16
15
  const bitcoinWalletConfig = {
17
16
  rpcUrl: RPC_BY_NETWORK.testnet,
18
17
  chainId: CHAIN_ID.testnet,
19
18
  // TODO: This will be removed once we merge passport relay worked is merged
20
- relayApiKey,
19
+ relayApiKey: "",
21
20
  };
22
21
  const unisatWallet = getUnisatWallet(bitcoinWalletConfig);
23
22
  const okxWallet = getOKXWallet(bitcoinWalletConfig);
@@ -29,11 +28,11 @@ export function getDefaultWallets(relayApiKey) {
29
28
  },
30
29
  ];
31
30
  }
32
- export function getConfig({ appName, relayApiKey, bitcoinWallets, walletConnectProjectId, ...restParameters }) {
31
+ export function getConfig({ appName, bitcoinWallets, walletConnectProjectId, ...restParameters }) {
33
32
  return getDefaultConfig({
34
33
  ...defaultConfig,
35
34
  appName,
36
- wallets: [...getDefaultWallets(relayApiKey), ...(bitcoinWallets ?? [])],
35
+ wallets: [...getDefaultWallets(), ...(bitcoinWallets ?? [])],
37
36
  projectId: walletConnectProjectId ?? defaultConfig.walletConnectProjectId,
38
37
  ...restParameters,
39
38
  });
@@ -1 +1 @@
1
- {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AACzD,OAAO,EAAS,gBAAgB,EAAc,MAAM,wBAAwB,CAAA;AAE5E,OAAO,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAEzE,MAAM,UAAU,GAAG;IACjB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;CACjD,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,UAAU;IACV,sBAAsB,EAAE,EAAE;IAC1B,MAAM,EAAE,CAAC,mBAAmB,CAAwB;IACpD,8BAA8B,EAAE,IAAI;CACrC,CAAA;AAED,MAAM,UAAU,iBAAiB,CAAC,WAAmB;IACnD,MAAM,mBAAmB,GAAG;QAC1B,MAAM,EAAE,cAAc,CAAC,OAAO;QAC9B,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,2EAA2E;QAC3E,WAAW;KACZ,CAAA;IAED,MAAM,YAAY,GAAG,eAAe,CAAC,mBAAmB,CAAC,CAAA;IACzD,MAAM,SAAS,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAA;IACnD,MAAM,YAAY,GAAG,eAAe,CAAC,mBAAmB,CAAC,CAAA;IAEzD,OAAO;QACL;YACE,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,YAAY,CAAC;SACjD;KACF,CAAA;AACH,CAAC;AAiBD,MAAM,UAAU,SAAS,CAAC,EACxB,OAAO,EACP,WAAW,EACX,cAAc,EACd,sBAAsB,EACtB,GAAG,cAAc,EACU;IAC3B,OAAO,gBAAgB,CAAC;QACtB,GAAG,aAAa;QAChB,OAAO;QACP,OAAO,EAAE,CAAC,GAAG,iBAAiB,CAAC,WAAW,CAAC,EAAE,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;QACvE,SAAS,EAAE,sBAAsB,IAAI,aAAa,CAAC,sBAAsB;QACzE,GAAG,cAAc;KAClB,CAAC,CAAA;AACJ,CAAC"}
1
+ {"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAA;AAC3B,OAAO,EAAS,gBAAgB,EAAc,MAAM,wBAAwB,CAAA;AAE5E,OAAO,EAAE,QAAQ,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,aAAa,CAAA;AAC3E,OAAO,EAAE,YAAY,EAAE,eAAe,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAEzE,MAAM,UAAU,GAAG;IACjB,CAAC,QAAQ,CAAC,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC;CACjD,CAAA;AAED,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,UAAU;IACV,sBAAsB,EAAE,EAAE;IAC1B,MAAM,EAAE,CAAC,mBAAmB,CAAwB;IACpD,8BAA8B,EAAE,IAAI;CACrC,CAAA;AAED,MAAM,UAAU,iBAAiB;IAC/B,MAAM,mBAAmB,GAAG;QAC1B,MAAM,EAAE,cAAc,CAAC,OAAO;QAC9B,OAAO,EAAE,QAAQ,CAAC,OAAO;QACzB,2EAA2E;QAC3E,WAAW,EAAE,EAAE;KAChB,CAAA;IAED,MAAM,YAAY,GAAG,eAAe,CAAC,mBAAmB,CAAC,CAAA;IACzD,MAAM,SAAS,GAAG,YAAY,CAAC,mBAAmB,CAAC,CAAA;IACnD,MAAM,YAAY,GAAG,eAAe,CAAC,mBAAmB,CAAC,CAAA;IAEzD,OAAO;QACL;YACE,SAAS,EAAE,SAAS;YACpB,OAAO,EAAE,CAAC,YAAY,EAAE,SAAS,EAAE,YAAY,CAAC;SACjD;KACF,CAAA;AACH,CAAC;AAgBD,MAAM,UAAU,SAAS,CAAC,EACxB,OAAO,EACP,cAAc,EACd,sBAAsB,EACtB,GAAG,cAAc,EACU;IAC3B,OAAO,gBAAgB,CAAC;QACtB,GAAG,aAAa;QAChB,OAAO;QACP,OAAO,EAAE,CAAC,GAAG,iBAAiB,EAAE,EAAE,GAAG,CAAC,cAAc,IAAI,EAAE,CAAC,CAAC;QAC5D,SAAS,EAAE,sBAAsB,IAAI,aAAa,CAAC,sBAAsB;QACzE,GAAG,cAAc;KAClB,CAAC,CAAA;AACJ,CAAC"}
@@ -1,3 +1,4 @@
1
+ export { matsnetTestnetChain } from "@mezo-org/orangekit";
1
2
  export declare const CHAIN_ID: {
2
3
  testnet: 31611;
3
4
  };
@@ -1 +1 @@
1
- {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,QAAQ;;CAEpB,CAAA;AAED,eAAO,MAAM,cAAc;;CAE1B,CAAA"}
1
+ {"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD,eAAO,MAAM,QAAQ;;CAEpB,CAAA;AAED,eAAO,MAAM,cAAc;;CAE1B,CAAA"}
@@ -1,4 +1,5 @@
1
1
  import { matsnetTestnetChain } from "@mezo-org/orangekit";
2
+ export { matsnetTestnetChain } from "@mezo-org/orangekit";
2
3
  export const CHAIN_ID = {
3
4
  testnet: matsnetTestnetChain.id,
4
5
  };
@@ -1 +1 @@
1
- {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,mBAAmB,CAAC,EAAE;CAChC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CACrD,CAAA"}
1
+ {"version":3,"file":"constants.js","sourceRoot":"","sources":["../../src/constants.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAA;AAEzD,MAAM,CAAC,MAAM,QAAQ,GAAG;IACtB,OAAO,EAAE,mBAAmB,CAAC,EAAE;CAChC,CAAA;AAED,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,OAAO,EAAE,mBAAmB,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC;CACrD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mezo-org/passport",
3
- "version": "0.1.0-dev.0",
3
+ "version": "0.1.0-dev.1",
4
4
  "main": "dist/src/index.js",
5
5
  "license": "GPL-3.0-only",
6
6
  "scripts": {
@@ -19,8 +19,8 @@
19
19
  ],
20
20
  "repository": {
21
21
  "type": "git",
22
- "url": "https://github.com/thesis/orangekit.git",
23
- "directory": "typescript/react"
22
+ "url": "https://github.com/mezo-org/passport.git",
23
+ "directory": "typescript/passport"
24
24
  },
25
25
  "devDependencies": {
26
26
  "@babel/preset-env": "^7.23.7",
@@ -36,7 +36,7 @@
36
36
  "typescript": "^5.4.3"
37
37
  },
38
38
  "dependencies": {
39
- "@mezo-org/orangekit": "1.0.0-beta.36-dev.0",
39
+ "@mezo-org/orangekit": "1.0.0-beta.36-dev.2",
40
40
  "@rainbow-me/rainbowkit": "2.0.2",
41
41
  "react": "^18.2.0",
42
42
  "viem": "2.8.16",
package/src/config.ts CHANGED
@@ -1,8 +1,7 @@
1
1
  import { http } from "viem"
2
- import { matsnetTestnetChain } from "@mezo-org/orangekit"
3
2
  import { Chain, getDefaultConfig, WalletList } from "@rainbow-me/rainbowkit"
4
3
  import { Config, CreateConfigParameters } from "wagmi"
5
- import { CHAIN_ID, RPC_BY_NETWORK } from "./constants"
4
+ import { CHAIN_ID, matsnetTestnetChain, RPC_BY_NETWORK } from "./constants"
6
5
  import { getOKXWallet, getUnisatWallet, getXverseWallet } from "./wallet"
7
6
 
8
7
  const transports = {
@@ -16,12 +15,12 @@ export const defaultConfig = {
16
15
  multiInjectedProviderDiscovery: true,
17
16
  }
18
17
 
19
- export function getDefaultWallets(relayApiKey: string): WalletList {
18
+ export function getDefaultWallets(): WalletList {
20
19
  const bitcoinWalletConfig = {
21
20
  rpcUrl: RPC_BY_NETWORK.testnet,
22
21
  chainId: CHAIN_ID.testnet,
23
22
  // TODO: This will be removed once we merge passport relay worked is merged
24
- relayApiKey,
23
+ relayApiKey: "",
25
24
  }
26
25
 
27
26
  const unisatWallet = getUnisatWallet(bitcoinWalletConfig)
@@ -48,12 +47,10 @@ type GetDefaultConfigParameters = WagmiConfigParameters & {
48
47
  bitcoinWallets?: WalletList
49
48
  walletConnectProjectId?: string
50
49
  chains?: [Chain, ...Chain[]]
51
- relayApiKey: string
52
50
  }
53
51
 
54
52
  export function getConfig({
55
53
  appName,
56
- relayApiKey,
57
54
  bitcoinWallets,
58
55
  walletConnectProjectId,
59
56
  ...restParameters
@@ -61,7 +58,7 @@ export function getConfig({
61
58
  return getDefaultConfig({
62
59
  ...defaultConfig,
63
60
  appName,
64
- wallets: [...getDefaultWallets(relayApiKey), ...(bitcoinWallets ?? [])],
61
+ wallets: [...getDefaultWallets(), ...(bitcoinWallets ?? [])],
65
62
  projectId: walletConnectProjectId ?? defaultConfig.walletConnectProjectId,
66
63
  ...restParameters,
67
64
  })
package/src/constants.ts CHANGED
@@ -1,5 +1,7 @@
1
1
  import { matsnetTestnetChain } from "@mezo-org/orangekit"
2
2
 
3
+ export { matsnetTestnetChain } from "@mezo-org/orangekit"
4
+
3
5
  export const CHAIN_ID = {
4
6
  testnet: matsnetTestnetChain.id,
5
7
  }