@telaro/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/CHANGELOG.md +27 -0
- package/QUICKSTART.md +216 -0
- package/README.md +129 -0
- package/dist/accounts.d.ts +51 -0
- package/dist/accounts.d.ts.map +1 -0
- package/dist/accounts.js +169 -0
- package/dist/accounts.js.map +1 -0
- package/dist/api.d.ts +177 -0
- package/dist/api.d.ts.map +1 -0
- package/dist/api.js +158 -0
- package/dist/api.js.map +1 -0
- package/dist/borsh.d.ts +33 -0
- package/dist/borsh.d.ts.map +1 -0
- package/dist/borsh.js +100 -0
- package/dist/borsh.js.map +1 -0
- package/dist/client.d.ts +70 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +164 -0
- package/dist/client.js.map +1 -0
- package/dist/constants.d.ts +46 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +47 -0
- package/dist/constants.js.map +1 -0
- package/dist/credit.d.ts +61 -0
- package/dist/credit.d.ts.map +1 -0
- package/dist/credit.js +133 -0
- package/dist/credit.js.map +1 -0
- package/dist/decimal.d.ts +36 -0
- package/dist/decimal.d.ts.map +1 -0
- package/dist/decimal.js +87 -0
- package/dist/decimal.js.map +1 -0
- package/dist/discriminators.d.ts +86 -0
- package/dist/discriminators.d.ts.map +1 -0
- package/dist/discriminators.js +100 -0
- package/dist/discriminators.js.map +1 -0
- package/dist/events.d.ts +268 -0
- package/dist/events.d.ts.map +1 -0
- package/dist/events.js +223 -0
- package/dist/events.js.map +1 -0
- package/dist/format.d.ts +10 -0
- package/dist/format.d.ts.map +1 -0
- package/dist/format.js +39 -0
- package/dist/format.js.map +1 -0
- package/dist/hash.d.ts +9 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/hash.js +33 -0
- package/dist/hash.js.map +1 -0
- package/dist/index.d.ts +17 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +17 -0
- package/dist/index.js.map +1 -0
- package/dist/instructions.d.ts +368 -0
- package/dist/instructions.d.ts.map +1 -0
- package/dist/instructions.js +841 -0
- package/dist/instructions.js.map +1 -0
- package/dist/metaplex.d.ts +64 -0
- package/dist/metaplex.d.ts.map +1 -0
- package/dist/metaplex.js +123 -0
- package/dist/metaplex.js.map +1 -0
- package/dist/pda.d.ts +35 -0
- package/dist/pda.d.ts.map +1 -0
- package/dist/pda.js +84 -0
- package/dist/pda.js.map +1 -0
- package/dist/realtime.d.ts +67 -0
- package/dist/realtime.d.ts.map +1 -0
- package/dist/realtime.js +112 -0
- package/dist/realtime.js.map +1 -0
- package/dist/score.d.ts +51 -0
- package/dist/score.d.ts.map +1 -0
- package/dist/score.js +63 -0
- package/dist/score.js.map +1 -0
- package/dist/types.d.ts +139 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +51 -0
- package/dist/types.js.map +1 -0
- package/package.json +88 -0
package/dist/score.d.ts
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface ScoreInputs {
|
|
2
|
+
actionCount: number | bigint;
|
|
3
|
+
successCount: number | bigint;
|
|
4
|
+
disputedCount: number | bigint;
|
|
5
|
+
/** Current bond in atomic units (e.g. USDC base units, 6dp). */
|
|
6
|
+
currentBond: number | bigint;
|
|
7
|
+
/** Sum of value_atomic over the last 30d (atomic units). */
|
|
8
|
+
valueHandled30d: number | bigint;
|
|
9
|
+
/** True if a high-value failure happened in the last 7d. */
|
|
10
|
+
recentHighValueFailure7d?: boolean;
|
|
11
|
+
/** v0.3: Number of successful actions recorded after the most recent
|
|
12
|
+
* dispute. Used to compute the redemption factor — a builder who
|
|
13
|
+
* has gotten back to consistent successful operation gradually
|
|
14
|
+
* rebuilds reputation. Optional (defaults to 0 → no redemption). */
|
|
15
|
+
successCountSinceLastDispute?: number | bigint;
|
|
16
|
+
}
|
|
17
|
+
export interface ScoreOutput {
|
|
18
|
+
score: number;
|
|
19
|
+
bondRatioBps: number;
|
|
20
|
+
components: {
|
|
21
|
+
base: number;
|
|
22
|
+
tenure: number;
|
|
23
|
+
successRate: number;
|
|
24
|
+
disputeRate: number;
|
|
25
|
+
bondRatio: number;
|
|
26
|
+
decay: number;
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Default v0.3 scoring policy.
|
|
31
|
+
* score = base
|
|
32
|
+
* + 50 × tanh(log10(action_count)) (tenure, max +50)
|
|
33
|
+
* + 200 × (success / action) (max +200)
|
|
34
|
+
* - 300 × (disputed / action) × (1 - redemption_factor × 0.5)
|
|
35
|
+
* (max -300, min -150 with full redemption)
|
|
36
|
+
* + 100 × min(1.0, bond / value_handled_30d) (max +100)
|
|
37
|
+
* - 100 if recent_high_value_failure_in_7d
|
|
38
|
+
* clamped to [0, 1000]
|
|
39
|
+
*
|
|
40
|
+
* v0.3 redemption factor:
|
|
41
|
+
* redemption_factor = min(1.0, success_count_since_last_dispute / 50)
|
|
42
|
+
*
|
|
43
|
+
* After 50 consecutive successful actions post-dispute, half the
|
|
44
|
+
* dispute weight is forgiven. Encourages builder rehabilitation
|
|
45
|
+
* rather than forcing keypair rotation. Note: dispute_count itself
|
|
46
|
+
* is permanent on chain — only the score impact decays.
|
|
47
|
+
*/
|
|
48
|
+
export declare function computeScore(input: ScoreInputs): ScoreOutput;
|
|
49
|
+
export type ScoreTier = "high" | "medium" | "low";
|
|
50
|
+
export declare function tierOf(score: number): ScoreTier;
|
|
51
|
+
//# sourceMappingURL=score.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.d.ts","sourceRoot":"","sources":["../src/score.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,WAAW;IAC1B,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,YAAY,EAAE,MAAM,GAAG,MAAM,CAAC;IAC9B,aAAa,EAAE,MAAM,GAAG,MAAM,CAAC;IAC/B,gEAAgE;IAChE,WAAW,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B,4DAA4D;IAC5D,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;IACjC,4DAA4D;IAC5D,wBAAwB,CAAC,EAAE,OAAO,CAAC;IACnC;;;yEAGqE;IACrE,4BAA4B,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;CAChD;AAED,MAAM,WAAW,WAAW;IAC1B,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE;QACV,IAAI,EAAE,MAAM,CAAC;QACb,MAAM,EAAE,MAAM,CAAC;QACf,WAAW,EAAE,MAAM,CAAC;QACpB,WAAW,EAAE,MAAM,CAAC;QACpB,SAAS,EAAE,MAAM,CAAC;QAClB,KAAK,EAAE,MAAM,CAAC;KACf,CAAC;CACH;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,WAAW,GAAG,WAAW,CA2C5D;AAED,MAAM,MAAM,SAAS,GAAG,MAAM,GAAG,QAAQ,GAAG,KAAK,CAAC;AAElD,wBAAgB,MAAM,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,CAI/C"}
|
package/dist/score.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import { BASE_SCORE, MAX_SCORE } from "./constants.js";
|
|
2
|
+
/**
|
|
3
|
+
* Default v0.3 scoring policy.
|
|
4
|
+
* score = base
|
|
5
|
+
* + 50 × tanh(log10(action_count)) (tenure, max +50)
|
|
6
|
+
* + 200 × (success / action) (max +200)
|
|
7
|
+
* - 300 × (disputed / action) × (1 - redemption_factor × 0.5)
|
|
8
|
+
* (max -300, min -150 with full redemption)
|
|
9
|
+
* + 100 × min(1.0, bond / value_handled_30d) (max +100)
|
|
10
|
+
* - 100 if recent_high_value_failure_in_7d
|
|
11
|
+
* clamped to [0, 1000]
|
|
12
|
+
*
|
|
13
|
+
* v0.3 redemption factor:
|
|
14
|
+
* redemption_factor = min(1.0, success_count_since_last_dispute / 50)
|
|
15
|
+
*
|
|
16
|
+
* After 50 consecutive successful actions post-dispute, half the
|
|
17
|
+
* dispute weight is forgiven. Encourages builder rehabilitation
|
|
18
|
+
* rather than forcing keypair rotation. Note: dispute_count itself
|
|
19
|
+
* is permanent on chain — only the score impact decays.
|
|
20
|
+
*/
|
|
21
|
+
export function computeScore(input) {
|
|
22
|
+
const actionCount = Number(input.actionCount);
|
|
23
|
+
const successCount = Number(input.successCount);
|
|
24
|
+
const disputedCount = Number(input.disputedCount);
|
|
25
|
+
const bond = Number(input.currentBond);
|
|
26
|
+
const valueHandled = Number(input.valueHandled30d);
|
|
27
|
+
const successSinceDispute = Number(input.successCountSinceLastDispute ?? 0);
|
|
28
|
+
const base = BASE_SCORE;
|
|
29
|
+
const tenure = actionCount === 0
|
|
30
|
+
? 0
|
|
31
|
+
: 50 * Math.tanh(Math.log10(Math.max(1, actionCount)));
|
|
32
|
+
const successRate = actionCount === 0 ? 0 : 200 * (successCount / actionCount);
|
|
33
|
+
// v0.3 redemption: post-dispute successes forgive up to 50% of dispute weight
|
|
34
|
+
const redemptionFactor = Math.min(1.0, successSinceDispute / 50);
|
|
35
|
+
const disputeWeight = -300 * (1 - redemptionFactor * 0.5);
|
|
36
|
+
const disputeRate = actionCount === 0 ? 0 : disputeWeight * (disputedCount / actionCount);
|
|
37
|
+
const ratio = valueHandled === 0 ? 1 : Math.min(1, bond / valueHandled);
|
|
38
|
+
const bondRatio = 100 * ratio;
|
|
39
|
+
const decay = input.recentHighValueFailure7d ? -100 : 0;
|
|
40
|
+
const raw = base + tenure + successRate + disputeRate + bondRatio + decay;
|
|
41
|
+
const score = Math.max(0, Math.min(MAX_SCORE, Math.round(raw)));
|
|
42
|
+
const bondRatioBps = Math.round(ratio * 10_000);
|
|
43
|
+
return {
|
|
44
|
+
score,
|
|
45
|
+
bondRatioBps,
|
|
46
|
+
components: {
|
|
47
|
+
base,
|
|
48
|
+
tenure: Math.round(tenure),
|
|
49
|
+
successRate: Math.round(successRate),
|
|
50
|
+
disputeRate: Math.round(disputeRate),
|
|
51
|
+
bondRatio: Math.round(bondRatio),
|
|
52
|
+
decay,
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export function tierOf(score) {
|
|
57
|
+
if (score >= 700)
|
|
58
|
+
return "high";
|
|
59
|
+
if (score >= 400)
|
|
60
|
+
return "medium";
|
|
61
|
+
return "low";
|
|
62
|
+
}
|
|
63
|
+
//# sourceMappingURL=score.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"score.js","sourceRoot":"","sources":["../src/score.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,gBAAgB,CAAC;AAgCvD;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,YAAY,CAAC,KAAkB;IAC7C,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IAC9C,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,YAAY,CAAC,CAAC;IAChD,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,aAAa,CAAC,CAAC;IAClD,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;IACvC,MAAM,YAAY,GAAG,MAAM,CAAC,KAAK,CAAC,eAAe,CAAC,CAAC;IACnD,MAAM,mBAAmB,GAAG,MAAM,CAAC,KAAK,CAAC,4BAA4B,IAAI,CAAC,CAAC,CAAC;IAE5E,MAAM,IAAI,GAAG,UAAU,CAAC;IACxB,MAAM,MAAM,GACV,WAAW,KAAK,CAAC;QACf,CAAC,CAAC,CAAC;QACH,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,CAAC,CAAC,CAAC;IAC3D,MAAM,WAAW,GACf,WAAW,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,CAA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,KAAK,CAAC,WAAW,CAAC;YACpC,SAAS,EAAE,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC;YAChC,KAAK;SACN;KACF,CAAC;AACJ,CAAC;AAID,MAAM,UAAU,MAAM,CAAC,KAAa;IAClC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,MAAM,CAAC;IAChC,IAAI,KAAK,IAAI,GAAG;QAAE,OAAO,QAAQ,CAAC;IAClC,OAAO,KAAK,CAAC;AACf,CAAC"}
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import type { PublicKey } from "@solana/web3.js";
|
|
2
|
+
export declare enum ActionKind {
|
|
3
|
+
Swap = 0,
|
|
4
|
+
Lp = 1,
|
|
5
|
+
Vote = 2,
|
|
6
|
+
Message = 3,
|
|
7
|
+
Lend = 4,
|
|
8
|
+
Stake = 5,
|
|
9
|
+
Bridge = 6,
|
|
10
|
+
Custom = 99
|
|
11
|
+
}
|
|
12
|
+
export declare enum ActionOutcome {
|
|
13
|
+
Success = 0,
|
|
14
|
+
Failed = 1,
|
|
15
|
+
Disputed = 2
|
|
16
|
+
}
|
|
17
|
+
export declare enum ClaimStatus {
|
|
18
|
+
Open = 0,
|
|
19
|
+
AcceptedByBuilder = 1,
|
|
20
|
+
AutoAccepted = 2,
|
|
21
|
+
RejectedByBuilder = 3,
|
|
22
|
+
Withdrawn = 4,
|
|
23
|
+
/** v0.3: user escalated, awaiting arbiter ruling. */
|
|
24
|
+
Escalated = 5,
|
|
25
|
+
/** v0.3: arbiter ruled ForUser. 2x penalty paid out. */
|
|
26
|
+
ArbiterAcceptedForUser = 6,
|
|
27
|
+
/** v0.3: arbiter ruled ForBuilder. User loses both deposits. */
|
|
28
|
+
ArbiterAcceptedForBuilder = 7,
|
|
29
|
+
/** v0.3: arbiter window expired (7d). Defaults to user payout. */
|
|
30
|
+
ArbiterAutoForUser = 8
|
|
31
|
+
}
|
|
32
|
+
export declare enum ResolveAction {
|
|
33
|
+
BuilderAccept = 0,
|
|
34
|
+
BuilderReject = 1,
|
|
35
|
+
AutoTimeout = 2
|
|
36
|
+
}
|
|
37
|
+
/** Who decided the final outcome of a claim. */
|
|
38
|
+
export declare enum ClaimResolvedBy {
|
|
39
|
+
/** Builder (accept or reject) or AutoTimeout (no signer required). */
|
|
40
|
+
BuilderOrAutoTimeout = 0,
|
|
41
|
+
AutoTimeout = 1,
|
|
42
|
+
/** Active arbiter ruling. */
|
|
43
|
+
Arbiter = 2,
|
|
44
|
+
/** Arbiter window expired, anyone cranked. */
|
|
45
|
+
ArbiterTimeout = 3
|
|
46
|
+
}
|
|
47
|
+
export interface AgentAccount {
|
|
48
|
+
controller: PublicKey;
|
|
49
|
+
bondMint: PublicKey;
|
|
50
|
+
bondVault: PublicKey;
|
|
51
|
+
scorer: PublicKey;
|
|
52
|
+
framework: string;
|
|
53
|
+
metadataUri: string;
|
|
54
|
+
createdAt: number;
|
|
55
|
+
lastActionAt: number;
|
|
56
|
+
actionCount: bigint;
|
|
57
|
+
successCount: bigint;
|
|
58
|
+
failedCount: bigint;
|
|
59
|
+
disputedCount: bigint;
|
|
60
|
+
currentBond: bigint;
|
|
61
|
+
/** Sum of `claimed_amount` across open claims, reserved against
|
|
62
|
+
* current_bond. New claims are blocked if (current_bond −
|
|
63
|
+
* reserved_for_claims) < amount. */
|
|
64
|
+
reservedForClaims: bigint;
|
|
65
|
+
valueHandled30d: bigint;
|
|
66
|
+
currentScore: number;
|
|
67
|
+
openClaims: number;
|
|
68
|
+
frozen: boolean;
|
|
69
|
+
}
|
|
70
|
+
export interface LogEntry {
|
|
71
|
+
actionHash: Uint8Array;
|
|
72
|
+
kind: number;
|
|
73
|
+
outcome: number;
|
|
74
|
+
valueAtomic: bigint;
|
|
75
|
+
slot: bigint;
|
|
76
|
+
ts: number;
|
|
77
|
+
}
|
|
78
|
+
export interface ClaimAccount {
|
|
79
|
+
agent: PublicKey;
|
|
80
|
+
claimer: PublicKey;
|
|
81
|
+
actionHash: Uint8Array;
|
|
82
|
+
claimedAmount: bigint;
|
|
83
|
+
depositAmount: bigint;
|
|
84
|
+
evidenceUri: string;
|
|
85
|
+
createdAt: number;
|
|
86
|
+
deadline: number;
|
|
87
|
+
status: ClaimStatus;
|
|
88
|
+
resolvedAt: number;
|
|
89
|
+
/** v0.3: 5% additional deposit posted on escalation. */
|
|
90
|
+
escalationDeposit?: bigint;
|
|
91
|
+
/** v0.3: timestamp escalate_claim was called. 0 if never escalated. */
|
|
92
|
+
escalatedAt?: number;
|
|
93
|
+
/** v0.3: who decided the final outcome (Builder/AutoTimeout/Arbiter/ArbiterTimeout). */
|
|
94
|
+
resolvedBy?: ClaimResolvedBy;
|
|
95
|
+
}
|
|
96
|
+
export interface RecordActionInput {
|
|
97
|
+
/** Optional explicit hash. If omitted, the SDK hashes the payload. */
|
|
98
|
+
actionHash?: Uint8Array;
|
|
99
|
+
/** Free-form payload hashed into the on-chain action_hash. */
|
|
100
|
+
payload?: unknown;
|
|
101
|
+
kind: ActionKind;
|
|
102
|
+
outcome: ActionOutcome;
|
|
103
|
+
/** Approx value-at-risk in token base units (USDC: 6dp). 0 if non-financial. */
|
|
104
|
+
valueAtomic: bigint;
|
|
105
|
+
}
|
|
106
|
+
export interface RegisterAgentInput {
|
|
107
|
+
framework: string;
|
|
108
|
+
metadataUri: string;
|
|
109
|
+
/** Pubkey allowed to call `update_score` (off-chain indexer). */
|
|
110
|
+
scorer: PublicKey;
|
|
111
|
+
/** Bond mint (USDC on mainnet, mock on devnet). */
|
|
112
|
+
bondMint: PublicKey;
|
|
113
|
+
/** Atomic bond amount (USDC: 10 = 10_000_000). */
|
|
114
|
+
bondAmount: bigint;
|
|
115
|
+
}
|
|
116
|
+
export interface SubmitClaimInput {
|
|
117
|
+
agent: PublicKey;
|
|
118
|
+
actionHash: Uint8Array;
|
|
119
|
+
/** Claimed damage in bond-mint atomic units. */
|
|
120
|
+
claimedAmount: bigint;
|
|
121
|
+
/** ipfs:// or arweave:// URI to evidence. */
|
|
122
|
+
evidenceUri: string;
|
|
123
|
+
}
|
|
124
|
+
export interface TrustCardData {
|
|
125
|
+
agent: PublicKey;
|
|
126
|
+
agentString: string;
|
|
127
|
+
framework: string;
|
|
128
|
+
controller: PublicKey;
|
|
129
|
+
score: number;
|
|
130
|
+
scoreTier: "high" | "medium" | "low";
|
|
131
|
+
bondAtomic: bigint;
|
|
132
|
+
bondHuman: string;
|
|
133
|
+
actionCount: bigint;
|
|
134
|
+
successRate: number;
|
|
135
|
+
disputed90d: number;
|
|
136
|
+
bondedSinceTs: number;
|
|
137
|
+
frozen: boolean;
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEjD,oBAAY,UAAU;IACpB,IAAI,IAAI;IACR,EAAE,IAAI;IACN,IAAI,IAAI;IACR,OAAO,IAAI;IACX,IAAI,IAAI;IACR,KAAK,IAAI;IACT,MAAM,IAAI;IACV,MAAM,KAAK;CACZ;AAED,oBAAY,aAAa;IACvB,OAAO,IAAI;IACX,MAAM,IAAI;IACV,QAAQ,IAAI;CACb;AAED,oBAAY,WAAW;IACrB,IAAI,IAAI;IACR,iBAAiB,IAAI;IACrB,YAAY,IAAI;IAChB,iBAAiB,IAAI;IACrB,SAAS,IAAI;IACb,qDAAqD;IACrD,SAAS,IAAI;IACb,wDAAwD;IACxD,sBAAsB,IAAI;IAC1B,gEAAgE;IAChE,yBAAyB,IAAI;IAC7B,kEAAkE;IAClE,kBAAkB,IAAI;CACvB;AAED,oBAAY,aAAa;IACvB,aAAa,IAAI;IACjB,aAAa,IAAI;IACjB,WAAW,IAAI;CAChB;AAED,gDAAgD;AAChD,oBAAY,eAAe;IACzB,sEAAsE;IACtE,oBAAoB,IAAI;IACxB,WAAW,IAAI;I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js
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export var ActionKind;
|
|
2
|
+
(function (ActionKind) {
|
|
3
|
+
ActionKind[ActionKind["Swap"] = 0] = "Swap";
|
|
4
|
+
ActionKind[ActionKind["Lp"] = 1] = "Lp";
|
|
5
|
+
ActionKind[ActionKind["Vote"] = 2] = "Vote";
|
|
6
|
+
ActionKind[ActionKind["Message"] = 3] = "Message";
|
|
7
|
+
ActionKind[ActionKind["Lend"] = 4] = "Lend";
|
|
8
|
+
ActionKind[ActionKind["Stake"] = 5] = "Stake";
|
|
9
|
+
ActionKind[ActionKind["Bridge"] = 6] = "Bridge";
|
|
10
|
+
ActionKind[ActionKind["Custom"] = 99] = "Custom";
|
|
11
|
+
})(ActionKind || (ActionKind = {}));
|
|
12
|
+
export var ActionOutcome;
|
|
13
|
+
(function (ActionOutcome) {
|
|
14
|
+
ActionOutcome[ActionOutcome["Success"] = 0] = "Success";
|
|
15
|
+
ActionOutcome[ActionOutcome["Failed"] = 1] = "Failed";
|
|
16
|
+
ActionOutcome[ActionOutcome["Disputed"] = 2] = "Disputed";
|
|
17
|
+
})(ActionOutcome || (ActionOutcome = {}));
|
|
18
|
+
export var ClaimStatus;
|
|
19
|
+
(function (ClaimStatus) {
|
|
20
|
+
ClaimStatus[ClaimStatus["Open"] = 0] = "Open";
|
|
21
|
+
ClaimStatus[ClaimStatus["AcceptedByBuilder"] = 1] = "AcceptedByBuilder";
|
|
22
|
+
ClaimStatus[ClaimStatus["AutoAccepted"] = 2] = "AutoAccepted";
|
|
23
|
+
ClaimStatus[ClaimStatus["RejectedByBuilder"] = 3] = "RejectedByBuilder";
|
|
24
|
+
ClaimStatus[ClaimStatus["Withdrawn"] = 4] = "Withdrawn";
|
|
25
|
+
/** v0.3: user escalated, awaiting arbiter ruling. */
|
|
26
|
+
ClaimStatus[ClaimStatus["Escalated"] = 5] = "Escalated";
|
|
27
|
+
/** v0.3: arbiter ruled ForUser. 2x penalty paid out. */
|
|
28
|
+
ClaimStatus[ClaimStatus["ArbiterAcceptedForUser"] = 6] = "ArbiterAcceptedForUser";
|
|
29
|
+
/** v0.3: arbiter ruled ForBuilder. User loses both deposits. */
|
|
30
|
+
ClaimStatus[ClaimStatus["ArbiterAcceptedForBuilder"] = 7] = "ArbiterAcceptedForBuilder";
|
|
31
|
+
/** v0.3: arbiter window expired (7d). Defaults to user payout. */
|
|
32
|
+
ClaimStatus[ClaimStatus["ArbiterAutoForUser"] = 8] = "ArbiterAutoForUser";
|
|
33
|
+
})(ClaimStatus || (ClaimStatus = {}));
|
|
34
|
+
export var ResolveAction;
|
|
35
|
+
(function (ResolveAction) {
|
|
36
|
+
ResolveAction[ResolveAction["BuilderAccept"] = 0] = "BuilderAccept";
|
|
37
|
+
ResolveAction[ResolveAction["BuilderReject"] = 1] = "BuilderReject";
|
|
38
|
+
ResolveAction[ResolveAction["AutoTimeout"] = 2] = "AutoTimeout";
|
|
39
|
+
})(ResolveAction || (ResolveAction = {}));
|
|
40
|
+
/** Who decided the final outcome of a claim. */
|
|
41
|
+
export var ClaimResolvedBy;
|
|
42
|
+
(function (ClaimResolvedBy) {
|
|
43
|
+
/** Builder (accept or reject) or AutoTimeout (no signer required). */
|
|
44
|
+
ClaimResolvedBy[ClaimResolvedBy["BuilderOrAutoTimeout"] = 0] = "BuilderOrAutoTimeout";
|
|
45
|
+
ClaimResolvedBy[ClaimResolvedBy["AutoTimeout"] = 1] = "AutoTimeout";
|
|
46
|
+
/** Active arbiter ruling. */
|
|
47
|
+
ClaimResolvedBy[ClaimResolvedBy["Arbiter"] = 2] = "Arbiter";
|
|
48
|
+
/** Arbiter window expired, anyone cranked. */
|
|
49
|
+
ClaimResolvedBy[ClaimResolvedBy["ArbiterTimeout"] = 3] = "ArbiterTimeout";
|
|
50
|
+
})(ClaimResolvedBy || (ClaimResolvedBy = {}));
|
|
51
|
+
//# sourceMappingURL=types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAEA,MAAM,CAAN,IAAY,UASX;AATD,WAAY,UAAU;IACpB,2CAAQ,CAAA;IACR,uCAAM,CAAA;IACN,2CAAQ,CAAA;IACR,iDAAW,CAAA;IACX,2CAAQ,CAAA;IACR,6CAAS,CAAA;IACT,+CAAU,CAAA;IACV,gDAAW,CAAA;AACb,CAAC,EATW,UAAU,KAAV,UAAU,QASrB;AAED,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,uDAAW,CAAA;IACX,qDAAU,CAAA;IACV,yDAAY,CAAA;AACd,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAED,MAAM,CAAN,IAAY,WAcX;AAdD,WAAY,WAAW;IACrB,6CAAQ,CAAA;IACR,uEAAqB,CAAA;IACrB,6DAAgB,CAAA;IAChB,uEAAqB,CAAA;IACrB,uDAAa,CAAA;IACb,qDAAqD;IACrD,uDAAa,CAAA;IACb,wDAAwD;IACxD,iFAA0B,CAAA;IAC1B,gEAAgE;IAChE,uFAA6B,CAAA;IAC7B,kEAAkE;IAClE,yEAAsB,CAAA;AACxB,CAAC,EAdW,WAAW,KAAX,WAAW,QActB;AAED,MAAM,CAAN,IAAY,aAIX;AAJD,WAAY,aAAa;IACvB,mEAAiB,CAAA;IACjB,mEAAiB,CAAA;IACjB,+DAAe,CAAA;AACjB,CAAC,EAJW,aAAa,KAAb,aAAa,QAIxB;AAED,gDAAgD;AAChD,MAAM,CAAN,IAAY,eAQX;AARD,WAAY,eAAe;IACzB,sEAAsE;IACtE,qFAAwB,CAAA;IACxB,mEAAe,CAAA;IACf,6BAA6B;IAC7B,2DAAW,CAAA;IACX,8CAA8C;IAC9C,yEAAkB,CAAA;AACpB,CAAC,EARW,eAAe,KAAf,eAAe,QAQ1B"}
|
package/package.json
ADDED
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@telaro/sdk",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "TypeScript SDK for the Telaro protocol on Solana \u2014 skin-in-the-game reputation primitive",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"main": "dist/index.js",
|
|
7
|
+
"module": "dist/index.js",
|
|
8
|
+
"types": "dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./score": {
|
|
15
|
+
"types": "./dist/score.d.ts",
|
|
16
|
+
"import": "./dist/score.js"
|
|
17
|
+
},
|
|
18
|
+
"./pda": {
|
|
19
|
+
"types": "./dist/pda.d.ts",
|
|
20
|
+
"import": "./dist/pda.js"
|
|
21
|
+
},
|
|
22
|
+
"./api": {
|
|
23
|
+
"types": "./dist/api.d.ts",
|
|
24
|
+
"import": "./dist/api.js"
|
|
25
|
+
},
|
|
26
|
+
"./metaplex": {
|
|
27
|
+
"types": "./dist/metaplex.d.ts",
|
|
28
|
+
"import": "./dist/metaplex.js"
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
"files": [
|
|
32
|
+
"dist",
|
|
33
|
+
"README.md",
|
|
34
|
+
"QUICKSTART.md",
|
|
35
|
+
"CHANGELOG.md"
|
|
36
|
+
],
|
|
37
|
+
"scripts": {
|
|
38
|
+
"build": "tsc -p tsconfig.json",
|
|
39
|
+
"typecheck": "tsc --noEmit",
|
|
40
|
+
"test": "node --import tsx/esm --test --test-concurrency=1 tests/*.test.ts",
|
|
41
|
+
"clean": "rm -rf dist",
|
|
42
|
+
"prepublishOnly": "pnpm clean && pnpm build",
|
|
43
|
+
"publish:dry": "npm publish --dry-run"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"@coral-xyz/anchor": "^0.30.1",
|
|
47
|
+
"@metaplex-foundation/mpl-core": "^1.1.1",
|
|
48
|
+
"@metaplex-foundation/umi": "^0.9.2",
|
|
49
|
+
"@metaplex-foundation/umi-bundle-defaults": "^0.9.2",
|
|
50
|
+
"@metaplex-foundation/umi-signer-wallet-adapters": "^0.9.2",
|
|
51
|
+
"@metaplex-foundation/umi-web3js-adapters": "^0.9.2",
|
|
52
|
+
"@noble/hashes": "^1.5.0",
|
|
53
|
+
"@solana/spl-token": "^0.4.8",
|
|
54
|
+
"@solana/web3.js": "^1.95.0"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@types/node": "^22.0.0",
|
|
58
|
+
"tsx": "^4.16.0",
|
|
59
|
+
"typescript": "^5.5.0"
|
|
60
|
+
},
|
|
61
|
+
"publishConfig": {
|
|
62
|
+
"access": "public",
|
|
63
|
+
"registry": "https://registry.npmjs.org/"
|
|
64
|
+
},
|
|
65
|
+
"repository": {
|
|
66
|
+
"type": "git",
|
|
67
|
+
"url": "git+https://github.com/telaro-protocol/telaro.git",
|
|
68
|
+
"directory": "sdk"
|
|
69
|
+
},
|
|
70
|
+
"homepage": "https://telaro.xyz",
|
|
71
|
+
"bugs": {
|
|
72
|
+
"url": "https://github.com/telaro-protocol/telaro/issues"
|
|
73
|
+
},
|
|
74
|
+
"engines": {
|
|
75
|
+
"node": ">=20"
|
|
76
|
+
},
|
|
77
|
+
"keywords": [
|
|
78
|
+
"ai-agents",
|
|
79
|
+
"anchor",
|
|
80
|
+
"metaplex",
|
|
81
|
+
"reputation",
|
|
82
|
+
"sdk",
|
|
83
|
+
"solana",
|
|
84
|
+
"telaro"
|
|
85
|
+
],
|
|
86
|
+
"type": "module",
|
|
87
|
+
"sideEffects": false
|
|
88
|
+
}
|