wallet-connect-button-vue 1.0.3 → 1.0.5
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 +52 -1
- package/dist/index.esm.js +6 -5
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +6 -5
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +1 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,5 +1,56 @@
|
|
|
1
1
|
# wallet-connect-button-vue
|
|
2
2
|
|
|
3
|
-
A Vue component for
|
|
3
|
+
A Vue 3 component for NL Wallet integration.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npm install wallet-connect-button-vue
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## Usage
|
|
12
|
+
|
|
13
|
+
1. Import the component in your Vue app:
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import { WalletConnectButton } from 'wallet-connect-button-vue';
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
2. Use the component in your template:
|
|
20
|
+
|
|
21
|
+
```vue
|
|
22
|
+
<template>
|
|
23
|
+
<WalletConnectButton
|
|
24
|
+
:client-id="'your-client-id'"
|
|
25
|
+
:api-key="'your-api-key'"
|
|
26
|
+
:wallet-connect-host="'https://wallet-connect.eu'"
|
|
27
|
+
:label="'Connect Wallet'"
|
|
28
|
+
@success="onWalletSuccess" />
|
|
29
|
+
</template>
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
3. Handle the success event in your component:
|
|
33
|
+
|
|
34
|
+
```typescript
|
|
35
|
+
<script setup>
|
|
36
|
+
const onWalletSuccess = (attributes: any) => {
|
|
37
|
+
console.log('Wallet connected successfully:', attributes);
|
|
38
|
+
}
|
|
39
|
+
</script>
|
|
40
|
+
```
|
|
41
|
+
|
|
42
|
+
## API
|
|
43
|
+
|
|
44
|
+
### Props
|
|
45
|
+
|
|
46
|
+
- `clientId: string` - Required. Your client ID for wallet connection
|
|
47
|
+
- `apiKey?: string` - Optional. API key for authentication
|
|
48
|
+
- `walletConnectHost?: string` - Optional. Custom wallet connect host URL (defaults to https://wallet-connect.eu)
|
|
49
|
+
- `label?: string` - Optional. Custom button text (defaults to 'Inloggen met NL Wallet')
|
|
50
|
+
- `lang?: string` - Optional. Language setting for the wallet button (defaults to 'nl')
|
|
51
|
+
|
|
52
|
+
### Events
|
|
53
|
+
|
|
54
|
+
- `success` - Emitted when wallet connection succeeds
|
|
4
55
|
|
|
5
56
|
For further explanation and documentation, visit: https://wallet-connect.eu
|
package/dist/index.esm.js
CHANGED
|
@@ -38,7 +38,7 @@ const _hoisted_2 = {
|
|
|
38
38
|
class: "attributes"
|
|
39
39
|
};
|
|
40
40
|
const _hoisted_3 = { class: "verification-card" };
|
|
41
|
-
const _hoisted_4 = ["text", "usecase", "start-url"];
|
|
41
|
+
const _hoisted_4 = ["text", "usecase", "start-url", "lang"];
|
|
42
42
|
|
|
43
43
|
|
|
44
44
|
const _sfc_main = {
|
|
@@ -48,7 +48,8 @@ const _sfc_main = {
|
|
|
48
48
|
clientId: { type: String, required: true },
|
|
49
49
|
onSuccess: { type: Function, required: true },
|
|
50
50
|
apiKey: { type: String, required: false },
|
|
51
|
-
walletConnectHost: { type: String, required: false }
|
|
51
|
+
walletConnectHost: { type: String, required: false },
|
|
52
|
+
lang: { type: String, required: false, default: 'nl' }
|
|
52
53
|
},
|
|
53
54
|
setup(__props) {
|
|
54
55
|
|
|
@@ -62,7 +63,7 @@ const buttonRef = ref(null);
|
|
|
62
63
|
const startUrl = computed(() => {
|
|
63
64
|
const baseUrl = props.walletConnectHost || 'https://wallet-connect.eu';
|
|
64
65
|
const returnUrl = typeof window !== 'undefined' ? window.location.href : '';
|
|
65
|
-
return `${baseUrl}/create-session?lang=en&return_url=${encodeURIComponent(returnUrl)}`;
|
|
66
|
+
return `${baseUrl}/api/create-session?lang=en&return_url=${encodeURIComponent(returnUrl)}`;
|
|
66
67
|
});
|
|
67
68
|
|
|
68
69
|
const handleSuccess = (e) => {
|
|
@@ -105,7 +106,7 @@ const fetchDisclosedAttributes = async () => {
|
|
|
105
106
|
|
|
106
107
|
loading.value = true;
|
|
107
108
|
const baseUrl = props.walletConnectHost || "https://wallet-connect.eu";
|
|
108
|
-
let url = baseUrl + `/disclosed-attributes?session_token=${session_token}&client_id=${props.clientId}`;
|
|
109
|
+
let url = baseUrl + `/api/disclosed-attributes?session_token=${session_token}&client_id=${props.clientId}`;
|
|
109
110
|
if (nonce) url = `${url}&nonce=${nonce}`;
|
|
110
111
|
|
|
111
112
|
const headers = props.apiKey ? { 'Authorization': `Bearer ${props.apiKey}` } : {};
|
|
@@ -160,7 +161,7 @@ return (_ctx, _cache) => {
|
|
|
160
161
|
text: props.label,
|
|
161
162
|
usecase: __props.clientId,
|
|
162
163
|
"start-url": startUrl.value,
|
|
163
|
-
lang:
|
|
164
|
+
lang: props.lang
|
|
164
165
|
}, null, 8 /* PROPS */, _hoisted_4))
|
|
165
166
|
}
|
|
166
167
|
}
|