ani-ads-sdk 1.0.2 → 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 +49 -30
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,27 +1,26 @@
|
|
|
1
1
|
# Ani Ads SDK
|
|
2
2
|
|
|
3
|
-
SDK
|
|
3
|
+
React SDK for Mini App Creators to display ads in their apps.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
7
7
|
```bash
|
|
8
|
-
npm install
|
|
9
|
-
#
|
|
10
|
-
pnpm add
|
|
8
|
+
npm install ani-ads-sdk
|
|
9
|
+
# or
|
|
10
|
+
pnpm add ani-ads-sdk
|
|
11
11
|
```
|
|
12
12
|
|
|
13
|
-
##
|
|
13
|
+
## Usage
|
|
14
14
|
|
|
15
15
|
```tsx
|
|
16
|
-
import { AniAds } from '
|
|
16
|
+
import { AniAds } from 'ani-ads-sdk'
|
|
17
17
|
|
|
18
18
|
function MyApp() {
|
|
19
19
|
return (
|
|
20
20
|
<AniAds
|
|
21
|
-
creator_code="
|
|
21
|
+
creator_code="YOUR_CREATOR_CODE"
|
|
22
22
|
user_wallet_address="0x..."
|
|
23
|
-
|
|
24
|
-
api_url="https://your-domain.com" // Optional
|
|
23
|
+
api_url="https://ani-ads.vercel.app" // Optional
|
|
25
24
|
onAdClick={(adId, url) => console.log('Ad clicked:', adId, url)} // Optional
|
|
26
25
|
/>
|
|
27
26
|
)
|
|
@@ -30,32 +29,52 @@ function MyApp() {
|
|
|
30
29
|
|
|
31
30
|
## Props
|
|
32
31
|
|
|
33
|
-
- `creator_code` (string, required):
|
|
34
|
-
- `user_wallet_address` (string, required):
|
|
35
|
-
- `
|
|
36
|
-
- `
|
|
37
|
-
- `onAdClick` (function, optional): Callback wenn Ad geklickt wird
|
|
32
|
+
- `creator_code` (string, required): Your unique creator code from the Ani Ads platform
|
|
33
|
+
- `user_wallet_address` (string, required): The wallet address of the current user viewing your app
|
|
34
|
+
- `api_url` (string, optional): API URL (defaults to production URL)
|
|
35
|
+
- `onAdClick` (function, optional): Callback function when an ad is clicked
|
|
38
36
|
|
|
39
|
-
##
|
|
37
|
+
## Ad Format
|
|
40
38
|
|
|
41
|
-
|
|
42
|
-
- `"9:16"` oder `"916"` - Hochformat (Portrait)
|
|
43
|
-
- `"16:9"` oder `"169"` - Querformat (Landscape)
|
|
39
|
+
All ads are displayed in a **380x90px banner format**. The SDK automatically handles image loading and display.
|
|
44
40
|
|
|
45
|
-
##
|
|
41
|
+
## How It Works
|
|
46
42
|
|
|
47
|
-
|
|
43
|
+
The SDK communicates with the Ani Ads API to:
|
|
44
|
+
1. Fetch available ads for your creator code
|
|
45
|
+
2. Display ads in the banner format
|
|
46
|
+
3. Track clicks and process payments automatically
|
|
48
47
|
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
48
|
+
**Important**: The SDK handles all backend communication automatically. You don't need to worry about:
|
|
49
|
+
- Unique user tracking (handled automatically)
|
|
50
|
+
- Payment processing (handled automatically)
|
|
51
|
+
- Ad rotation (handled automatically)
|
|
52
52
|
|
|
53
|
-
|
|
54
|
-
- Smart Contract Write-Operationen müssen vom Contract Creator signiert werden (Private Key im Backend)
|
|
55
|
-
- Datenbank-Zugriff läuft über die API für Sicherheit und Validierung
|
|
53
|
+
## Requirements
|
|
56
54
|
|
|
57
|
-
|
|
58
|
-
-
|
|
59
|
-
- Zahlung im Smart Contract verarbeitet
|
|
60
|
-
- Earnings in der Datenbank aktualisiert
|
|
55
|
+
- React 18+ or React 19+
|
|
56
|
+
- A creator code from the Ani Ads platform
|
|
61
57
|
|
|
58
|
+
## Example
|
|
59
|
+
|
|
60
|
+
```tsx
|
|
61
|
+
import React from 'react'
|
|
62
|
+
import { AniAds } from 'ani-ads-sdk'
|
|
63
|
+
|
|
64
|
+
function MyMiniApp() {
|
|
65
|
+
const userWallet = "0x1234..." // Get from your wallet connection
|
|
66
|
+
|
|
67
|
+
return (
|
|
68
|
+
<div>
|
|
69
|
+
<h1>My Mini App</h1>
|
|
70
|
+
<AniAds
|
|
71
|
+
creator_code="ABC123XY"
|
|
72
|
+
user_wallet_address={userWallet}
|
|
73
|
+
onAdClick={(adId, url) => {
|
|
74
|
+
console.log(`Ad ${adId} clicked, opening ${url}`)
|
|
75
|
+
}}
|
|
76
|
+
/>
|
|
77
|
+
</div>
|
|
78
|
+
)
|
|
79
|
+
}
|
|
80
|
+
```
|