@bbuilders/djeon402-sdk-client 1.0.1 → 1.0.3
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 +18 -13
- package/package.json +2 -7
package/README.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @bbuilders/djeon402
|
|
1
|
+
# @bbuilders/djeon402-sdk-client
|
|
2
2
|
|
|
3
3
|
Browser SDK for DJEON402 token with React hooks and Vue composables support.
|
|
4
4
|
|
|
@@ -15,13 +15,13 @@ Browser SDK for DJEON402 token with React hooks and Vue composables support.
|
|
|
15
15
|
|
|
16
16
|
```bash
|
|
17
17
|
# npm
|
|
18
|
-
npm install @bbuilders/djeon402
|
|
18
|
+
npm install @bbuilders/djeon402-sdk-client viem wagmi
|
|
19
19
|
|
|
20
20
|
# pnpm
|
|
21
|
-
pnpm add @bbuilders/djeon402
|
|
21
|
+
pnpm add @bbuilders/djeon402-sdk-client viem wagmi
|
|
22
22
|
|
|
23
23
|
# yarn
|
|
24
|
-
yarn add @bbuilders/djeon402
|
|
24
|
+
yarn add @bbuilders/djeon402-sdk-client viem wagmi
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
## Quick Start
|
|
@@ -31,7 +31,7 @@ yarn add @bbuilders/djeon402/sdk-client viem wagmi
|
|
|
31
31
|
#### 1. Setup Provider
|
|
32
32
|
|
|
33
33
|
```tsx
|
|
34
|
-
import { Djeon402Provider } from '@bbuilders/djeon402
|
|
34
|
+
import { Djeon402Provider } from '@bbuilders/djeon402-sdk-client/react';
|
|
35
35
|
import { WagmiProvider, createConfig, http } from 'wagmi';
|
|
36
36
|
import { QueryClient, QueryClientProvider } from '@tanstack/react-query';
|
|
37
37
|
|
|
@@ -72,7 +72,7 @@ function App() {
|
|
|
72
72
|
|
|
73
73
|
```tsx
|
|
74
74
|
import { useAccount } from 'wagmi';
|
|
75
|
-
import { useBalance, useTransfer } from '@bbuilders/djeon402
|
|
75
|
+
import { useBalance, useTransfer } from '@bbuilders/djeon402-sdk-client/react';
|
|
76
76
|
|
|
77
77
|
// Test account addresses
|
|
78
78
|
const RECIPIENT_ADDRESS = '0x...';
|
|
@@ -109,7 +109,7 @@ function TokenDashboard() {
|
|
|
109
109
|
|
|
110
110
|
```vue
|
|
111
111
|
<script setup lang="ts">
|
|
112
|
-
import { provideDjeon402 } from '@bbuilders/djeon402
|
|
112
|
+
import { provideDjeon402 } from '@bbuilders/djeon402-sdk-client/vue';
|
|
113
113
|
|
|
114
114
|
// Configuration constants
|
|
115
115
|
const DJEON402_CONTRACT = '0x....';
|
|
@@ -135,7 +135,7 @@ provideDjeon402({
|
|
|
135
135
|
```vue
|
|
136
136
|
<script setup lang="ts">
|
|
137
137
|
import { ref, computed } from 'vue';
|
|
138
|
-
import { useBalance, useTransfer } from '@bbuilders/djeon402
|
|
138
|
+
import { useBalance, useTransfer } from '@bbuilders/djeon402-sdk-client/vue';
|
|
139
139
|
import { useWalletClient } from '@wagmi/vue';
|
|
140
140
|
|
|
141
141
|
// Test account addresses
|
|
@@ -168,7 +168,7 @@ const handleTransfer = async () => {
|
|
|
168
168
|
### Vanilla JavaScript
|
|
169
169
|
|
|
170
170
|
```typescript
|
|
171
|
-
import { Djeon402ClientSDK } from '@bbuilders/djeon402
|
|
171
|
+
import { Djeon402ClientSDK } from '@bbuilders/djeon402-sdk-client';
|
|
172
172
|
import { createWalletClient, custom } from 'viem';
|
|
173
173
|
|
|
174
174
|
// Configuration constants
|
|
@@ -239,7 +239,7 @@ Same API as React hooks, compatible with Vue 3 reactivity.
|
|
|
239
239
|
### Gasless Payment (x402)
|
|
240
240
|
|
|
241
241
|
```tsx
|
|
242
|
-
import { useX402Transfer } from '@bbuilders/djeon402
|
|
242
|
+
import { useX402Transfer } from '@bbuilders/djeon402-sdk-client/react';
|
|
243
243
|
|
|
244
244
|
// Merchant configuration
|
|
245
245
|
const MERCHANT_ADDRESS = '0xMerchantAddress...';
|
|
@@ -269,7 +269,7 @@ function CheckoutButton() {
|
|
|
269
269
|
### Receive Authorization (Payee-Initiated)
|
|
270
270
|
|
|
271
271
|
```tsx
|
|
272
|
-
import { useX402Receive } from '@bbuilders/djeon402
|
|
272
|
+
import { useX402Receive } from '@bbuilders/djeon402-sdk-client/react';
|
|
273
273
|
|
|
274
274
|
function ReceiveButton() {
|
|
275
275
|
const { signReceive } = useX402Receive();
|
|
@@ -295,7 +295,7 @@ function ReceiveButton() {
|
|
|
295
295
|
### Auto-Handle 402 Payment Required
|
|
296
296
|
|
|
297
297
|
```typescript
|
|
298
|
-
import { Djeon402ClientSDK } from '@bbuilders/djeon402
|
|
298
|
+
import { Djeon402ClientSDK } from '@bbuilders/djeon402-sdk-client';
|
|
299
299
|
|
|
300
300
|
const sdk = new Djeon402ClientSDK({ contractAddress: '0x...', chainId: 31337 });
|
|
301
301
|
|
|
@@ -310,7 +310,7 @@ const response = await sdk.x402.fetchWithPayment(walletClient, '/api/content/art
|
|
|
310
310
|
|
|
311
311
|
```tsx
|
|
312
312
|
import { useAccount } from 'wagmi';
|
|
313
|
-
import { useKYCData, useTransfer } from '@bbuilders/djeon402
|
|
313
|
+
import { useKYCData, useTransfer } from '@bbuilders/djeon402-sdk-client/react';
|
|
314
314
|
|
|
315
315
|
// Transfer configuration
|
|
316
316
|
const RECIPIENT_ADDRESS = '0xRecipientAddress...';
|
|
@@ -350,6 +350,11 @@ function SecureTransfer() {
|
|
|
350
350
|
- viem ^2.0.0
|
|
351
351
|
- @tanstack/react-query ^5.0.0 (for React)
|
|
352
352
|
|
|
353
|
+
## Related Packages
|
|
354
|
+
|
|
355
|
+
- [@bbuilders/djeon402-core](https://www.npmjs.com/package/@bbuilders/djeon402-core) - Core types and utilities
|
|
356
|
+
- [@bbuilders/djeon402-sdk-node](https://www.npmjs.com/package/@bbuilders/djeon402-sdk-node) - Node.js/Backend SDK
|
|
357
|
+
|
|
353
358
|
## License
|
|
354
359
|
|
|
355
360
|
MIT
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@bbuilders/djeon402-sdk-client",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.3",
|
|
4
4
|
"description": "DJEON402 SDK for browser and frontend applications (React, Vue)",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"djeon402",
|
|
@@ -16,13 +16,8 @@
|
|
|
16
16
|
"ethereum",
|
|
17
17
|
"wagmi"
|
|
18
18
|
],
|
|
19
|
-
"author": "
|
|
19
|
+
"author": "bbuilders <dev@bbuilders.xyz>",
|
|
20
20
|
"license": "MIT",
|
|
21
|
-
"repository": {
|
|
22
|
-
"type": "git",
|
|
23
|
-
"url": "https://github.com/yourorg/dongjeon402-sdk.git",
|
|
24
|
-
"directory": "packages/sdk-client"
|
|
25
|
-
},
|
|
26
21
|
"type": "module",
|
|
27
22
|
"main": "./dist/index.cjs",
|
|
28
23
|
"module": "./dist/index.mjs",
|