@telika/sdk 0.1.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 +68 -0
- package/dist/abi.d.ts +214 -0
- package/dist/abi.d.ts.map +1 -0
- package/dist/abi.js +157 -0
- package/dist/abi.js.map +1 -0
- package/dist/blockchain-client.d.ts +166 -0
- package/dist/blockchain-client.d.ts.map +1 -0
- package/dist/blockchain-client.js +292 -0
- package/dist/blockchain-client.js.map +1 -0
- package/dist/index.d.ts +46 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +64 -0
- package/dist/index.js.map +1 -0
- package/dist/proof-generator.d.ts +78 -0
- package/dist/proof-generator.d.ts.map +1 -0
- package/dist/proof-generator.js +190 -0
- package/dist/proof-generator.js.map +1 -0
- package/dist/types.d.ts +127 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +32 -0
- package/dist/types.js.map +1 -0
- package/package.json +45 -0
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Telika Proof Generator
|
|
4
|
+
*
|
|
5
|
+
* Generates cryptographic proof hashes (keccak256) from verification event data.
|
|
6
|
+
* The proof generator ensures that:
|
|
7
|
+
* 1. Sensitive fields are STRIPPED before hashing (e.g., bank details, personal documents)
|
|
8
|
+
* 2. Proof hashes are deterministic (same input always produces the same hash)
|
|
9
|
+
* 3. Only non-sensitive, non-identifying data is included in the proof
|
|
10
|
+
*/
|
|
11
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
|
+
exports.generateProofHash = generateProofHash;
|
|
13
|
+
exports.createIdentityProof = createIdentityProof;
|
|
14
|
+
exports.createFundingProof = createFundingProof;
|
|
15
|
+
exports.createMilestoneProof = createMilestoneProof;
|
|
16
|
+
exports.createScoreProof = createScoreProof;
|
|
17
|
+
exports.generateMetadata = generateMetadata;
|
|
18
|
+
exports.generateAbiEncodedHash = generateAbiEncodedHash;
|
|
19
|
+
const ethers_1 = require("ethers");
|
|
20
|
+
const types_1 = require("./types");
|
|
21
|
+
// =========================================================================
|
|
22
|
+
// Core Proof Generation
|
|
23
|
+
// =========================================================================
|
|
24
|
+
/**
|
|
25
|
+
* Generate a keccak256 proof hash from any verification event.
|
|
26
|
+
* Automatically routes to the appropriate event-specific generator
|
|
27
|
+
* and strips sensitive data before hashing.
|
|
28
|
+
*
|
|
29
|
+
* @param event - The verification event data
|
|
30
|
+
* @returns The keccak256 hash of the sanitized event data (0x-prefixed)
|
|
31
|
+
*/
|
|
32
|
+
function generateProofHash(event) {
|
|
33
|
+
const sanitizedData = sanitizeEventData(event);
|
|
34
|
+
const encoded = canonicalEncode(sanitizedData);
|
|
35
|
+
return (0, ethers_1.keccak256)((0, ethers_1.toUtf8Bytes)(encoded));
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Create a proof hash specifically for an identity verification event.
|
|
39
|
+
*
|
|
40
|
+
* Included in proof: telikaId, timestamp, documentType, issuingCountry, verified, verifiedBy
|
|
41
|
+
* Excluded (sensitive): actual document numbers, personal details, photos
|
|
42
|
+
*
|
|
43
|
+
* @param event - Identity verification event data
|
|
44
|
+
* @returns The keccak256 proof hash
|
|
45
|
+
*/
|
|
46
|
+
function createIdentityProof(event) {
|
|
47
|
+
return generateProofHash(event);
|
|
48
|
+
}
|
|
49
|
+
/**
|
|
50
|
+
* Create a proof hash specifically for a funding disbursement event.
|
|
51
|
+
*
|
|
52
|
+
* Included in proof: telikaId, timestamp, amount, currency, funderId, funderName, fundingPurpose
|
|
53
|
+
* Excluded (sensitive): bank account numbers, routing numbers, transaction IDs
|
|
54
|
+
*
|
|
55
|
+
* @param event - Funding disbursement event data
|
|
56
|
+
* @returns The keccak256 proof hash
|
|
57
|
+
*/
|
|
58
|
+
function createFundingProof(event) {
|
|
59
|
+
return generateProofHash(event);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Create a proof hash specifically for a milestone confirmation event.
|
|
63
|
+
*
|
|
64
|
+
* Included in proof: telikaId, timestamp, milestoneName, description, evidenceType, confirmed, confirmedBy
|
|
65
|
+
* Excluded (sensitive): detailed financial reports, user data
|
|
66
|
+
*
|
|
67
|
+
* @param event - Milestone confirmation event data
|
|
68
|
+
* @returns The keccak256 proof hash
|
|
69
|
+
*/
|
|
70
|
+
function createMilestoneProof(event) {
|
|
71
|
+
return generateProofHash(event);
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Create a proof hash specifically for a score update event.
|
|
75
|
+
*
|
|
76
|
+
* Included in proof: telikaId, timestamp, previousScore, newScore, reason, categoriesChanged
|
|
77
|
+
* Excluded (sensitive): detailed scoring breakdown, proprietary AI model outputs
|
|
78
|
+
*
|
|
79
|
+
* @param event - Score update event data
|
|
80
|
+
* @returns The keccak256 proof hash
|
|
81
|
+
*/
|
|
82
|
+
function createScoreProof(event) {
|
|
83
|
+
return generateProofHash(event);
|
|
84
|
+
}
|
|
85
|
+
// =========================================================================
|
|
86
|
+
// Metadata Generation
|
|
87
|
+
// =========================================================================
|
|
88
|
+
/**
|
|
89
|
+
* Generate non-sensitive metadata JSON for an event.
|
|
90
|
+
* This metadata is stored on-chain alongside the proof hash.
|
|
91
|
+
*
|
|
92
|
+
* @param event - The verification event
|
|
93
|
+
* @param generatedBy - Who/what generated this proof
|
|
94
|
+
* @returns ProofMetadata object
|
|
95
|
+
*/
|
|
96
|
+
function generateMetadata(event, generatedBy = "Telika Platform") {
|
|
97
|
+
const descriptions = {
|
|
98
|
+
[types_1.EventType.IdentityVerification]: `Identity verification for ${event.telikaId}`,
|
|
99
|
+
[types_1.EventType.FundingDisbursement]: `Funding disbursement for ${event.telikaId}`,
|
|
100
|
+
[types_1.EventType.MilestoneConfirmation]: `Milestone confirmation for ${event.telikaId}`,
|
|
101
|
+
[types_1.EventType.ScoreUpdate]: `Score update for ${event.telikaId}`,
|
|
102
|
+
};
|
|
103
|
+
return {
|
|
104
|
+
eventDescription: descriptions[event.type],
|
|
105
|
+
generatedBy,
|
|
106
|
+
proofVersion: "1.0.0",
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
// =========================================================================
|
|
110
|
+
// Internal Helpers
|
|
111
|
+
// =========================================================================
|
|
112
|
+
/**
|
|
113
|
+
* Sanitize event data by removing sensitive fields.
|
|
114
|
+
* Returns a clean object with only the fields that should be included in the proof hash.
|
|
115
|
+
*/
|
|
116
|
+
function sanitizeEventData(event) {
|
|
117
|
+
// Base fields always included
|
|
118
|
+
const base = {
|
|
119
|
+
telikaId: event.telikaId,
|
|
120
|
+
timestamp: event.timestamp,
|
|
121
|
+
type: event.type,
|
|
122
|
+
};
|
|
123
|
+
switch (event.type) {
|
|
124
|
+
case types_1.EventType.IdentityVerification:
|
|
125
|
+
return {
|
|
126
|
+
...base,
|
|
127
|
+
documentType: event.documentType,
|
|
128
|
+
issuingCountry: event.issuingCountry,
|
|
129
|
+
verified: event.verified,
|
|
130
|
+
verifiedBy: event.verifiedBy,
|
|
131
|
+
};
|
|
132
|
+
case types_1.EventType.FundingDisbursement:
|
|
133
|
+
return {
|
|
134
|
+
...base,
|
|
135
|
+
amount: event.amount,
|
|
136
|
+
currency: event.currency,
|
|
137
|
+
funderId: event.funderId,
|
|
138
|
+
funderName: event.funderName,
|
|
139
|
+
fundingPurpose: event.fundingPurpose,
|
|
140
|
+
};
|
|
141
|
+
case types_1.EventType.MilestoneConfirmation:
|
|
142
|
+
return {
|
|
143
|
+
...base,
|
|
144
|
+
milestoneName: event.milestoneName,
|
|
145
|
+
description: event.description,
|
|
146
|
+
evidenceType: event.evidenceType,
|
|
147
|
+
confirmed: event.confirmed,
|
|
148
|
+
confirmedBy: event.confirmedBy,
|
|
149
|
+
};
|
|
150
|
+
case types_1.EventType.ScoreUpdate:
|
|
151
|
+
return {
|
|
152
|
+
...base,
|
|
153
|
+
previousScore: event.previousScore,
|
|
154
|
+
newScore: event.newScore,
|
|
155
|
+
reason: event.reason,
|
|
156
|
+
categoriesChanged: event.categoriesChanged,
|
|
157
|
+
};
|
|
158
|
+
default:
|
|
159
|
+
return base;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Canonically encode an object to a deterministic string.
|
|
164
|
+
* Keys are sorted alphabetically to ensure the same data always produces the same encoding.
|
|
165
|
+
*/
|
|
166
|
+
function canonicalEncode(data) {
|
|
167
|
+
const sortedKeys = Object.keys(data).sort();
|
|
168
|
+
const entries = sortedKeys.map((key) => {
|
|
169
|
+
const value = data[key];
|
|
170
|
+
if (Array.isArray(value)) {
|
|
171
|
+
return `${key}:${JSON.stringify(value.sort())}`;
|
|
172
|
+
}
|
|
173
|
+
return `${key}:${JSON.stringify(value)}`;
|
|
174
|
+
});
|
|
175
|
+
return entries.join("|");
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Generate a proof hash from raw ABI-encoded data.
|
|
179
|
+
* Useful for verifying proofs against the smart contract directly.
|
|
180
|
+
*
|
|
181
|
+
* @param types - Solidity ABI types
|
|
182
|
+
* @param values - Values corresponding to the types
|
|
183
|
+
* @returns keccak256 hash of ABI-encoded data
|
|
184
|
+
*/
|
|
185
|
+
function generateAbiEncodedHash(types, values) {
|
|
186
|
+
const abiCoder = ethers_1.AbiCoder.defaultAbiCoder();
|
|
187
|
+
const encoded = abiCoder.encode(types, values);
|
|
188
|
+
return (0, ethers_1.keccak256)(encoded);
|
|
189
|
+
}
|
|
190
|
+
//# sourceMappingURL=proof-generator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"proof-generator.js","sourceRoot":"","sources":["../src/proof-generator.ts"],"names":[],"mappings":";AAAA;;;;;;;;GAQG;;AAyBH,8CAIC;AAWD,kDAEC;AAWD,gDAEC;AAWD,oDAEC;AAWD,4CAEC;AAcD,4CAgBC;AAsFD,wDAIC;AAvMD,mCAA0D;AAC1D,mCAQiB;AAEjB,4EAA4E;AAC5E,wBAAwB;AACxB,4EAA4E;AAE5E;;;;;;;GAOG;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AC,QAAQ;gBACxB,MAAM,EAAE,KAAK,CAAC,MAAM;gBACpB,iBAAiB,EAAE,KAAK,CAAC,iBAAiB;aAC3C,CAAC;QAEJ;YACE,OAAO,IAAI,CAAC;IAChB,CAAC;AACH,CAAC;AAED;;;GAGG;AACH,SAAS,eAAe,CAAC,IAA6B;IACpD,MAAM,UAAU,GAAG,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,EAAE,CAAC;IAC5C,MAAM,OAAO,GAAG,UAAU,CAAC,GAAG,CAAC,CAAC,GAAG,EAAE,EAAE;QACrC,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC;QACxB,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;YACzB,OAAO,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,EAAE,CAAC;QAClD,CAAC;QACD,OAAO,GAAG,GAAG,IAAI,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,EAAE,CAAC;IAC3C,CAAC,CAAC,CAAC;IACH,OAAO,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3B,CAAC;AAED;;;;;;;GAOG;AACH,SAAgB,sBAAsB,CAAC,KAAe,EAAE,MAAiB;IACvE,MAAM,QAAQ,GAAG,iBAAQ,CAAC,eAAe,EAAE,CAAC;IAC5C,MAAM,OAAO,GAAG,QAAQ,CAAC,MAAM,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;IAC/C,OAAO,IAAA,kBAAS,EAAC,OAAO,CAAC,CAAC;AAC5B,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Telika SDK Type Definitions
|
|
3
|
+
*
|
|
4
|
+
* Core types for the proof generation and blockchain interaction modules.
|
|
5
|
+
* These types define the data structures for verification events, proof records,
|
|
6
|
+
* and configuration used throughout the SDK.
|
|
7
|
+
*/
|
|
8
|
+
/**
|
|
9
|
+
* Types of verification events that can be anchored on-chain.
|
|
10
|
+
* Values correspond to the Solidity enum in TelikaVerification.sol.
|
|
11
|
+
*/
|
|
12
|
+
export declare enum EventType {
|
|
13
|
+
IdentityVerification = 0,
|
|
14
|
+
FundingDisbursement = 1,
|
|
15
|
+
MilestoneConfirmation = 2,
|
|
16
|
+
ScoreUpdate = 3
|
|
17
|
+
}
|
|
18
|
+
/** Human-readable labels for event types */
|
|
19
|
+
export declare const EventTypeLabels: Record<EventType, string>;
|
|
20
|
+
/** Base fields shared by all verification events */
|
|
21
|
+
export interface BaseEvent {
|
|
22
|
+
/** Unique Telika identifier for the founder/venture */
|
|
23
|
+
telikaId: string;
|
|
24
|
+
/** ISO-8601 timestamp of the event */
|
|
25
|
+
timestamp: string;
|
|
26
|
+
/** Additional context about the event */
|
|
27
|
+
notes?: string;
|
|
28
|
+
}
|
|
29
|
+
/** Identity verification event data */
|
|
30
|
+
export interface IdentityEvent extends BaseEvent {
|
|
31
|
+
type: EventType.IdentityVerification;
|
|
32
|
+
/** Name of the identity document used (e.g., "National ID", "Passport") */
|
|
33
|
+
documentType: string;
|
|
34
|
+
/** Country of issuance */
|
|
35
|
+
issuingCountry: string;
|
|
36
|
+
/** Whether the identity was confirmed as valid */
|
|
37
|
+
verified: boolean;
|
|
38
|
+
/** Name of the verifying authority or agent */
|
|
39
|
+
verifiedBy: string;
|
|
40
|
+
}
|
|
41
|
+
/** Funding disbursement event data */
|
|
42
|
+
export interface FundingEvent extends BaseEvent {
|
|
43
|
+
type: EventType.FundingDisbursement;
|
|
44
|
+
/** Amount disbursed (in USD or local currency) */
|
|
45
|
+
amount: number;
|
|
46
|
+
/** Currency code (e.g., "USD", "KES", "NGN") */
|
|
47
|
+
currency: string;
|
|
48
|
+
/** Unique identifier for the funder */
|
|
49
|
+
funderId: string;
|
|
50
|
+
/** Name of the funder organization */
|
|
51
|
+
funderName: string;
|
|
52
|
+
/** Purpose or category of the funding */
|
|
53
|
+
fundingPurpose: string;
|
|
54
|
+
}
|
|
55
|
+
/** Milestone confirmation event data */
|
|
56
|
+
export interface MilestoneEvent extends BaseEvent {
|
|
57
|
+
type: EventType.MilestoneConfirmation;
|
|
58
|
+
/** Name or title of the milestone */
|
|
59
|
+
milestoneName: string;
|
|
60
|
+
/** Description of what was achieved */
|
|
61
|
+
description: string;
|
|
62
|
+
/** Supporting evidence type (e.g., "revenue report", "user growth metrics") */
|
|
63
|
+
evidenceType: string;
|
|
64
|
+
/** Whether the milestone was confirmed as completed */
|
|
65
|
+
confirmed: boolean;
|
|
66
|
+
/** Name of the confirming authority */
|
|
67
|
+
confirmedBy: string;
|
|
68
|
+
}
|
|
69
|
+
/** Score update event data */
|
|
70
|
+
export interface ScoreUpdateEvent extends BaseEvent {
|
|
71
|
+
type: EventType.ScoreUpdate;
|
|
72
|
+
/** Previous score value (0-100) */
|
|
73
|
+
previousScore: number;
|
|
74
|
+
/** New score value (0-100) */
|
|
75
|
+
newScore: number;
|
|
76
|
+
/** Reason for the score change */
|
|
77
|
+
reason: string;
|
|
78
|
+
/** Categories that changed (e.g., "team", "traction", "market") */
|
|
79
|
+
categoriesChanged: string[];
|
|
80
|
+
}
|
|
81
|
+
/** Union type of all verification events */
|
|
82
|
+
export type VerificationEvent = IdentityEvent | FundingEvent | MilestoneEvent | ScoreUpdateEvent;
|
|
83
|
+
/** Proof record as stored on-chain */
|
|
84
|
+
export interface ProofRecord {
|
|
85
|
+
/** Keccak256 hash of the verification event data */
|
|
86
|
+
proofHash: string;
|
|
87
|
+
/** Type of the verification event */
|
|
88
|
+
eventType: EventType;
|
|
89
|
+
/** Unique Telika identifier */
|
|
90
|
+
telikaId: string;
|
|
91
|
+
/** Block timestamp when the proof was anchored */
|
|
92
|
+
timestamp: number;
|
|
93
|
+
/** Additional non-sensitive metadata (JSON string) */
|
|
94
|
+
metadata: string;
|
|
95
|
+
/** Address that anchored this proof */
|
|
96
|
+
anchoredBy: string;
|
|
97
|
+
}
|
|
98
|
+
/** Result of a proof verification query */
|
|
99
|
+
export interface VerificationResult {
|
|
100
|
+
/** Whether the proof exists on-chain */
|
|
101
|
+
exists: boolean;
|
|
102
|
+
/** The proof record (undefined if not found) */
|
|
103
|
+
record?: ProofRecord;
|
|
104
|
+
}
|
|
105
|
+
/** Configuration for the TelikaBlockchainClient */
|
|
106
|
+
export interface TelikaClientConfig {
|
|
107
|
+
/** RPC URL for the Polygon network */
|
|
108
|
+
rpcUrl: string;
|
|
109
|
+
/** Address of the deployed TelikaVerification contract */
|
|
110
|
+
contractAddress: string;
|
|
111
|
+
/** Private key for signing transactions (required for write operations) */
|
|
112
|
+
privateKey?: string;
|
|
113
|
+
/** Chain ID (defaults to 80002 for Polygon Amoy) */
|
|
114
|
+
chainId?: number;
|
|
115
|
+
}
|
|
116
|
+
/** Metadata attached to an anchored proof */
|
|
117
|
+
export interface ProofMetadata {
|
|
118
|
+
/** Human-readable description of the event */
|
|
119
|
+
eventDescription: string;
|
|
120
|
+
/** Who or what system generated this proof */
|
|
121
|
+
generatedBy: string;
|
|
122
|
+
/** Version of the proof generation algorithm */
|
|
123
|
+
proofVersion: string;
|
|
124
|
+
/** Any additional key-value pairs */
|
|
125
|
+
[key: string]: string;
|
|
126
|
+
}
|
|
127
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAMH;;;GAGG;AACH,oBAAY,SAAS;IACnB,oBAAoB,IAAI;IACxB,mBAAmB,IAAI;IACvB,qBAAqB,IAAI;IACzB,WAAW,IAAI;CAChB;AAED,4CAA4C;AAC5C,eAAO,MAAM,eAAe,EAAE,MAAM,CAAC,SAAS,EAAE,MAAM,CAKrD,CAAC;AAMF,oDAAoD;AACpD,MAAM,WAAW,SAAS;IACxB,uDAAuD;IACvD,QAAQ,EAAE,MAAM,CAAC;IACjB,s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Type Definitions
|
|
4
|
+
*
|
|
5
|
+
* Core types for the proof generation and blockchain interaction modules.
|
|
6
|
+
* These types define the data structures for verification events, proof records,
|
|
7
|
+
* and configuration used throughout the SDK.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.EventTypeLabels = exports.EventType = void 0;
|
|
11
|
+
// =========================================================================
|
|
12
|
+
// Event Types (mirrors the Solidity enum)
|
|
13
|
+
// =========================================================================
|
|
14
|
+
/**
|
|
15
|
+
* Types of verification events that can be anchored on-chain.
|
|
16
|
+
* Values correspond to the Solidity enum in TelikaVerification.sol.
|
|
17
|
+
*/
|
|
18
|
+
var EventType;
|
|
19
|
+
(function (EventType) {
|
|
20
|
+
EventType[EventType["IdentityVerification"] = 0] = "IdentityVerification";
|
|
21
|
+
EventType[EventType["FundingDisbursement"] = 1] = "FundingDisbursement";
|
|
22
|
+
EventType[EventType["MilestoneConfirmation"] = 2] = "MilestoneConfirmation";
|
|
23
|
+
EventType[EventType["ScoreUpdate"] = 3] = "ScoreUpdate";
|
|
24
|
+
})(EventType || (exports.EventType = EventType = {}));
|
|
25
|
+
/** Human-readable labels for event types */
|
|
26
|
+
exports.EventTypeLabels = {
|
|
27
|
+
[EventType.IdentityVerification]: "Identity Verification",
|
|
28
|
+
[EventType.FundingDisbursement]: "Funding Disbursement",
|
|
29
|
+
[EventType.MilestoneConfirmation]: "Milestone Confirmation",
|
|
30
|
+
[EventType.ScoreUpdate]: "Score Update",
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAEH,4EAA4E;AAC5E,0CAA0C;AAC1C,4EAA4E;AAE5E;;;GAGG;AACH,IAAY,SAKX;AALD,WAAY,SAAS;IACnB,yEAAwB,CAAA;IACxB,uEAAuB,CAAA;IACvB,2EAAyB,CAAA;IACzB,uDAAe,CAAA;AACjB,CAAC,EALW,SAAS,yBAAT,SAAS,QAKpB;AAED,4CAA4C;AAC/B,QAAA,eAAe,GAA8B;IACxD,CAAC,SAAS,CAAC,oBAAoB,CAAC,EAAE,uBAAuB;IACzD,CAAC,SAAS,CAAC,mBAAmB,CAAC,EAAE,sBAAsB;IACvD,CAAC,SAAS,CAAC,qBAAqB,CAAC,EAAE,wBAAwB;IAC3D,CAAC,SAAS,CAAC,WAAW,CAAC,EAAE,cAAc;CACxC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@telika/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "Telika SDK — Proof generation and blockchain interaction for the Telika verification system on Polygon",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"types": "dist/index.d.ts",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist",
|
|
9
|
+
"README.md"
|
|
10
|
+
],
|
|
11
|
+
"scripts": {
|
|
12
|
+
"build": "tsc",
|
|
13
|
+
"prepublishOnly": "npm run build",
|
|
14
|
+
"test": "vitest run",
|
|
15
|
+
"test:watch": "vitest",
|
|
16
|
+
"clean": "rm -rf dist"
|
|
17
|
+
},
|
|
18
|
+
"keywords": [
|
|
19
|
+
"telika",
|
|
20
|
+
"blockchain",
|
|
21
|
+
"polygon",
|
|
22
|
+
"verification",
|
|
23
|
+
"proof",
|
|
24
|
+
"keccak256",
|
|
25
|
+
"smart-contract",
|
|
26
|
+
"ethers"
|
|
27
|
+
],
|
|
28
|
+
"license": "MIT",
|
|
29
|
+
"repository": {
|
|
30
|
+
"type": "git",
|
|
31
|
+
"url": "https://github.com/Telika-Africa/scoring-and-fund-allocation",
|
|
32
|
+
"directory": "sdk"
|
|
33
|
+
},
|
|
34
|
+
"homepage": "https://github.com/Telika-Africa/scoring-and-fund-allocation/tree/main/sdk#readme",
|
|
35
|
+
"dependencies": {
|
|
36
|
+
"ethers": "^6.13.0"
|
|
37
|
+
},
|
|
38
|
+
"devDependencies": {
|
|
39
|
+
"typescript": "^5.5.0",
|
|
40
|
+
"vitest": "^3.0.0"
|
|
41
|
+
},
|
|
42
|
+
"engines": {
|
|
43
|
+
"node": ">=18.0.0"
|
|
44
|
+
}
|
|
45
|
+
}
|