@uzproof/verify 1.0.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/README.md ADDED
@@ -0,0 +1,99 @@
1
+ # @uzproof/verify
2
+
3
+ Proof-of-Use verification SDK for Solana. Verify real on-chain usage — swaps, staking, token holds, NFTs, and more.
4
+
5
+ **UZPROOF** is the first Proof-of-Use Attestor on the [Solana Attestation Service (SAS)](https://github.com/solana-foundation/solana-attestation-service).
6
+
7
+ ## Install
8
+
9
+ ```bash
10
+ npm install @uzproof/verify
11
+ ```
12
+
13
+ ## Quick Start
14
+
15
+ ```typescript
16
+ import { UzproofClient } from '@uzproof/verify';
17
+
18
+ const client = new UzproofClient();
19
+
20
+ // Verify a swap on Jupiter
21
+ const result = await client.verify({
22
+ wallet: '7H4RVLZfGLBvY6k1DdmGSUcCKCw6nJG28emTztkyyrLZ',
23
+ action: 'defi_swap',
24
+ config: { min_amount_usd: 5 }
25
+ });
26
+
27
+ console.log(result.verified); // true
28
+ console.log(result.result.matchingTxCount); // 3
29
+ ```
30
+
31
+ ## API
32
+
33
+ ### `verify(request)` — Verify on-chain action
34
+
35
+ ```typescript
36
+ const result = await client.verify({
37
+ wallet: 'WALLET_ADDRESS',
38
+ action: 'defi_swap', // 24 auto-verified action types
39
+ config: {
40
+ program_id: 'JUP6Lk...', // Optional: specific program
41
+ min_amount_usd: 10, // Optional: minimum value
42
+ token_mint: 'So11...', // Optional: specific token
43
+ }
44
+ });
45
+ ```
46
+
47
+ ### `detectContract(programId)` — Auto-detect protocol
48
+
49
+ ```typescript
50
+ const info = await client.detectContract('JUP6LkbZbjS1jKKwapdHNy74zcZ3tLUZoi5QNyVTaV4');
51
+ // info.program.name = "Jupiter Aggregator v6"
52
+ // info.program.supportedActions = ["defi_swap", "defi_swap_buy", "defi_swap_sell"]
53
+ ```
54
+
55
+ ### `getTokenInfo(mint)` — Fetch token metadata + price
56
+
57
+ ```typescript
58
+ const token = await client.getTokenInfo('JUPyiwrYJFskUPiHa7hkeR8VUtAeFoSYbKedZNsDvCN');
59
+ // token.symbol = "JUP"
60
+ // token.priceUsd = 0.143
61
+ ```
62
+
63
+ ### `getAttestation(wallet)` — Check on-chain SAS attestation
64
+
65
+ ```typescript
66
+ const status = await client.getAttestation('7H4RVL...');
67
+ // status.hasAttestation = true
68
+ // status.explorer = "https://explorer.solana.com/address/..."
69
+ ```
70
+
71
+ ## Supported Actions (24 auto-verified)
72
+
73
+ | Category | Actions |
74
+ |----------|---------|
75
+ | **DeFi** | `defi_swap`, `defi_swap_buy`, `defi_swap_sell`, `defi_swap_volume`, `defi_hold_token`, `defi_hold_stablecoin`, `defi_stake_sol`, `defi_hold_staked`, `defi_lend`, `defi_borrow`, `defi_vote`, `defi_repay`, `defi_claim` |
76
+ | **On-Chain** | `nft_hold`, `nft_check`, `token_balance`, `tx_verify`, `gaming_play` |
77
+
78
+ ## Supported Protocols (14)
79
+
80
+ Jupiter, Marinade, Sanctum, Orca, Raydium, Drift, Kamino, MarginFi, Meteora, Jito, Tensor, Magic Eden, Metaplex, SPL Token.
81
+
82
+ ## On-Chain (SAS)
83
+
84
+ UZPROOF attestations are stored on Solana mainnet via the Solana Attestation Service:
85
+
86
+ - **SAS Program:** `22zoJMtdu4tQc2PzL74ZUT7FrwgB1Udec8DdW4yw4BdG`
87
+ - **Credential:** `2chgBfvkwhnHQVVAyXKDK6CBjbCRMQ8aLWrysL5UQyyF`
88
+ - **Schema:** `9FQiiMtroSHP2Ewqfh3D94GPKnDjmeLT2ftqJ3E7QyWc`
89
+
90
+ ## Links
91
+
92
+ - Website: https://uzproof.com
93
+ - Docs: https://uzproof.com/docs
94
+ - Twitter: https://x.com/uzproof
95
+ - Telegram: https://t.me/uz_proof
96
+
97
+ ## License
98
+
99
+ MIT
@@ -0,0 +1,177 @@
1
+ /**
2
+ * @uzproof/verify — Proof-of-Use verification SDK for Solana
3
+ *
4
+ * Verify real on-chain usage: swaps, staking, token holds, NFTs, and more.
5
+ * First Proof-of-Use attestor on Solana Attestation Service (SAS).
6
+ *
7
+ * @example
8
+ * ```typescript
9
+ * import { UzproofClient } from '@uzproof/verify';
10
+ *
11
+ * const client = new UzproofClient({ apiKey: 'your-key' });
12
+ *
13
+ * const result = await client.verify({
14
+ * wallet: '7H4RVL...',
15
+ * action: 'defi_swap',
16
+ * config: { program_id: 'JUP6Lk...' }
17
+ * });
18
+ *
19
+ * console.log(result.verified); // true
20
+ * ```
21
+ */
22
+ export interface UzproofConfig {
23
+ /** API key for authenticated requests */
24
+ apiKey?: string;
25
+ /** Base URL (default: https://uzproof.com) */
26
+ baseUrl?: string;
27
+ }
28
+ export type ActionType = "defi_swap" | "defi_swap_buy" | "defi_swap_sell" | "defi_swap_volume" | "defi_hold_token" | "defi_hold_stablecoin" | "defi_hold_staked" | "defi_hold_token_duration" | "defi_hold_lp" | "defi_stake_sol" | "defi_add_liquidity" | "defi_bridge" | "defi_lend" | "defi_borrow" | "defi_vote" | "defi_repay" | "defi_claim" | "defi_create_lst" | "nft_hold" | "nft_mint" | "nft_check" | "token_balance" | "tx_verify" | "gaming_play";
29
+ export interface VerifyRequest {
30
+ /** Solana wallet address to verify */
31
+ wallet: string;
32
+ /** Type of on-chain action to verify */
33
+ action: ActionType;
34
+ /** Action-specific configuration */
35
+ config?: {
36
+ /** Solana program ID to verify against */
37
+ program_id?: string;
38
+ /** SPL token mint address */
39
+ token_mint?: string;
40
+ /** Minimum amount in USD */
41
+ min_amount_usd?: number;
42
+ /** Minimum token amount */
43
+ min_amount?: number;
44
+ /** Minimum SOL amount */
45
+ min_amount_sol?: number;
46
+ /** NFT collection address */
47
+ collection_address?: string;
48
+ /** Specific NFT mint address */
49
+ nft_mint?: string;
50
+ /** Minimum trading volume in USD */
51
+ min_volume_usd?: number;
52
+ };
53
+ }
54
+ export interface VerifyResult {
55
+ /** Whether the action was verified */
56
+ verified: boolean;
57
+ /** Type of action verified */
58
+ taskType: string;
59
+ /** Detailed verification data */
60
+ result: {
61
+ /** Number of matching transactions found */
62
+ matchingTxCount?: number;
63
+ /** Transaction signatures */
64
+ matchingSignatures?: string[];
65
+ /** Estimated volume in USD */
66
+ totalVolumeEstimate?: number;
67
+ /** Token balance */
68
+ balance?: number;
69
+ /** Staked amount in SOL */
70
+ stakedSol?: number;
71
+ /** NFT count */
72
+ nftCount?: number;
73
+ /** Transaction signature */
74
+ signature?: string;
75
+ /** Whether the check passed */
76
+ verified?: boolean;
77
+ /** Error message if failed */
78
+ error?: string;
79
+ };
80
+ }
81
+ export interface ContractDetectResult {
82
+ /** Whether the program was recognized */
83
+ detected: boolean;
84
+ /** Program information */
85
+ program?: {
86
+ name: string;
87
+ category: string;
88
+ supportedActions: string[];
89
+ };
90
+ /** Suggested quest template */
91
+ questTemplate?: {
92
+ suggestedTitle: string;
93
+ suggestedDescription: string;
94
+ suggestedTasks: Array<{
95
+ type: string;
96
+ config: Record<string, unknown>;
97
+ }>;
98
+ };
99
+ }
100
+ export interface TokenInfo {
101
+ mint: string;
102
+ name: string;
103
+ symbol: string;
104
+ decimals: number;
105
+ supply: number;
106
+ priceUsd: number | null;
107
+ }
108
+ export interface AttestationStatus {
109
+ /** Whether wallet has on-chain SAS attestation */
110
+ hasAttestation: boolean;
111
+ /** Attestation PDA address on Solana */
112
+ attestation: string | null;
113
+ /** Solana Explorer link */
114
+ explorer?: string;
115
+ }
116
+ export declare class UzproofClient {
117
+ private baseUrl;
118
+ private apiKey?;
119
+ constructor(config?: UzproofConfig);
120
+ private request;
121
+ /**
122
+ * Verify that a wallet performed a specific on-chain action.
123
+ *
124
+ * @example
125
+ * ```typescript
126
+ * const result = await client.verify({
127
+ * wallet: '7H4RVL...',
128
+ * action: 'defi_swap',
129
+ * config: { min_amount_usd: 5 }
130
+ * });
131
+ * ```
132
+ */
133
+ verify(req: VerifyRequest): Promise<VerifyResult>;
134
+ /**
135
+ * Auto-detect a Solana program and get suggested quest types.
136
+ * Supports 14 protocols: Jupiter, Marinade, Orca, Raydium, etc.
137
+ *
138
+ * @example
139
+ * ```typescript
140
+ * const info = await client.detectContract('JUP6Lk...');
141
+ * // info.program.name = "Jupiter Aggregator v6"
142
+ * ```
143
+ */
144
+ detectContract(programId: string): Promise<ContractDetectResult>;
145
+ /**
146
+ * Fetch SPL token metadata and live price by mint address.
147
+ *
148
+ * @example
149
+ * ```typescript
150
+ * const token = await client.getTokenInfo('JUPyiwr...');
151
+ * // token.symbol = "JUP", token.priceUsd = 0.143
152
+ * ```
153
+ */
154
+ getTokenInfo(mint: string): Promise<TokenInfo>;
155
+ /**
156
+ * Check if a wallet has an on-chain Proof-of-Use attestation
157
+ * on the Solana Attestation Service (SAS).
158
+ *
159
+ * @example
160
+ * ```typescript
161
+ * const status = await client.getAttestation('7H4RVL...');
162
+ * // status.hasAttestation = true
163
+ * // status.explorer = "https://explorer.solana.com/address/..."
164
+ * ```
165
+ */
166
+ getAttestation(wallet: string): Promise<AttestationStatus>;
167
+ }
168
+ /** Solana Attestation Service program ID */
169
+ export declare const SAS_PROGRAM_ID = "22zoJMtdu4tQc2PzL74ZUT7FrwgB1Udec8DdW4yw4BdG";
170
+ /** UZPROOF credential PDA on SAS */
171
+ export declare const UZPROOF_CREDENTIAL = "2chgBfvkwhnHQVVAyXKDK6CBjbCRMQ8aLWrysL5UQyyF";
172
+ /** Proof-of-Use schema PDA on SAS */
173
+ export declare const POU_SCHEMA = "9FQiiMtroSHP2Ewqfh3D94GPKnDjmeLT2ftqJ3E7QyWc";
174
+ /** All supported action types */
175
+ export declare const ACTION_TYPES: ActionType[];
176
+ /** Supported protocols for contract detection */
177
+ export declare const SUPPORTED_PROTOCOLS: readonly ["Jupiter", "Marinade", "Sanctum", "Orca", "Raydium", "Drift", "Kamino", "MarginFi", "Meteora", "Jito", "Tensor", "Magic Eden", "Metaplex", "SPL Token"];
package/dist/index.js ADDED
@@ -0,0 +1,152 @@
1
+ "use strict";
2
+ /**
3
+ * @uzproof/verify — Proof-of-Use verification SDK for Solana
4
+ *
5
+ * Verify real on-chain usage: swaps, staking, token holds, NFTs, and more.
6
+ * First Proof-of-Use attestor on Solana Attestation Service (SAS).
7
+ *
8
+ * @example
9
+ * ```typescript
10
+ * import { UzproofClient } from '@uzproof/verify';
11
+ *
12
+ * const client = new UzproofClient({ apiKey: 'your-key' });
13
+ *
14
+ * const result = await client.verify({
15
+ * wallet: '7H4RVL...',
16
+ * action: 'defi_swap',
17
+ * config: { program_id: 'JUP6Lk...' }
18
+ * });
19
+ *
20
+ * console.log(result.verified); // true
21
+ * ```
22
+ */
23
+ Object.defineProperty(exports, "__esModule", { value: true });
24
+ exports.SUPPORTED_PROTOCOLS = exports.ACTION_TYPES = exports.POU_SCHEMA = exports.UZPROOF_CREDENTIAL = exports.SAS_PROGRAM_ID = exports.UzproofClient = void 0;
25
+ /* ------------------------------------------------------------------ */
26
+ /* Client */
27
+ /* ------------------------------------------------------------------ */
28
+ class UzproofClient {
29
+ constructor(config = {}) {
30
+ this.baseUrl = (config.baseUrl || "https://uzproof.com").replace(/\/$/, "");
31
+ this.apiKey = config.apiKey;
32
+ }
33
+ async request(method, path, body) {
34
+ const headers = {
35
+ "Content-Type": "application/json",
36
+ };
37
+ if (this.apiKey) {
38
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
39
+ }
40
+ const res = await fetch(`${this.baseUrl}${path}`, {
41
+ method,
42
+ headers,
43
+ body: body ? JSON.stringify(body) : undefined,
44
+ });
45
+ if (!res.ok) {
46
+ throw new Error(`UZPROOF API error: ${res.status} ${res.statusText}`);
47
+ }
48
+ return res.json();
49
+ }
50
+ /* ---- Verification ---- */
51
+ /**
52
+ * Verify that a wallet performed a specific on-chain action.
53
+ *
54
+ * @example
55
+ * ```typescript
56
+ * const result = await client.verify({
57
+ * wallet: '7H4RVL...',
58
+ * action: 'defi_swap',
59
+ * config: { min_amount_usd: 5 }
60
+ * });
61
+ * ```
62
+ */
63
+ async verify(req) {
64
+ const data = await this.request("POST", "/api/verify", {
65
+ wallet: req.wallet,
66
+ taskType: req.action,
67
+ config: req.config || {},
68
+ });
69
+ return {
70
+ verified: data.verified,
71
+ taskType: data.taskType,
72
+ result: data.result,
73
+ };
74
+ }
75
+ /* ---- Contract Detection ---- */
76
+ /**
77
+ * Auto-detect a Solana program and get suggested quest types.
78
+ * Supports 14 protocols: Jupiter, Marinade, Orca, Raydium, etc.
79
+ *
80
+ * @example
81
+ * ```typescript
82
+ * const info = await client.detectContract('JUP6Lk...');
83
+ * // info.program.name = "Jupiter Aggregator v6"
84
+ * ```
85
+ */
86
+ async detectContract(programId) {
87
+ return this.request("POST", "/api/contracts/detect", {
88
+ programId,
89
+ });
90
+ }
91
+ /* ---- Token Info ---- */
92
+ /**
93
+ * Fetch SPL token metadata and live price by mint address.
94
+ *
95
+ * @example
96
+ * ```typescript
97
+ * const token = await client.getTokenInfo('JUPyiwr...');
98
+ * // token.symbol = "JUP", token.priceUsd = 0.143
99
+ * ```
100
+ */
101
+ async getTokenInfo(mint) {
102
+ const data = await this.request("GET", `/api/tokens/info?mint=${encodeURIComponent(mint)}`);
103
+ return data.data;
104
+ }
105
+ /* ---- SAS Attestation ---- */
106
+ /**
107
+ * Check if a wallet has an on-chain Proof-of-Use attestation
108
+ * on the Solana Attestation Service (SAS).
109
+ *
110
+ * @example
111
+ * ```typescript
112
+ * const status = await client.getAttestation('7H4RVL...');
113
+ * // status.hasAttestation = true
114
+ * // status.explorer = "https://explorer.solana.com/address/..."
115
+ * ```
116
+ */
117
+ async getAttestation(wallet) {
118
+ const data = await this.request("GET", `/api/sas/status?wallet=${encodeURIComponent(wallet)}`);
119
+ return {
120
+ hasAttestation: data.hasAttestation,
121
+ attestation: data.attestation,
122
+ explorer: data.explorer,
123
+ };
124
+ }
125
+ }
126
+ exports.UzproofClient = UzproofClient;
127
+ /* ------------------------------------------------------------------ */
128
+ /* Constants */
129
+ /* ------------------------------------------------------------------ */
130
+ /** Solana Attestation Service program ID */
131
+ exports.SAS_PROGRAM_ID = "22zoJMtdu4tQc2PzL74ZUT7FrwgB1Udec8DdW4yw4BdG";
132
+ /** UZPROOF credential PDA on SAS */
133
+ exports.UZPROOF_CREDENTIAL = "2chgBfvkwhnHQVVAyXKDK6CBjbCRMQ8aLWrysL5UQyyF";
134
+ /** Proof-of-Use schema PDA on SAS */
135
+ exports.POU_SCHEMA = "9FQiiMtroSHP2Ewqfh3D94GPKnDjmeLT2ftqJ3E7QyWc";
136
+ /** All supported action types */
137
+ exports.ACTION_TYPES = [
138
+ "defi_swap", "defi_swap_buy", "defi_swap_sell", "defi_swap_volume",
139
+ "defi_hold_token", "defi_hold_stablecoin", "defi_hold_staked",
140
+ "defi_hold_token_duration", "defi_hold_lp",
141
+ "defi_stake_sol", "defi_add_liquidity", "defi_bridge",
142
+ "defi_lend", "defi_borrow", "defi_vote", "defi_repay",
143
+ "defi_claim", "defi_create_lst",
144
+ "nft_hold", "nft_mint", "nft_check",
145
+ "token_balance", "tx_verify", "gaming_play",
146
+ ];
147
+ /** Supported protocols for contract detection */
148
+ exports.SUPPORTED_PROTOCOLS = [
149
+ "Jupiter", "Marinade", "Sanctum", "Orca", "Raydium",
150
+ "Drift", "Kamino", "MarginFi", "Meteora", "Jito",
151
+ "Tensor", "Magic Eden", "Metaplex", "SPL Token",
152
+ ];
package/package.json ADDED
@@ -0,0 +1,23 @@
1
+ {
2
+ "name": "@uzproof/verify",
3
+ "version": "1.0.0",
4
+ "description": "Proof-of-Use verification SDK for Solana. Verify real on-chain usage — swaps, staking, token holds, NFTs, and more.",
5
+ "main": "dist/index.js",
6
+ "types": "dist/index.d.ts",
7
+ "files": ["dist"],
8
+ "scripts": {
9
+ "build": "tsc",
10
+ "prepublishOnly": "npm run build"
11
+ },
12
+ "keywords": ["solana", "verification", "proof-of-use", "defi", "nft", "attestation", "sas", "uzproof"],
13
+ "author": "UZPROOF <hello@uzproof.com>",
14
+ "license": "MIT",
15
+ "homepage": "https://uzproof.com",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "https://github.com/uzproof/uzproof"
19
+ },
20
+ "devDependencies": {
21
+ "typescript": "^5.0.0"
22
+ }
23
+ }