pyre-world-kit 2.0.11 → 3.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/.prettierrc.json +6 -0
- package/dist/actions.js +16 -0
- package/dist/index.d.ts +38 -4
- package/dist/index.js +100 -85
- package/dist/providers/action.provider.d.ts +46 -0
- package/dist/providers/action.provider.js +331 -0
- package/dist/providers/intel.provider.d.ts +29 -0
- package/dist/providers/intel.provider.js +363 -0
- package/dist/providers/mapper.provider.d.ts +197 -0
- package/dist/providers/mapper.provider.js +158 -0
- package/dist/providers/registry.provider.d.ts +25 -0
- package/dist/providers/registry.provider.js +229 -0
- package/dist/providers/state.provider.d.ts +42 -0
- package/dist/providers/state.provider.js +348 -0
- package/dist/pyre_world.json +34 -229
- package/dist/types/action.types.d.ts +41 -0
- package/dist/types/action.types.js +2 -0
- package/dist/types/intel.types.d.ts +20 -0
- package/dist/types/intel.types.js +2 -0
- package/dist/types/mapper.types.d.ts +27 -0
- package/dist/types/mapper.types.js +22 -0
- package/dist/types/registry.types.d.ts +0 -0
- package/dist/types/registry.types.js +1 -0
- package/dist/types/state.types.d.ts +112 -0
- package/dist/types/state.types.js +2 -0
- package/dist/types.d.ts +8 -24
- package/dist/util.d.ts +29 -0
- package/dist/util.js +144 -0
- package/dist/vanity.d.ts +3 -3
- package/dist/vanity.js +18 -15
- package/package.json +4 -2
- package/readme.md +134 -122
- package/src/index.ts +127 -92
- package/src/providers/action.provider.ts +443 -0
- package/src/providers/intel.provider.ts +383 -0
- package/src/providers/mapper.provider.ts +195 -0
- package/src/providers/registry.provider.ts +277 -0
- package/src/providers/state.provider.ts +357 -0
- package/src/pyre_world.json +35 -230
- package/src/types/action.types.ts +76 -0
- package/src/types/intel.types.ts +22 -0
- package/src/types/mapper.types.ts +84 -0
- package/src/types/registry.types.ts +0 -0
- package/src/types/state.types.ts +144 -0
- package/src/types.ts +329 -333
- package/src/util.ts +148 -0
- package/src/vanity.ts +27 -14
- package/tests/test_e2e.ts +339 -172
- package/src/actions.ts +0 -703
- package/src/intel.ts +0 -521
- package/src/mappers.ts +0 -302
- package/src/registry.ts +0 -317
- package/tests/test_devnet_e2e.ts +0 -401
- package/tests/test_sim.ts +0 -458
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.IntelProvider = void 0;
|
|
37
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
38
|
+
const vanity_1 = require("../vanity");
|
|
39
|
+
const util_1 = require("../util");
|
|
40
|
+
class IntelProvider {
|
|
41
|
+
connection;
|
|
42
|
+
actionProvider;
|
|
43
|
+
constructor(connection, actionProvider) {
|
|
44
|
+
this.connection = connection;
|
|
45
|
+
this.actionProvider = actionProvider;
|
|
46
|
+
}
|
|
47
|
+
async getAgentFactions(wallet, factionLimit = 50) {
|
|
48
|
+
const { TOKEN_2022_PROGRAM_ID } = await Promise.resolve().then(() => __importStar(require('@solana/spl-token')));
|
|
49
|
+
const walletPk = new web3_js_1.PublicKey(wallet);
|
|
50
|
+
// Scan wallet token accounts
|
|
51
|
+
const walletAccounts = await this.connection.getParsedTokenAccountsByOwner(walletPk, {
|
|
52
|
+
programId: TOKEN_2022_PROGRAM_ID,
|
|
53
|
+
});
|
|
54
|
+
// Scan vault token accounts if a vault exists
|
|
55
|
+
let vaultAccounts = { context: walletAccounts.context, value: [] };
|
|
56
|
+
try {
|
|
57
|
+
const vault = await this.actionProvider.getStrongholdForAgent(wallet);
|
|
58
|
+
if (!vault)
|
|
59
|
+
throw new Error('no vault');
|
|
60
|
+
const vaultPk = new web3_js_1.PublicKey(vault.address);
|
|
61
|
+
vaultAccounts = await this.connection.getParsedTokenAccountsByOwner(vaultPk, {
|
|
62
|
+
programId: TOKEN_2022_PROGRAM_ID,
|
|
63
|
+
});
|
|
64
|
+
}
|
|
65
|
+
catch { }
|
|
66
|
+
// Merge balances from both sources (wallet + vault)
|
|
67
|
+
const balanceMap = new Map();
|
|
68
|
+
for (const a of [...walletAccounts.value, ...vaultAccounts.value]) {
|
|
69
|
+
const mint = a.account.data.parsed.info.mint;
|
|
70
|
+
const balance = Number(a.account.data.parsed.info.tokenAmount.uiAmount ?? 0);
|
|
71
|
+
if (balance > 0 && (0, vanity_1.isPyreMint)(mint) && !(0, util_1.isBlacklistedMint)(mint)) {
|
|
72
|
+
balanceMap.set(mint, (balanceMap.get(mint) ?? 0) + balance);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
if (balanceMap.size === 0)
|
|
76
|
+
return [];
|
|
77
|
+
// Fetch faction metadata for held mints
|
|
78
|
+
const allFactions = await this.actionProvider.getFactions({ limit: factionLimit });
|
|
79
|
+
const factionMap = new Map(allFactions.factions.map((t) => [t.mint, t]));
|
|
80
|
+
const positions = [];
|
|
81
|
+
for (const [mint, balance] of balanceMap) {
|
|
82
|
+
const faction = factionMap.get(mint);
|
|
83
|
+
if (!faction)
|
|
84
|
+
continue;
|
|
85
|
+
// balance / 1B total supply
|
|
86
|
+
const percentage = (balance / 1_000_000_000) * 100;
|
|
87
|
+
positions.push({
|
|
88
|
+
mint,
|
|
89
|
+
name: faction.name,
|
|
90
|
+
symbol: faction.symbol,
|
|
91
|
+
balance,
|
|
92
|
+
percentage,
|
|
93
|
+
value_sol: balance * faction.price_sol,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
positions.sort((a, b) => b.value_sol - a.value_sol);
|
|
97
|
+
return positions;
|
|
98
|
+
}
|
|
99
|
+
async getAgentProfile(wallet) {
|
|
100
|
+
const vault = await this.actionProvider.getStrongholdForAgent(wallet);
|
|
101
|
+
const factions = await this.getAgentFactions(wallet);
|
|
102
|
+
const totalValue = factions.reduce((sum, f) => sum + f.value_sol, 0);
|
|
103
|
+
return {
|
|
104
|
+
wallet,
|
|
105
|
+
stronghold: vault
|
|
106
|
+
? {
|
|
107
|
+
address: vault.address,
|
|
108
|
+
creator: vault.creator,
|
|
109
|
+
authority: vault.authority,
|
|
110
|
+
sol_balance: vault.sol_balance,
|
|
111
|
+
total_deposited: vault.total_deposited,
|
|
112
|
+
total_withdrawn: vault.total_withdrawn,
|
|
113
|
+
total_spent: vault.total_spent,
|
|
114
|
+
total_received: vault.total_received,
|
|
115
|
+
linked_agents: vault.linked_agents,
|
|
116
|
+
created_at: vault.created_at,
|
|
117
|
+
}
|
|
118
|
+
: null,
|
|
119
|
+
factions_joined: factions,
|
|
120
|
+
factions_founded: [], // Would need per-token creator lookup
|
|
121
|
+
total_value_sol: totalValue + (vault?.sol_balance ?? 0),
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
async getAgentSolLamports(wallet) {
|
|
125
|
+
const walletPk = new web3_js_1.PublicKey(wallet);
|
|
126
|
+
let total = 0;
|
|
127
|
+
try {
|
|
128
|
+
total += await this.connection.getBalance(walletPk);
|
|
129
|
+
}
|
|
130
|
+
catch { }
|
|
131
|
+
try {
|
|
132
|
+
const vault = await this.actionProvider.getStrongholdForAgent(wallet);
|
|
133
|
+
if (vault)
|
|
134
|
+
total += Math.round(vault.sol_balance * 1e9);
|
|
135
|
+
}
|
|
136
|
+
catch { }
|
|
137
|
+
return total;
|
|
138
|
+
}
|
|
139
|
+
async getAllies(mints, holderLimit = 50) {
|
|
140
|
+
const holdersPerFaction = await Promise.all(mints.map(async (mint) => {
|
|
141
|
+
const result = await this.getPyreHolders(mint, holderLimit);
|
|
142
|
+
return { mint, holders: new Set(result.members.map((h) => h.address)) };
|
|
143
|
+
}));
|
|
144
|
+
// Find overlapping holders between faction pairs
|
|
145
|
+
const clusters = [];
|
|
146
|
+
for (let i = 0; i < holdersPerFaction.length; i++) {
|
|
147
|
+
for (let j = i + 1; j < holdersPerFaction.length; j++) {
|
|
148
|
+
const a = holdersPerFaction[i];
|
|
149
|
+
const b = holdersPerFaction[j];
|
|
150
|
+
const shared = [...a.holders].filter((h) => b.holders.has(h));
|
|
151
|
+
if (shared.length > 0) {
|
|
152
|
+
const minSize = Math.min(a.holders.size, b.holders.size);
|
|
153
|
+
clusters.push({
|
|
154
|
+
factions: [a.mint, b.mint],
|
|
155
|
+
shared_members: shared.length,
|
|
156
|
+
overlap_percent: minSize > 0 ? (shared.length / minSize) * 100 : 0,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
clusters.sort((a, b) => b.shared_members - a.shared_members);
|
|
162
|
+
return clusters;
|
|
163
|
+
}
|
|
164
|
+
async getFactionPower(mint) {
|
|
165
|
+
const t = await this.actionProvider.getFaction(mint);
|
|
166
|
+
const score = this.computePowerScore(t);
|
|
167
|
+
return {
|
|
168
|
+
mint: t.mint,
|
|
169
|
+
name: t.name,
|
|
170
|
+
symbol: t.symbol,
|
|
171
|
+
score,
|
|
172
|
+
market_cap_sol: t.market_cap_sol,
|
|
173
|
+
members: t.members ?? 0,
|
|
174
|
+
war_chest_sol: t.war_chest_sol,
|
|
175
|
+
rallies: t.rallies,
|
|
176
|
+
progress_percent: t.progress_percent,
|
|
177
|
+
status: t.status,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
async getFactionLeaderboard({ status, limit, }) {
|
|
181
|
+
const statusMap = {
|
|
182
|
+
rising: 'bonding',
|
|
183
|
+
ready: 'complete',
|
|
184
|
+
ascended: 'migrated',
|
|
185
|
+
razed: 'reclaimed',
|
|
186
|
+
};
|
|
187
|
+
const fetchLimit = Math.min((limit ?? 20) * 3, 100);
|
|
188
|
+
const { factions } = await this.actionProvider.getFactions({
|
|
189
|
+
limit: fetchLimit,
|
|
190
|
+
status: status,
|
|
191
|
+
});
|
|
192
|
+
const powers = factions.map((t) => ({
|
|
193
|
+
mint: t.mint,
|
|
194
|
+
name: t.name,
|
|
195
|
+
symbol: t.symbol,
|
|
196
|
+
score: this.computePowerScoreFromSummary(t),
|
|
197
|
+
market_cap_sol: t.market_cap_sol,
|
|
198
|
+
members: t.members ?? 0,
|
|
199
|
+
war_chest_sol: 0, // Not available in summary
|
|
200
|
+
rallies: 0, // Not available in summary
|
|
201
|
+
progress_percent: t.progress_percent,
|
|
202
|
+
status: t.status,
|
|
203
|
+
}));
|
|
204
|
+
powers.sort((a, b) => b.score - a.score);
|
|
205
|
+
return powers;
|
|
206
|
+
}
|
|
207
|
+
async getFactionRivals(mint, { limit = 50 }) {
|
|
208
|
+
const { comms } = await this.actionProvider.getComms(mint, { limit });
|
|
209
|
+
const defectors = new Set(comms.map((m) => m.sender));
|
|
210
|
+
const rivalCounts = new Map();
|
|
211
|
+
const { factions } = await this.actionProvider.getFactions({ limit: 20, sort: 'volume' });
|
|
212
|
+
for (const faction of factions) {
|
|
213
|
+
if (faction.mint === mint)
|
|
214
|
+
continue;
|
|
215
|
+
const { members } = await this.getPyreHolders(faction.mint, 50);
|
|
216
|
+
const holderAddrs = new Set(members.map((h) => h.address));
|
|
217
|
+
const overlap = [...defectors].filter((d) => holderAddrs.has(d)).length;
|
|
218
|
+
if (overlap > 0) {
|
|
219
|
+
rivalCounts.set(faction.mint, {
|
|
220
|
+
in: overlap,
|
|
221
|
+
out: overlap,
|
|
222
|
+
...(rivalCounts.get(faction.mint) ?? {}),
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const rivals = [];
|
|
227
|
+
for (const [rivalMint, counts] of rivalCounts) {
|
|
228
|
+
const faction = factions.find((t) => t.mint === rivalMint);
|
|
229
|
+
if (faction) {
|
|
230
|
+
rivals.push({
|
|
231
|
+
mint: rivalMint,
|
|
232
|
+
name: faction.name,
|
|
233
|
+
symbol: faction.symbol,
|
|
234
|
+
defections_in: counts.in,
|
|
235
|
+
defections_out: counts.out,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
}
|
|
239
|
+
rivals.sort((a, b) => b.defections_in + b.defections_out - (a.defections_in + a.defections_out));
|
|
240
|
+
return rivals;
|
|
241
|
+
}
|
|
242
|
+
async getWorldFeed({ limit, factionLimit, }) {
|
|
243
|
+
const fLimit = factionLimit ?? 20;
|
|
244
|
+
const msgLimit = limit ?? 5;
|
|
245
|
+
const allFactions = await this.actionProvider.getFactions({ limit: fLimit, sort: 'newest' });
|
|
246
|
+
const events = [];
|
|
247
|
+
for (const faction of allFactions.factions) {
|
|
248
|
+
events.push({
|
|
249
|
+
type: 'launch',
|
|
250
|
+
faction_mint: faction.mint,
|
|
251
|
+
faction_name: faction.name,
|
|
252
|
+
timestamp: faction.created_at,
|
|
253
|
+
});
|
|
254
|
+
if (faction.status === 'ascended') {
|
|
255
|
+
events.push({
|
|
256
|
+
type: 'ascend',
|
|
257
|
+
faction_mint: faction.mint,
|
|
258
|
+
faction_name: faction.name,
|
|
259
|
+
timestamp: faction.last_activity_at,
|
|
260
|
+
});
|
|
261
|
+
}
|
|
262
|
+
else if (faction.status === 'razed') {
|
|
263
|
+
events.push({
|
|
264
|
+
type: 'raze',
|
|
265
|
+
faction_mint: faction.mint,
|
|
266
|
+
faction_name: faction.name,
|
|
267
|
+
timestamp: faction.last_activity_at,
|
|
268
|
+
});
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
const topFactions = allFactions.factions.slice(0, 10);
|
|
272
|
+
await Promise.all(topFactions.map(async (faction) => {
|
|
273
|
+
try {
|
|
274
|
+
const { comms } = await this.actionProvider.getComms(faction.mint, { limit: msgLimit });
|
|
275
|
+
for (const msg of comms) {
|
|
276
|
+
events.push({
|
|
277
|
+
type: 'join', // Messages are trade-bundled, most are buys
|
|
278
|
+
faction_mint: faction.mint,
|
|
279
|
+
faction_name: faction.name,
|
|
280
|
+
agent: msg.sender,
|
|
281
|
+
timestamp: msg.timestamp,
|
|
282
|
+
signature: msg.signature,
|
|
283
|
+
message: msg.memo,
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
catch {
|
|
288
|
+
// Skip factions with no messages
|
|
289
|
+
}
|
|
290
|
+
}));
|
|
291
|
+
events.sort((a, b) => b.timestamp - a.timestamp);
|
|
292
|
+
return events.slice(0, limit ?? 100);
|
|
293
|
+
}
|
|
294
|
+
async getWorldStats() {
|
|
295
|
+
const { factions } = await this.actionProvider.getFactions({ limit: 200, status: 'all' });
|
|
296
|
+
const pyreRising = factions.filter((t) => t.status === 'rising');
|
|
297
|
+
const pyreAscended = factions.filter((t) => t.status === 'ascended');
|
|
298
|
+
const allFactions = [...pyreRising, ...pyreAscended];
|
|
299
|
+
const totalSolLocked = allFactions.reduce((sum, t) => sum + t.market_cap_sol, 0);
|
|
300
|
+
let mostPowerful = null;
|
|
301
|
+
let maxScore = 0;
|
|
302
|
+
for (const t of allFactions) {
|
|
303
|
+
const score = this.computePowerScoreFromSummary(t);
|
|
304
|
+
if (score > maxScore) {
|
|
305
|
+
maxScore = score;
|
|
306
|
+
mostPowerful = {
|
|
307
|
+
mint: t.mint,
|
|
308
|
+
name: t.name,
|
|
309
|
+
symbol: t.symbol,
|
|
310
|
+
score,
|
|
311
|
+
market_cap_sol: t.market_cap_sol,
|
|
312
|
+
members: t.members ?? 0,
|
|
313
|
+
war_chest_sol: 0,
|
|
314
|
+
rallies: 0,
|
|
315
|
+
progress_percent: t.progress_percent,
|
|
316
|
+
status: t.status,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
return {
|
|
321
|
+
total_factions: factions.length,
|
|
322
|
+
rising_factions: pyreRising.length,
|
|
323
|
+
ascended_factions: pyreAscended.length,
|
|
324
|
+
total_sol_locked: totalSolLocked,
|
|
325
|
+
most_powerful: mostPowerful,
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
computePowerScore(t) {
|
|
329
|
+
const mcWeight = 0.4;
|
|
330
|
+
const memberWeight = 0.2;
|
|
331
|
+
const chestWeight = 0.2;
|
|
332
|
+
const rallyWeight = 0.1;
|
|
333
|
+
const progressWeight = 0.1;
|
|
334
|
+
return (t.market_cap_sol * mcWeight +
|
|
335
|
+
(t.members ?? 0) * memberWeight +
|
|
336
|
+
t.war_chest_sol * chestWeight +
|
|
337
|
+
t.rallies * rallyWeight +
|
|
338
|
+
t.progress_percent * progressWeight);
|
|
339
|
+
}
|
|
340
|
+
computePowerScoreFromSummary(t) {
|
|
341
|
+
const mcWeight = 0.4;
|
|
342
|
+
const memberWeight = 0.2;
|
|
343
|
+
const progressWeight = 0.1;
|
|
344
|
+
return (t.market_cap_sol * mcWeight +
|
|
345
|
+
(t.members ?? 0) * memberWeight +
|
|
346
|
+
t.progress_percent * progressWeight);
|
|
347
|
+
}
|
|
348
|
+
async getPyreHolders(mint, limit) {
|
|
349
|
+
const mintPk = new web3_js_1.PublicKey(mint);
|
|
350
|
+
const [bondingCurve] = (0, vanity_1.getBondingCurvePda)(mintPk);
|
|
351
|
+
const [treasury] = (0, vanity_1.getTokenTreasuryPda)(mintPk);
|
|
352
|
+
const [treasuryLock] = (0, vanity_1.getTreasuryLockPda)(mintPk);
|
|
353
|
+
const excluded = new Set([
|
|
354
|
+
bondingCurve.toString(),
|
|
355
|
+
treasury.toString(),
|
|
356
|
+
treasuryLock.toString(),
|
|
357
|
+
]);
|
|
358
|
+
const result = await this.actionProvider.getMembers(mint, limit + 5);
|
|
359
|
+
result.members = result.members.filter((h) => !excluded.has(h.address)).slice(0, limit);
|
|
360
|
+
return result;
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
exports.IntelProvider = IntelProvider;
|
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pyre Kit Mappers
|
|
3
|
+
*
|
|
4
|
+
* Internal mapping functions between Torch SDK types and Pyre game types.
|
|
5
|
+
*/
|
|
6
|
+
import type { AllLoanPositionsResult, BuyTransactionResult, CreateTokenResult, Holder, HoldersResult, LendingInfo, LoanPositionInfo, LoanPositionWithKey, MessagesResult, TokenDetail, TokenListResult, TokenMessage, TokenStatus, TokenSummary, VaultInfo, VaultWalletLinkInfo } from 'torchsdk';
|
|
7
|
+
import type { FactionStatus, FactionStatusFilter, Strategy } from '../types';
|
|
8
|
+
import { Mapper } from '../types/mapper.types';
|
|
9
|
+
export declare class MapperProvider implements Mapper {
|
|
10
|
+
allLoansResult: (r: AllLoanPositionsResult) => {
|
|
11
|
+
positions: {
|
|
12
|
+
borrower: string;
|
|
13
|
+
collateral_amount: number;
|
|
14
|
+
borrowed_amount: number;
|
|
15
|
+
accrued_interest: number;
|
|
16
|
+
total_owed: number;
|
|
17
|
+
collateral_value_sol: number | null;
|
|
18
|
+
current_ltv_bps: number | null;
|
|
19
|
+
health: "healthy" | "at_risk" | "liquidatable" | "none";
|
|
20
|
+
warnings: string[] | undefined;
|
|
21
|
+
}[];
|
|
22
|
+
pool_price_sol: number | null;
|
|
23
|
+
};
|
|
24
|
+
buyResult: (r: BuyTransactionResult) => {
|
|
25
|
+
transaction: import("@solana/web3.js").Transaction;
|
|
26
|
+
additionalTransactions: import("@solana/web3.js").Transaction[] | undefined;
|
|
27
|
+
message: string;
|
|
28
|
+
migrationTransaction: import("@solana/web3.js").Transaction | undefined;
|
|
29
|
+
};
|
|
30
|
+
createResult: (r: CreateTokenResult) => {
|
|
31
|
+
transaction: import("@solana/web3.js").Transaction;
|
|
32
|
+
additionalTransactions: import("@solana/web3.js").Transaction[] | undefined;
|
|
33
|
+
message: string;
|
|
34
|
+
mint: import("@solana/web3.js").PublicKey;
|
|
35
|
+
mintKeypair: import("@solana/web3.js").Keypair;
|
|
36
|
+
};
|
|
37
|
+
factionStatus: (status: TokenStatus) => FactionStatus;
|
|
38
|
+
holdersResult: (r: HoldersResult) => {
|
|
39
|
+
members: {
|
|
40
|
+
address: string;
|
|
41
|
+
balance: number;
|
|
42
|
+
percentage: number;
|
|
43
|
+
}[];
|
|
44
|
+
total_members: number;
|
|
45
|
+
};
|
|
46
|
+
holderToMember: (h: Holder) => {
|
|
47
|
+
address: string;
|
|
48
|
+
balance: number;
|
|
49
|
+
percentage: number;
|
|
50
|
+
};
|
|
51
|
+
lendingToWarChest: (l: LendingInfo) => {
|
|
52
|
+
interest_rate_bps: number;
|
|
53
|
+
max_ltv_bps: number;
|
|
54
|
+
liquidation_threshold_bps: number;
|
|
55
|
+
liquidation_bonus_bps: number;
|
|
56
|
+
utilization_cap_bps: number;
|
|
57
|
+
borrow_share_multiplier: number;
|
|
58
|
+
total_sol_lent: number | null;
|
|
59
|
+
active_loans: number | null;
|
|
60
|
+
war_chest_sol_available: number;
|
|
61
|
+
warnings: string[] | undefined;
|
|
62
|
+
};
|
|
63
|
+
loanToWarLoan: (l: LoanPositionInfo) => {
|
|
64
|
+
collateral_amount: number;
|
|
65
|
+
borrowed_amount: number;
|
|
66
|
+
accrued_interest: number;
|
|
67
|
+
total_owed: number;
|
|
68
|
+
collateral_value_sol: number | null;
|
|
69
|
+
current_ltv_bps: number | null;
|
|
70
|
+
health: "healthy" | "at_risk" | "liquidatable" | "none";
|
|
71
|
+
warnings: string[] | undefined;
|
|
72
|
+
};
|
|
73
|
+
loanWithKeyToWarLoan: (l: LoanPositionWithKey) => {
|
|
74
|
+
borrower: string;
|
|
75
|
+
collateral_amount: number;
|
|
76
|
+
borrowed_amount: number;
|
|
77
|
+
accrued_interest: number;
|
|
78
|
+
total_owed: number;
|
|
79
|
+
collateral_value_sol: number | null;
|
|
80
|
+
current_ltv_bps: number | null;
|
|
81
|
+
health: "healthy" | "at_risk" | "liquidatable" | "none";
|
|
82
|
+
warnings: string[] | undefined;
|
|
83
|
+
};
|
|
84
|
+
messagesResult: (r: MessagesResult) => {
|
|
85
|
+
comms: {
|
|
86
|
+
signature: string;
|
|
87
|
+
memo: string;
|
|
88
|
+
sender: string;
|
|
89
|
+
timestamp: number;
|
|
90
|
+
sender_verified: boolean | undefined;
|
|
91
|
+
sender_trust_tier: "high" | "medium" | "low" | null | undefined;
|
|
92
|
+
sender_said_name: string | undefined;
|
|
93
|
+
sender_badge_url: string | undefined;
|
|
94
|
+
}[];
|
|
95
|
+
total: number;
|
|
96
|
+
};
|
|
97
|
+
strategy: (vote: "burn" | "return") => "smelt" | "fortify";
|
|
98
|
+
tokenDetailToFaction: (t: TokenDetail) => {
|
|
99
|
+
mint: string;
|
|
100
|
+
name: string;
|
|
101
|
+
symbol: string;
|
|
102
|
+
description: string | undefined;
|
|
103
|
+
image: string | undefined;
|
|
104
|
+
status: FactionStatus;
|
|
105
|
+
price_sol: number;
|
|
106
|
+
price_usd: number | undefined;
|
|
107
|
+
market_cap_sol: number;
|
|
108
|
+
market_cap_usd: number | undefined;
|
|
109
|
+
progress_percent: number;
|
|
110
|
+
sol_raised: number;
|
|
111
|
+
sol_target: number;
|
|
112
|
+
total_supply: number;
|
|
113
|
+
circulating_supply: number;
|
|
114
|
+
tokens_in_curve: number;
|
|
115
|
+
tokens_in_vote_vault: number;
|
|
116
|
+
tokens_burned: number;
|
|
117
|
+
war_chest_sol: number;
|
|
118
|
+
war_chest_tokens: number;
|
|
119
|
+
total_bought_back: number;
|
|
120
|
+
buyback_count: number;
|
|
121
|
+
votes_scorched_earth: number;
|
|
122
|
+
votes_fortify: number;
|
|
123
|
+
founder: string;
|
|
124
|
+
members: number | null;
|
|
125
|
+
rallies: number;
|
|
126
|
+
created_at: number;
|
|
127
|
+
last_activity_at: number;
|
|
128
|
+
twitter: string | undefined;
|
|
129
|
+
telegram: string | undefined;
|
|
130
|
+
website: string | undefined;
|
|
131
|
+
founder_verified: boolean | undefined;
|
|
132
|
+
founder_trust_tier: "high" | "medium" | "low" | null | undefined;
|
|
133
|
+
founder_said_name: string | undefined;
|
|
134
|
+
founder_badge_url: string | undefined;
|
|
135
|
+
warnings: string[] | undefined;
|
|
136
|
+
};
|
|
137
|
+
tokenListResult: (r: TokenListResult) => {
|
|
138
|
+
factions: {
|
|
139
|
+
mint: string;
|
|
140
|
+
name: string;
|
|
141
|
+
symbol: string;
|
|
142
|
+
status: FactionStatus;
|
|
143
|
+
price_sol: number;
|
|
144
|
+
market_cap_sol: number;
|
|
145
|
+
progress_percent: number;
|
|
146
|
+
members: number | null;
|
|
147
|
+
created_at: number;
|
|
148
|
+
last_activity_at: number;
|
|
149
|
+
}[];
|
|
150
|
+
total: number;
|
|
151
|
+
limit: number;
|
|
152
|
+
offset: number;
|
|
153
|
+
};
|
|
154
|
+
tokenMessageToComms: (m: TokenMessage) => {
|
|
155
|
+
signature: string;
|
|
156
|
+
memo: string;
|
|
157
|
+
sender: string;
|
|
158
|
+
timestamp: number;
|
|
159
|
+
sender_verified: boolean | undefined;
|
|
160
|
+
sender_trust_tier: "high" | "medium" | "low" | null | undefined;
|
|
161
|
+
sender_said_name: string | undefined;
|
|
162
|
+
sender_badge_url: string | undefined;
|
|
163
|
+
};
|
|
164
|
+
tokenStatus: (status: FactionStatus) => TokenStatus;
|
|
165
|
+
tokenStatusFilter: (status: FactionStatusFilter) => import("torchsdk").TokenStatusFilter;
|
|
166
|
+
tokenSummaryToFaction: (t: TokenSummary) => {
|
|
167
|
+
mint: string;
|
|
168
|
+
name: string;
|
|
169
|
+
symbol: string;
|
|
170
|
+
status: FactionStatus;
|
|
171
|
+
price_sol: number;
|
|
172
|
+
market_cap_sol: number;
|
|
173
|
+
progress_percent: number;
|
|
174
|
+
members: number | null;
|
|
175
|
+
created_at: number;
|
|
176
|
+
last_activity_at: number;
|
|
177
|
+
};
|
|
178
|
+
vote: (strategy: Strategy) => "burn" | "return";
|
|
179
|
+
vaultToStronghold: (v: VaultInfo) => {
|
|
180
|
+
address: string;
|
|
181
|
+
creator: string;
|
|
182
|
+
authority: string;
|
|
183
|
+
sol_balance: number;
|
|
184
|
+
total_deposited: number;
|
|
185
|
+
total_withdrawn: number;
|
|
186
|
+
total_spent: number;
|
|
187
|
+
total_received: number;
|
|
188
|
+
linked_agents: number;
|
|
189
|
+
created_at: number;
|
|
190
|
+
};
|
|
191
|
+
walletLinkToAgentLink: (l: VaultWalletLinkInfo) => {
|
|
192
|
+
address: string;
|
|
193
|
+
stronghold: string;
|
|
194
|
+
wallet: string;
|
|
195
|
+
linked_at: number;
|
|
196
|
+
};
|
|
197
|
+
}
|