@bootnodedev/canton-connect 0.3.0 → 0.3.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 +33 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.js +5 -1
- package/dist/testing/index.d.ts +1 -1
- package/dist/{types-Deu_03jh.d.ts → types-CmnMRMoG.d.ts} +16 -1
- package/package.json +6 -6
package/README.md
CHANGED
|
@@ -116,6 +116,39 @@ and a wallet-side disconnect look the same
|
|
|
116
116
|
here. `useLedger().isReady` covers both, and `useParty().party` is `undefined` for the duration:
|
|
117
117
|
gate session content on the party, and use `isLocked` only to explain why it went away.
|
|
118
118
|
|
|
119
|
+
### Connecting through a Wallet Gateway
|
|
120
|
+
|
|
121
|
+
```tsx
|
|
122
|
+
import { RemoteAdapter } from '@canton-network/dapp-sdk'
|
|
123
|
+
|
|
124
|
+
const config = {
|
|
125
|
+
appName: 'My dApp',
|
|
126
|
+
additionalAdapters: [
|
|
127
|
+
new RemoteAdapter({ name: 'Gateway', rpcUrl: 'http://localhost:3030/api/v0/dapp' }),
|
|
128
|
+
],
|
|
129
|
+
}
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
> [!NOTE]
|
|
133
|
+
> The dapp-sdk wallet picker also lets a user paste any gateway URL and connect to it without the
|
|
134
|
+
> dApp listing it. That session does not survive a reload; one with a gateway listed here does.
|
|
135
|
+
|
|
136
|
+
Details in [architecture.md](https://github.com/BootNodeDev/canton-dappbooster/blob/main/canton-connect/architecture.md#remote-gateway).
|
|
137
|
+
|
|
138
|
+
### Connecting through WalletConnect
|
|
139
|
+
|
|
140
|
+
```tsx
|
|
141
|
+
const config = {
|
|
142
|
+
appName: 'My dApp',
|
|
143
|
+
networkId: 'canton:devnet',
|
|
144
|
+
walletConnectProjectId: 'YOUR_REOWN_PROJECT_ID',
|
|
145
|
+
}
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
`networkId` is the Canton network the dApp targets, as a CAIP-2 chain id.
|
|
149
|
+
|
|
150
|
+
Details in [architecture.md](https://github.com/BootNodeDev/canton-dappbooster/blob/main/canton-connect/architecture.md#walletconnect).
|
|
151
|
+
|
|
119
152
|
## Reference
|
|
120
153
|
|
|
121
154
|
Every hook and every config field is documented in JSDoc, which your editor surfaces at the call
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Party, c as WalletSdk, i as ConnectionSubscription, l as ConnectionInput, n as CantonConnectContextValue, o as PartyType, r as ConnectionStatus, s as TxStatusSnapshot, t as CantonConnectConfig, u as InitOptions } from "./types-
|
|
1
|
+
import { a as Party, c as WalletSdk, i as ConnectionSubscription, l as ConnectionInput, n as CantonConnectContextValue, o as PartyType, r as ConnectionStatus, s as TxStatusSnapshot, t as CantonConnectConfig, u as InitOptions } from "./types-CmnMRMoG.js";
|
|
2
2
|
import { LedgerApiParams, PrepareExecuteParams, ProviderAdapter } from "@canton-network/dapp-sdk";
|
|
3
3
|
import { JSX, ReactNode } from "react";
|
|
4
4
|
//#region src/CantonConnectProvider/index.d.ts
|
|
@@ -172,7 +172,11 @@ interface UseLedgerResult {
|
|
|
172
172
|
*
|
|
173
173
|
* @example
|
|
174
174
|
* const { ledgerApi } = useLedger()
|
|
175
|
-
* await ledgerApi({
|
|
175
|
+
* await ledgerApi({
|
|
176
|
+
* requestMethod: 'get',
|
|
177
|
+
* resource: '/v2/users/{user-id}/rights',
|
|
178
|
+
* path: { 'user-id': 'alice' },
|
|
179
|
+
* })
|
|
176
180
|
*
|
|
177
181
|
* @category Hooks
|
|
178
182
|
*/
|
package/dist/index.js
CHANGED
|
@@ -188,7 +188,11 @@ const useExecute = () => {
|
|
|
188
188
|
*
|
|
189
189
|
* @example
|
|
190
190
|
* const { ledgerApi } = useLedger()
|
|
191
|
-
* await ledgerApi({
|
|
191
|
+
* await ledgerApi({
|
|
192
|
+
* requestMethod: 'get',
|
|
193
|
+
* resource: '/v2/users/{user-id}/rights',
|
|
194
|
+
* path: { 'user-id': 'alice' },
|
|
195
|
+
* })
|
|
192
196
|
*
|
|
193
197
|
* @category Hooks
|
|
194
198
|
*/
|
package/dist/testing/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { a as Party, c as WalletSdk, r as ConnectionStatus } from "../types-
|
|
1
|
+
import { a as Party, c as WalletSdk, r as ConnectionStatus } from "../types-CmnMRMoG.js";
|
|
2
2
|
import { WalletPickerFn } from "@canton-network/dapp-sdk";
|
|
3
3
|
import { JSX, ReactNode } from "react";
|
|
4
4
|
//#region src/testing/autoPicker.d.ts
|
|
@@ -329,7 +329,22 @@ interface Party {
|
|
|
329
329
|
* and that surface is yours. The app fields stay inert until `walletConnectProjectId` (Reown) is set.
|
|
330
330
|
*
|
|
331
331
|
* @example
|
|
332
|
-
* const config: CantonConnectConfig = {
|
|
332
|
+
* const config: CantonConnectConfig = {
|
|
333
|
+
* appName: 'Vesting',
|
|
334
|
+
* networkId: 'canton:devnet',
|
|
335
|
+
* walletConnectProjectId: 'REOWN_PROJECT_ID',
|
|
336
|
+
* }
|
|
337
|
+
*
|
|
338
|
+
* @example
|
|
339
|
+
* import type { CantonConnectConfig } from '#src/types'
|
|
340
|
+
* import { RemoteAdapter } from '@canton-network/dapp-sdk'
|
|
341
|
+
*
|
|
342
|
+
* const config: CantonConnectConfig = {
|
|
343
|
+
* appName: 'Vesting',
|
|
344
|
+
* additionalAdapters: [
|
|
345
|
+
* new RemoteAdapter({ name: 'Gateway', rpcUrl: 'https://gateway.example.com/dapp' }),
|
|
346
|
+
* ],
|
|
347
|
+
* }
|
|
333
348
|
*
|
|
334
349
|
* @category Configuration
|
|
335
350
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bootnodedev/canton-connect",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "wagmi-style React hooks for connecting Canton dApps to CIP-0103 wallets",
|
|
5
|
+
"repository": {
|
|
6
|
+
"type": "git",
|
|
7
|
+
"url": "git+https://github.com/BootNodeDev/canton-dappbooster.git",
|
|
8
|
+
"directory": "canton-connect"
|
|
9
|
+
},
|
|
5
10
|
"license": "MIT",
|
|
6
11
|
"type": "module",
|
|
7
12
|
"private": false,
|
|
@@ -44,11 +49,6 @@
|
|
|
44
49
|
"@walletconnect/sign-client": "^2.23.9",
|
|
45
50
|
"react": "^19.0.0"
|
|
46
51
|
},
|
|
47
|
-
"peerDependenciesMeta": {
|
|
48
|
-
"@walletconnect/sign-client": {
|
|
49
|
-
"optional": true
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@canton-network/core-types": "1.10.0",
|
|
54
54
|
"@canton-network/dapp-sdk": "1.5.1",
|