@adland/data 0.14.2 → 0.15.0
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/CHANGELOG.md +12 -0
- package/README.md +45 -177
- package/dist/index.cjs +62 -67
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +30 -30
- package/dist/index.d.ts +30 -30
- package/dist/index.js +62 -67
- package/dist/index.js.map +1 -1
- package/package.json +3 -3
package/dist/index.d.cts
CHANGED
|
@@ -10,8 +10,8 @@ declare const castAd: AdDefinition<z.ZodObject<{
|
|
|
10
10
|
}, z.core.$strip>, z.ZodObject<{
|
|
11
11
|
username: z.ZodOptional<z.ZodString>;
|
|
12
12
|
pfpUrl: z.ZodOptional<z.ZodString>;
|
|
13
|
-
text: z.
|
|
14
|
-
timestamp: z.
|
|
13
|
+
text: z.ZodString;
|
|
14
|
+
timestamp: z.ZodString;
|
|
15
15
|
}, z.core.$strip>> & {
|
|
16
16
|
process: (input: {
|
|
17
17
|
hash: string;
|
|
@@ -20,10 +20,10 @@ declare const castAd: AdDefinition<z.ZodObject<{
|
|
|
20
20
|
hash: string;
|
|
21
21
|
};
|
|
22
22
|
metadata: {
|
|
23
|
+
text: string;
|
|
24
|
+
timestamp: string;
|
|
23
25
|
username?: string | undefined;
|
|
24
26
|
pfpUrl?: string | undefined;
|
|
25
|
-
text?: string | undefined;
|
|
26
|
-
timestamp?: number | undefined;
|
|
27
27
|
} | undefined;
|
|
28
28
|
}>;
|
|
29
29
|
safeProcess: (input: {
|
|
@@ -34,10 +34,10 @@ declare const castAd: AdDefinition<z.ZodObject<{
|
|
|
34
34
|
hash: string;
|
|
35
35
|
} | undefined;
|
|
36
36
|
metadata?: {
|
|
37
|
+
text: string;
|
|
38
|
+
timestamp: string;
|
|
37
39
|
username?: string | undefined;
|
|
38
40
|
pfpUrl?: string | undefined;
|
|
39
|
-
text?: string | undefined;
|
|
40
|
-
timestamp?: number | undefined;
|
|
41
41
|
} | undefined;
|
|
42
42
|
error?: z.ZodError | string;
|
|
43
43
|
}>;
|
|
@@ -452,8 +452,8 @@ declare const ads: {
|
|
|
452
452
|
}, z.core.$strip>, z.ZodObject<{
|
|
453
453
|
username: z.ZodOptional<z.ZodString>;
|
|
454
454
|
pfpUrl: z.ZodOptional<z.ZodString>;
|
|
455
|
-
text: z.
|
|
456
|
-
timestamp: z.
|
|
455
|
+
text: z.ZodString;
|
|
456
|
+
timestamp: z.ZodString;
|
|
457
457
|
}, z.core.$strip>> & {
|
|
458
458
|
process: (input: {
|
|
459
459
|
hash: string;
|
|
@@ -462,10 +462,10 @@ declare const ads: {
|
|
|
462
462
|
hash: string;
|
|
463
463
|
};
|
|
464
464
|
metadata: {
|
|
465
|
+
text: string;
|
|
466
|
+
timestamp: string;
|
|
465
467
|
username?: string | undefined;
|
|
466
468
|
pfpUrl?: string | undefined;
|
|
467
|
-
text?: string | undefined;
|
|
468
|
-
timestamp?: number | undefined;
|
|
469
469
|
} | undefined;
|
|
470
470
|
}>;
|
|
471
471
|
safeProcess: (input: {
|
|
@@ -476,10 +476,10 @@ declare const ads: {
|
|
|
476
476
|
hash: string;
|
|
477
477
|
} | undefined;
|
|
478
478
|
metadata?: {
|
|
479
|
+
text: string;
|
|
480
|
+
timestamp: string;
|
|
479
481
|
username?: string | undefined;
|
|
480
482
|
pfpUrl?: string | undefined;
|
|
481
|
-
text?: string | undefined;
|
|
482
|
-
timestamp?: number | undefined;
|
|
483
483
|
} | undefined;
|
|
484
484
|
error?: z.ZodError | string;
|
|
485
485
|
}>;
|
|
@@ -661,8 +661,8 @@ declare function getAd(type: AdType): (AdDefinition<z.ZodObject<{
|
|
|
661
661
|
}, z.core.$strip>, z.ZodObject<{
|
|
662
662
|
username: z.ZodOptional<z.ZodString>;
|
|
663
663
|
pfpUrl: z.ZodOptional<z.ZodString>;
|
|
664
|
-
text: z.
|
|
665
|
-
timestamp: z.
|
|
664
|
+
text: z.ZodString;
|
|
665
|
+
timestamp: z.ZodString;
|
|
666
666
|
}, z.core.$strip>> & {
|
|
667
667
|
process: (input: {
|
|
668
668
|
hash: string;
|
|
@@ -671,10 +671,10 @@ declare function getAd(type: AdType): (AdDefinition<z.ZodObject<{
|
|
|
671
671
|
hash: string;
|
|
672
672
|
};
|
|
673
673
|
metadata: {
|
|
674
|
+
text: string;
|
|
675
|
+
timestamp: string;
|
|
674
676
|
username?: string | undefined;
|
|
675
677
|
pfpUrl?: string | undefined;
|
|
676
|
-
text?: string | undefined;
|
|
677
|
-
timestamp?: number | undefined;
|
|
678
678
|
} | undefined;
|
|
679
679
|
}>;
|
|
680
680
|
safeProcess: (input: {
|
|
@@ -685,10 +685,10 @@ declare function getAd(type: AdType): (AdDefinition<z.ZodObject<{
|
|
|
685
685
|
hash: string;
|
|
686
686
|
} | undefined;
|
|
687
687
|
metadata?: {
|
|
688
|
+
text: string;
|
|
689
|
+
timestamp: string;
|
|
688
690
|
username?: string | undefined;
|
|
689
691
|
pfpUrl?: string | undefined;
|
|
690
|
-
text?: string | undefined;
|
|
691
|
-
timestamp?: number | undefined;
|
|
692
692
|
} | undefined;
|
|
693
693
|
error?: z.ZodError | string;
|
|
694
694
|
}>;
|
|
@@ -872,8 +872,8 @@ declare const adDefinitions: {
|
|
|
872
872
|
}, z.core.$strip>, z.ZodObject<{
|
|
873
873
|
username: z.ZodOptional<z.ZodString>;
|
|
874
874
|
pfpUrl: z.ZodOptional<z.ZodString>;
|
|
875
|
-
text: z.
|
|
876
|
-
timestamp: z.
|
|
875
|
+
text: z.ZodString;
|
|
876
|
+
timestamp: z.ZodString;
|
|
877
877
|
}, z.core.$strip>> & {
|
|
878
878
|
process: (input: {
|
|
879
879
|
hash: string;
|
|
@@ -882,10 +882,10 @@ declare const adDefinitions: {
|
|
|
882
882
|
hash: string;
|
|
883
883
|
};
|
|
884
884
|
metadata: {
|
|
885
|
+
text: string;
|
|
886
|
+
timestamp: string;
|
|
885
887
|
username?: string | undefined;
|
|
886
888
|
pfpUrl?: string | undefined;
|
|
887
|
-
text?: string | undefined;
|
|
888
|
-
timestamp?: number | undefined;
|
|
889
889
|
} | undefined;
|
|
890
890
|
}>;
|
|
891
891
|
safeProcess: (input: {
|
|
@@ -896,10 +896,10 @@ declare const adDefinitions: {
|
|
|
896
896
|
hash: string;
|
|
897
897
|
} | undefined;
|
|
898
898
|
metadata?: {
|
|
899
|
+
text: string;
|
|
900
|
+
timestamp: string;
|
|
899
901
|
username?: string | undefined;
|
|
900
902
|
pfpUrl?: string | undefined;
|
|
901
|
-
text?: string | undefined;
|
|
902
|
-
timestamp?: number | undefined;
|
|
903
903
|
} | undefined;
|
|
904
904
|
error?: z.ZodError | string;
|
|
905
905
|
}>;
|
|
@@ -1075,8 +1075,8 @@ declare const adModels: {
|
|
|
1075
1075
|
}, z.core.$strip>, z.ZodObject<{
|
|
1076
1076
|
username: z.ZodOptional<z.ZodString>;
|
|
1077
1077
|
pfpUrl: z.ZodOptional<z.ZodString>;
|
|
1078
|
-
text: z.
|
|
1079
|
-
timestamp: z.
|
|
1078
|
+
text: z.ZodString;
|
|
1079
|
+
timestamp: z.ZodString;
|
|
1080
1080
|
}, z.core.$strip>> & {
|
|
1081
1081
|
process: (input: {
|
|
1082
1082
|
hash: string;
|
|
@@ -1085,10 +1085,10 @@ declare const adModels: {
|
|
|
1085
1085
|
hash: string;
|
|
1086
1086
|
};
|
|
1087
1087
|
metadata: {
|
|
1088
|
+
text: string;
|
|
1089
|
+
timestamp: string;
|
|
1088
1090
|
username?: string | undefined;
|
|
1089
1091
|
pfpUrl?: string | undefined;
|
|
1090
|
-
text?: string | undefined;
|
|
1091
|
-
timestamp?: number | undefined;
|
|
1092
1092
|
} | undefined;
|
|
1093
1093
|
}>;
|
|
1094
1094
|
safeProcess: (input: {
|
|
@@ -1099,10 +1099,10 @@ declare const adModels: {
|
|
|
1099
1099
|
hash: string;
|
|
1100
1100
|
} | undefined;
|
|
1101
1101
|
metadata?: {
|
|
1102
|
+
text: string;
|
|
1103
|
+
timestamp: string;
|
|
1102
1104
|
username?: string | undefined;
|
|
1103
1105
|
pfpUrl?: string | undefined;
|
|
1104
|
-
text?: string | undefined;
|
|
1105
|
-
timestamp?: number | undefined;
|
|
1106
1106
|
} | undefined;
|
|
1107
1107
|
error?: z.ZodError | string;
|
|
1108
1108
|
}>;
|
package/dist/index.d.ts
CHANGED
|
@@ -10,8 +10,8 @@ declare const castAd: AdDefinition<z.ZodObject<{
|
|
|
10
10
|
}, z.core.$strip>, z.ZodObject<{
|
|
11
11
|
username: z.ZodOptional<z.ZodString>;
|
|
12
12
|
pfpUrl: z.ZodOptional<z.ZodString>;
|
|
13
|
-
text: z.
|
|
14
|
-
timestamp: z.
|
|
13
|
+
text: z.ZodString;
|
|
14
|
+
timestamp: z.ZodString;
|
|
15
15
|
}, z.core.$strip>> & {
|
|
16
16
|
process: (input: {
|
|
17
17
|
hash: string;
|
|
@@ -20,10 +20,10 @@ declare const castAd: AdDefinition<z.ZodObject<{
|
|
|
20
20
|
hash: string;
|
|
21
21
|
};
|
|
22
22
|
metadata: {
|
|
23
|
+
text: string;
|
|
24
|
+
timestamp: string;
|
|
23
25
|
username?: string | undefined;
|
|
24
26
|
pfpUrl?: string | undefined;
|
|
25
|
-
text?: string | undefined;
|
|
26
|
-
timestamp?: number | undefined;
|
|
27
27
|
} | undefined;
|
|
28
28
|
}>;
|
|
29
29
|
safeProcess: (input: {
|
|
@@ -34,10 +34,10 @@ declare const castAd: AdDefinition<z.ZodObject<{
|
|
|
34
34
|
hash: string;
|
|
35
35
|
} | undefined;
|
|
36
36
|
metadata?: {
|
|
37
|
+
text: string;
|
|
38
|
+
timestamp: string;
|
|
37
39
|
username?: string | undefined;
|
|
38
40
|
pfpUrl?: string | undefined;
|
|
39
|
-
text?: string | undefined;
|
|
40
|
-
timestamp?: number | undefined;
|
|
41
41
|
} | undefined;
|
|
42
42
|
error?: z.ZodError | string;
|
|
43
43
|
}>;
|
|
@@ -452,8 +452,8 @@ declare const ads: {
|
|
|
452
452
|
}, z.core.$strip>, z.ZodObject<{
|
|
453
453
|
username: z.ZodOptional<z.ZodString>;
|
|
454
454
|
pfpUrl: z.ZodOptional<z.ZodString>;
|
|
455
|
-
text: z.
|
|
456
|
-
timestamp: z.
|
|
455
|
+
text: z.ZodString;
|
|
456
|
+
timestamp: z.ZodString;
|
|
457
457
|
}, z.core.$strip>> & {
|
|
458
458
|
process: (input: {
|
|
459
459
|
hash: string;
|
|
@@ -462,10 +462,10 @@ declare const ads: {
|
|
|
462
462
|
hash: string;
|
|
463
463
|
};
|
|
464
464
|
metadata: {
|
|
465
|
+
text: string;
|
|
466
|
+
timestamp: string;
|
|
465
467
|
username?: string | undefined;
|
|
466
468
|
pfpUrl?: string | undefined;
|
|
467
|
-
text?: string | undefined;
|
|
468
|
-
timestamp?: number | undefined;
|
|
469
469
|
} | undefined;
|
|
470
470
|
}>;
|
|
471
471
|
safeProcess: (input: {
|
|
@@ -476,10 +476,10 @@ declare const ads: {
|
|
|
476
476
|
hash: string;
|
|
477
477
|
} | undefined;
|
|
478
478
|
metadata?: {
|
|
479
|
+
text: string;
|
|
480
|
+
timestamp: string;
|
|
479
481
|
username?: string | undefined;
|
|
480
482
|
pfpUrl?: string | undefined;
|
|
481
|
-
text?: string | undefined;
|
|
482
|
-
timestamp?: number | undefined;
|
|
483
483
|
} | undefined;
|
|
484
484
|
error?: z.ZodError | string;
|
|
485
485
|
}>;
|
|
@@ -661,8 +661,8 @@ declare function getAd(type: AdType): (AdDefinition<z.ZodObject<{
|
|
|
661
661
|
}, z.core.$strip>, z.ZodObject<{
|
|
662
662
|
username: z.ZodOptional<z.ZodString>;
|
|
663
663
|
pfpUrl: z.ZodOptional<z.ZodString>;
|
|
664
|
-
text: z.
|
|
665
|
-
timestamp: z.
|
|
664
|
+
text: z.ZodString;
|
|
665
|
+
timestamp: z.ZodString;
|
|
666
666
|
}, z.core.$strip>> & {
|
|
667
667
|
process: (input: {
|
|
668
668
|
hash: string;
|
|
@@ -671,10 +671,10 @@ declare function getAd(type: AdType): (AdDefinition<z.ZodObject<{
|
|
|
671
671
|
hash: string;
|
|
672
672
|
};
|
|
673
673
|
metadata: {
|
|
674
|
+
text: string;
|
|
675
|
+
timestamp: string;
|
|
674
676
|
username?: string | undefined;
|
|
675
677
|
pfpUrl?: string | undefined;
|
|
676
|
-
text?: string | undefined;
|
|
677
|
-
timestamp?: number | undefined;
|
|
678
678
|
} | undefined;
|
|
679
679
|
}>;
|
|
680
680
|
safeProcess: (input: {
|
|
@@ -685,10 +685,10 @@ declare function getAd(type: AdType): (AdDefinition<z.ZodObject<{
|
|
|
685
685
|
hash: string;
|
|
686
686
|
} | undefined;
|
|
687
687
|
metadata?: {
|
|
688
|
+
text: string;
|
|
689
|
+
timestamp: string;
|
|
688
690
|
username?: string | undefined;
|
|
689
691
|
pfpUrl?: string | undefined;
|
|
690
|
-
text?: string | undefined;
|
|
691
|
-
timestamp?: number | undefined;
|
|
692
692
|
} | undefined;
|
|
693
693
|
error?: z.ZodError | string;
|
|
694
694
|
}>;
|
|
@@ -872,8 +872,8 @@ declare const adDefinitions: {
|
|
|
872
872
|
}, z.core.$strip>, z.ZodObject<{
|
|
873
873
|
username: z.ZodOptional<z.ZodString>;
|
|
874
874
|
pfpUrl: z.ZodOptional<z.ZodString>;
|
|
875
|
-
text: z.
|
|
876
|
-
timestamp: z.
|
|
875
|
+
text: z.ZodString;
|
|
876
|
+
timestamp: z.ZodString;
|
|
877
877
|
}, z.core.$strip>> & {
|
|
878
878
|
process: (input: {
|
|
879
879
|
hash: string;
|
|
@@ -882,10 +882,10 @@ declare const adDefinitions: {
|
|
|
882
882
|
hash: string;
|
|
883
883
|
};
|
|
884
884
|
metadata: {
|
|
885
|
+
text: string;
|
|
886
|
+
timestamp: string;
|
|
885
887
|
username?: string | undefined;
|
|
886
888
|
pfpUrl?: string | undefined;
|
|
887
|
-
text?: string | undefined;
|
|
888
|
-
timestamp?: number | undefined;
|
|
889
889
|
} | undefined;
|
|
890
890
|
}>;
|
|
891
891
|
safeProcess: (input: {
|
|
@@ -896,10 +896,10 @@ declare const adDefinitions: {
|
|
|
896
896
|
hash: string;
|
|
897
897
|
} | undefined;
|
|
898
898
|
metadata?: {
|
|
899
|
+
text: string;
|
|
900
|
+
timestamp: string;
|
|
899
901
|
username?: string | undefined;
|
|
900
902
|
pfpUrl?: string | undefined;
|
|
901
|
-
text?: string | undefined;
|
|
902
|
-
timestamp?: number | undefined;
|
|
903
903
|
} | undefined;
|
|
904
904
|
error?: z.ZodError | string;
|
|
905
905
|
}>;
|
|
@@ -1075,8 +1075,8 @@ declare const adModels: {
|
|
|
1075
1075
|
}, z.core.$strip>, z.ZodObject<{
|
|
1076
1076
|
username: z.ZodOptional<z.ZodString>;
|
|
1077
1077
|
pfpUrl: z.ZodOptional<z.ZodString>;
|
|
1078
|
-
text: z.
|
|
1079
|
-
timestamp: z.
|
|
1078
|
+
text: z.ZodString;
|
|
1079
|
+
timestamp: z.ZodString;
|
|
1080
1080
|
}, z.core.$strip>> & {
|
|
1081
1081
|
process: (input: {
|
|
1082
1082
|
hash: string;
|
|
@@ -1085,10 +1085,10 @@ declare const adModels: {
|
|
|
1085
1085
|
hash: string;
|
|
1086
1086
|
};
|
|
1087
1087
|
metadata: {
|
|
1088
|
+
text: string;
|
|
1089
|
+
timestamp: string;
|
|
1088
1090
|
username?: string | undefined;
|
|
1089
1091
|
pfpUrl?: string | undefined;
|
|
1090
|
-
text?: string | undefined;
|
|
1091
|
-
timestamp?: number | undefined;
|
|
1092
1092
|
} | undefined;
|
|
1093
1093
|
}>;
|
|
1094
1094
|
safeProcess: (input: {
|
|
@@ -1099,10 +1099,10 @@ declare const adModels: {
|
|
|
1099
1099
|
hash: string;
|
|
1100
1100
|
} | undefined;
|
|
1101
1101
|
metadata?: {
|
|
1102
|
+
text: string;
|
|
1103
|
+
timestamp: string;
|
|
1102
1104
|
username?: string | undefined;
|
|
1103
1105
|
pfpUrl?: string | undefined;
|
|
1104
|
-
text?: string | undefined;
|
|
1105
|
-
timestamp?: number | undefined;
|
|
1106
1106
|
} | undefined;
|
|
1107
1107
|
error?: z.ZodError | string;
|
|
1108
1108
|
}>;
|
package/dist/index.js
CHANGED
|
@@ -58,64 +58,59 @@ async function safeProcessAd(ad, input) {
|
|
|
58
58
|
}
|
|
59
59
|
|
|
60
60
|
// src/services/adland.api.ts
|
|
61
|
-
var
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
61
|
+
var baseUrl = `${adlandApiUrl}/adland`;
|
|
62
|
+
async function post(url, body) {
|
|
63
|
+
return fetch(url, {
|
|
64
|
+
method: "POST",
|
|
65
|
+
body: JSON.stringify(body)
|
|
66
|
+
}).then((res) => res.json());
|
|
67
|
+
}
|
|
68
|
+
async function get(url) {
|
|
69
|
+
return fetch(url).then((res) => res.json());
|
|
70
|
+
}
|
|
71
|
+
var adlandAPI = {
|
|
72
|
+
verify: {
|
|
73
|
+
cast({ hash }) {
|
|
74
|
+
return post(`${baseUrl}/verify/cast`, { hash });
|
|
75
|
+
},
|
|
76
|
+
miniapp({ domain }) {
|
|
77
|
+
return post(`${baseUrl}/verify/miniapp`, {
|
|
78
|
+
domain
|
|
79
|
+
});
|
|
80
|
+
},
|
|
81
|
+
profile({ fid }) {
|
|
82
|
+
return post(`${baseUrl}/verify/profile`, { fid });
|
|
83
|
+
},
|
|
84
|
+
token({ address, chainId }) {
|
|
85
|
+
return post(`${baseUrl}/verify/token`, {
|
|
86
|
+
address,
|
|
87
|
+
chainId
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
metadata: {
|
|
92
|
+
cast({ hash }) {
|
|
93
|
+
return get(`${baseUrl}/metadata/cast?hash=${encodeURIComponent(hash)}`);
|
|
94
|
+
},
|
|
95
|
+
miniapp({ url }) {
|
|
96
|
+
return get(`${baseUrl}/metadata/miniapp?url=${encodeURIComponent(url)}`);
|
|
97
|
+
},
|
|
98
|
+
link({ url }) {
|
|
99
|
+
return get(`${baseUrl}/metadata/link?url=${encodeURIComponent(url)}`);
|
|
100
|
+
},
|
|
101
|
+
profile({ fid }) {
|
|
102
|
+
return get(`${baseUrl}/metadata/profile?fid=${encodeURIComponent(fid)}`);
|
|
103
|
+
},
|
|
104
|
+
token({
|
|
96
105
|
address,
|
|
97
106
|
chainId
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}) {
|
|
104
|
-
return this.get(
|
|
105
|
-
`${adlandApiUrl}/metadata/token?address=${encodeURIComponent(address)}&chainId=${chainId}`
|
|
106
|
-
);
|
|
107
|
-
}
|
|
108
|
-
async post(url, body) {
|
|
109
|
-
return fetch(url, {
|
|
110
|
-
method: "POST",
|
|
111
|
-
body: JSON.stringify(body)
|
|
112
|
-
}).then((res) => res.json());
|
|
113
|
-
}
|
|
114
|
-
async get(url) {
|
|
115
|
-
return fetch(url).then((res) => res.json());
|
|
107
|
+
}) {
|
|
108
|
+
return get(
|
|
109
|
+
`${baseUrl}/metadata/token?address=${encodeURIComponent(address)}&chainId=${chainId}`
|
|
110
|
+
);
|
|
111
|
+
}
|
|
116
112
|
}
|
|
117
113
|
};
|
|
118
|
-
var adlandAPI = new AdlandAPI();
|
|
119
114
|
|
|
120
115
|
// src/ads/cast.ts
|
|
121
116
|
var castAd = defineAd({
|
|
@@ -126,23 +121,23 @@ var castAd = defineAd({
|
|
|
126
121
|
metadata: z.object({
|
|
127
122
|
username: z.string().optional(),
|
|
128
123
|
pfpUrl: z.string().optional(),
|
|
129
|
-
text: z.string()
|
|
130
|
-
timestamp: z.
|
|
124
|
+
text: z.string(),
|
|
125
|
+
timestamp: z.string()
|
|
131
126
|
}),
|
|
132
127
|
async verify({ hash }) {
|
|
133
128
|
if (!/^0x[0-9a-fA-F]{40}$/.test(hash)) {
|
|
134
129
|
throw new Error("Invalid Farcaster cast hash");
|
|
135
130
|
}
|
|
136
|
-
const res = await adlandAPI.
|
|
131
|
+
const res = await adlandAPI.verify.cast({ hash });
|
|
137
132
|
if (!res.verified) {
|
|
138
133
|
throw new Error("Cast hash verification failed");
|
|
139
134
|
}
|
|
140
135
|
},
|
|
141
136
|
async getMetadata({ hash }) {
|
|
142
|
-
const cast = await adlandAPI.
|
|
137
|
+
const { cast } = await adlandAPI.metadata.cast({ hash });
|
|
143
138
|
return {
|
|
144
|
-
username: cast.username,
|
|
145
|
-
pfpUrl: cast.
|
|
139
|
+
username: cast.author.username,
|
|
140
|
+
pfpUrl: cast.author.pfp_url,
|
|
146
141
|
text: cast.text,
|
|
147
142
|
timestamp: cast.timestamp
|
|
148
143
|
};
|
|
@@ -165,7 +160,7 @@ var linkAd = defineAd({
|
|
|
165
160
|
}
|
|
166
161
|
},
|
|
167
162
|
async getMetadata({ url }) {
|
|
168
|
-
const metadata = await adlandAPI.
|
|
163
|
+
const metadata = await adlandAPI.metadata.link({ url });
|
|
169
164
|
return {
|
|
170
165
|
title: metadata.title,
|
|
171
166
|
description: metadata.description,
|
|
@@ -192,14 +187,14 @@ var miniappAd = defineAd({
|
|
|
192
187
|
if (!domain) {
|
|
193
188
|
throw new Error(errorMessage);
|
|
194
189
|
}
|
|
195
|
-
const res = await adlandAPI.
|
|
190
|
+
const res = await adlandAPI.verify.miniapp({ domain });
|
|
196
191
|
console.log("verifyMiniapp:res", res);
|
|
197
192
|
if (!res.verified) {
|
|
198
193
|
throw new Error(errorMessage);
|
|
199
194
|
}
|
|
200
195
|
},
|
|
201
196
|
async getMetadata({ url }) {
|
|
202
|
-
const res = await adlandAPI.
|
|
197
|
+
const res = await adlandAPI.metadata.miniapp({ url });
|
|
203
198
|
console.log("getMetadata:res", res);
|
|
204
199
|
return {
|
|
205
200
|
icon: res.icon,
|
|
@@ -225,13 +220,13 @@ var tokenAd = defineAd({
|
|
|
225
220
|
logoURI: z.string().optional()
|
|
226
221
|
}),
|
|
227
222
|
async verify({ address, chainId }) {
|
|
228
|
-
const res = await adlandAPI.
|
|
223
|
+
const res = await adlandAPI.verify.token({ address, chainId });
|
|
229
224
|
if (!res.verified) {
|
|
230
225
|
throw new Error("Token verification failed");
|
|
231
226
|
}
|
|
232
227
|
},
|
|
233
228
|
async getMetadata({ address, chainId }) {
|
|
234
|
-
const token = await adlandAPI.
|
|
229
|
+
const token = await adlandAPI.metadata.token({ address, chainId });
|
|
235
230
|
return {
|
|
236
231
|
name: token.name,
|
|
237
232
|
symbol: token.symbol,
|
|
@@ -255,13 +250,13 @@ var farcasterProfileAd = defineAd({
|
|
|
255
250
|
pro: z.boolean().optional()
|
|
256
251
|
}),
|
|
257
252
|
async verify({ fid }) {
|
|
258
|
-
const res = await adlandAPI.
|
|
253
|
+
const res = await adlandAPI.verify.profile({ fid });
|
|
259
254
|
if (!res.verified) {
|
|
260
255
|
throw new Error("Farcaster profile verification failed");
|
|
261
256
|
}
|
|
262
257
|
},
|
|
263
258
|
async getMetadata({ fid }) {
|
|
264
|
-
const res = await adlandAPI.
|
|
259
|
+
const res = await adlandAPI.metadata.profile({ fid });
|
|
265
260
|
return {
|
|
266
261
|
pfpUrl: res.pfpUrl,
|
|
267
262
|
bio: res.bio,
|