pyre-world-kit 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/dist/actions.d.ts +81 -0
- package/dist/actions.js +318 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +74 -0
- package/dist/intel.d.ts +61 -0
- package/dist/intel.js +342 -0
- package/dist/mappers.d.ts +31 -0
- package/dist/mappers.js +258 -0
- package/dist/types.d.ts +353 -0
- package/dist/types.js +9 -0
- package/dist/vanity.d.ts +14 -0
- package/dist/vanity.js +115 -0
- package/package.json +25 -0
- package/readme.md +203 -0
- package/src/actions.ts +523 -0
- package/src/index.ts +141 -0
- package/src/intel.ts +424 -0
- package/src/mappers.ts +302 -0
- package/src/types.ts +425 -0
- package/src/vanity.ts +159 -0
- package/tests/test_devnet_e2e.ts +401 -0
- package/tests/test_e2e.ts +213 -0
- package/tests/test_sim.ts +458 -0
- package/tsconfig.json +17 -0
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pyre Kit Actions
|
|
3
|
+
*
|
|
4
|
+
* Thin wrappers that call torchsdk functions and map params/results
|
|
5
|
+
* into game-semantic Pyre types. No new on-chain logic.
|
|
6
|
+
*/
|
|
7
|
+
import { Connection } from '@solana/web3.js';
|
|
8
|
+
import type { BuyQuoteResult, SellQuoteResult, TransactionResult, SaidVerification, ConfirmResult } from 'torchsdk';
|
|
9
|
+
import type { FactionListParams, FactionListResult, FactionDetail, MembersResult, CommsResult, Stronghold, AgentLink, WarChest, WarLoan, AllWarLoansResult, LaunchFactionParams, JoinFactionParams, DirectJoinFactionParams, DefectParams, RallyParams, RequestWarLoanParams, RepayWarLoanParams, SiegeParams, TradeOnDexParams, ClaimSpoilsParams, CreateStrongholdParams, FundStrongholdParams, WithdrawFromStrongholdParams, RecruitAgentParams, ExileAgentParams, CoupParams, WithdrawAssetsParams, AscendParams, RazeParams, TitheParams, ConvertTitheParams, JoinFactionResult, LaunchFactionResult } from './types';
|
|
10
|
+
/** List all factions with optional filtering and sorting */
|
|
11
|
+
export declare function getFactions(connection: Connection, params?: FactionListParams): Promise<FactionListResult>;
|
|
12
|
+
/** Get detailed info for a single faction */
|
|
13
|
+
export declare function getFaction(connection: Connection, mint: string): Promise<FactionDetail>;
|
|
14
|
+
/** Get faction members (top holders) */
|
|
15
|
+
export declare function getMembers(connection: Connection, mint: string, limit?: number): Promise<MembersResult>;
|
|
16
|
+
/** Get faction comms (trade-bundled messages) */
|
|
17
|
+
export declare function getComms(connection: Connection, mint: string, limit?: number): Promise<CommsResult>;
|
|
18
|
+
/** Get a quote for joining a faction (buying tokens) */
|
|
19
|
+
export declare function getJoinQuote(connection: Connection, mint: string, amountSolLamports: number): Promise<BuyQuoteResult>;
|
|
20
|
+
/** Get a quote for defecting from a faction (selling tokens) */
|
|
21
|
+
export declare function getDefectQuote(connection: Connection, mint: string, amountTokens: number): Promise<SellQuoteResult>;
|
|
22
|
+
/** Get stronghold (vault) by creator */
|
|
23
|
+
export declare function getStronghold(connection: Connection, creator: string): Promise<Stronghold | null>;
|
|
24
|
+
/** Get stronghold for a linked agent wallet */
|
|
25
|
+
export declare function getStrongholdForAgent(connection: Connection, wallet: string): Promise<Stronghold | null>;
|
|
26
|
+
/** Get agent link info for a wallet */
|
|
27
|
+
export declare function getAgentLink(connection: Connection, wallet: string): Promise<AgentLink | null>;
|
|
28
|
+
/** Get war chest (lending info) for a faction */
|
|
29
|
+
export declare function getWarChest(connection: Connection, mint: string): Promise<WarChest>;
|
|
30
|
+
/** Get war loan position for a specific agent on a faction */
|
|
31
|
+
export declare function getWarLoan(connection: Connection, mint: string, wallet: string): Promise<WarLoan>;
|
|
32
|
+
/** Get all war loans for a faction */
|
|
33
|
+
export declare function getAllWarLoans(connection: Connection, mint: string): Promise<AllWarLoansResult>;
|
|
34
|
+
/** Launch a new faction (create token) */
|
|
35
|
+
export declare function launchFaction(connection: Connection, params: LaunchFactionParams): Promise<LaunchFactionResult>;
|
|
36
|
+
/** Join a faction via stronghold (vault-funded buy) */
|
|
37
|
+
export declare function joinFaction(connection: Connection, params: JoinFactionParams): Promise<JoinFactionResult>;
|
|
38
|
+
/** Join a faction directly (no vault) */
|
|
39
|
+
export declare function directJoinFaction(connection: Connection, params: DirectJoinFactionParams): Promise<JoinFactionResult>;
|
|
40
|
+
/** Defect from a faction (sell tokens) */
|
|
41
|
+
export declare function defect(connection: Connection, params: DefectParams): Promise<TransactionResult>;
|
|
42
|
+
/** Rally support for a faction (star) */
|
|
43
|
+
export declare function rally(connection: Connection, params: RallyParams): Promise<TransactionResult>;
|
|
44
|
+
/** Request a war loan (borrow SOL against token collateral) */
|
|
45
|
+
export declare function requestWarLoan(connection: Connection, params: RequestWarLoanParams): Promise<TransactionResult>;
|
|
46
|
+
/** Repay a war loan */
|
|
47
|
+
export declare function repayWarLoan(connection: Connection, params: RepayWarLoanParams): Promise<TransactionResult>;
|
|
48
|
+
/** Trade on DEX via stronghold (vault-routed Raydium swap) */
|
|
49
|
+
export declare function tradeOnDex(connection: Connection, params: TradeOnDexParams): Promise<TransactionResult>;
|
|
50
|
+
/** Claim spoils (protocol rewards) */
|
|
51
|
+
export declare function claimSpoils(connection: Connection, params: ClaimSpoilsParams): Promise<TransactionResult>;
|
|
52
|
+
/** Create a new stronghold (vault) */
|
|
53
|
+
export declare function createStronghold(connection: Connection, params: CreateStrongholdParams): Promise<TransactionResult>;
|
|
54
|
+
/** Fund a stronghold with SOL */
|
|
55
|
+
export declare function fundStronghold(connection: Connection, params: FundStrongholdParams): Promise<TransactionResult>;
|
|
56
|
+
/** Withdraw SOL from a stronghold */
|
|
57
|
+
export declare function withdrawFromStronghold(connection: Connection, params: WithdrawFromStrongholdParams): Promise<TransactionResult>;
|
|
58
|
+
/** Recruit an agent (link wallet to stronghold) */
|
|
59
|
+
export declare function recruitAgent(connection: Connection, params: RecruitAgentParams): Promise<TransactionResult>;
|
|
60
|
+
/** Exile an agent (unlink wallet from stronghold) */
|
|
61
|
+
export declare function exileAgent(connection: Connection, params: ExileAgentParams): Promise<TransactionResult>;
|
|
62
|
+
/** Coup — transfer stronghold authority */
|
|
63
|
+
export declare function coup(connection: Connection, params: CoupParams): Promise<TransactionResult>;
|
|
64
|
+
/** Withdraw token assets from stronghold */
|
|
65
|
+
export declare function withdrawAssets(connection: Connection, params: WithdrawAssetsParams): Promise<TransactionResult>;
|
|
66
|
+
/** Siege — liquidate an undercollateralized war loan */
|
|
67
|
+
export declare function siege(connection: Connection, params: SiegeParams): Promise<TransactionResult>;
|
|
68
|
+
/** Ascend — migrate a completed faction to DEX */
|
|
69
|
+
export declare function ascend(connection: Connection, params: AscendParams): Promise<TransactionResult>;
|
|
70
|
+
/** Raze — reclaim a failed faction */
|
|
71
|
+
export declare function raze(connection: Connection, params: RazeParams): Promise<TransactionResult>;
|
|
72
|
+
/** Tithe — harvest transfer fees */
|
|
73
|
+
export declare function tithe(connection: Connection, params: TitheParams): Promise<TransactionResult>;
|
|
74
|
+
/** Convert tithe — swap harvested fees to SOL */
|
|
75
|
+
export declare function convertTithe(connection: Connection, params: ConvertTitheParams): Promise<TransactionResult>;
|
|
76
|
+
/** Verify an agent's SAID reputation */
|
|
77
|
+
export declare function verifyAgent(wallet: string): Promise<SaidVerification>;
|
|
78
|
+
/** Confirm a transaction on-chain */
|
|
79
|
+
export declare function confirmAction(connection: Connection, signature: string, wallet: string): Promise<ConfirmResult>;
|
|
80
|
+
/** Create an ephemeral agent keypair (memory-only, zero key management) */
|
|
81
|
+
export { createEphemeralAgent } from 'torchsdk';
|
package/dist/actions.js
ADDED
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Pyre Kit Actions
|
|
4
|
+
*
|
|
5
|
+
* Thin wrappers that call torchsdk functions and map params/results
|
|
6
|
+
* into game-semantic Pyre types. No new on-chain logic.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.createEphemeralAgent = void 0;
|
|
10
|
+
exports.getFactions = getFactions;
|
|
11
|
+
exports.getFaction = getFaction;
|
|
12
|
+
exports.getMembers = getMembers;
|
|
13
|
+
exports.getComms = getComms;
|
|
14
|
+
exports.getJoinQuote = getJoinQuote;
|
|
15
|
+
exports.getDefectQuote = getDefectQuote;
|
|
16
|
+
exports.getStronghold = getStronghold;
|
|
17
|
+
exports.getStrongholdForAgent = getStrongholdForAgent;
|
|
18
|
+
exports.getAgentLink = getAgentLink;
|
|
19
|
+
exports.getWarChest = getWarChest;
|
|
20
|
+
exports.getWarLoan = getWarLoan;
|
|
21
|
+
exports.getAllWarLoans = getAllWarLoans;
|
|
22
|
+
exports.launchFaction = launchFaction;
|
|
23
|
+
exports.joinFaction = joinFaction;
|
|
24
|
+
exports.directJoinFaction = directJoinFaction;
|
|
25
|
+
exports.defect = defect;
|
|
26
|
+
exports.rally = rally;
|
|
27
|
+
exports.requestWarLoan = requestWarLoan;
|
|
28
|
+
exports.repayWarLoan = repayWarLoan;
|
|
29
|
+
exports.tradeOnDex = tradeOnDex;
|
|
30
|
+
exports.claimSpoils = claimSpoils;
|
|
31
|
+
exports.createStronghold = createStronghold;
|
|
32
|
+
exports.fundStronghold = fundStronghold;
|
|
33
|
+
exports.withdrawFromStronghold = withdrawFromStronghold;
|
|
34
|
+
exports.recruitAgent = recruitAgent;
|
|
35
|
+
exports.exileAgent = exileAgent;
|
|
36
|
+
exports.coup = coup;
|
|
37
|
+
exports.withdrawAssets = withdrawAssets;
|
|
38
|
+
exports.siege = siege;
|
|
39
|
+
exports.ascend = ascend;
|
|
40
|
+
exports.raze = raze;
|
|
41
|
+
exports.tithe = tithe;
|
|
42
|
+
exports.convertTithe = convertTithe;
|
|
43
|
+
exports.verifyAgent = verifyAgent;
|
|
44
|
+
exports.confirmAction = confirmAction;
|
|
45
|
+
const torchsdk_1 = require("torchsdk");
|
|
46
|
+
const mappers_1 = require("./mappers");
|
|
47
|
+
const vanity_1 = require("./vanity");
|
|
48
|
+
// ─── Read Operations ───────────────────────────────────────────────
|
|
49
|
+
/** List all factions with optional filtering and sorting */
|
|
50
|
+
async function getFactions(connection, params) {
|
|
51
|
+
const sdkParams = params ? {
|
|
52
|
+
limit: params.limit,
|
|
53
|
+
offset: params.offset,
|
|
54
|
+
status: params.status ? (0, mappers_1.mapTokenStatusFilter)(params.status) : undefined,
|
|
55
|
+
sort: params.sort,
|
|
56
|
+
} : undefined;
|
|
57
|
+
const result = await (0, torchsdk_1.getTokens)(connection, sdkParams);
|
|
58
|
+
return (0, mappers_1.mapTokenListResult)(result);
|
|
59
|
+
}
|
|
60
|
+
/** Get detailed info for a single faction */
|
|
61
|
+
async function getFaction(connection, mint) {
|
|
62
|
+
const detail = await (0, torchsdk_1.getToken)(connection, mint);
|
|
63
|
+
return (0, mappers_1.mapTokenDetailToFaction)(detail);
|
|
64
|
+
}
|
|
65
|
+
/** Get faction members (top holders) */
|
|
66
|
+
async function getMembers(connection, mint, limit) {
|
|
67
|
+
const result = await (0, torchsdk_1.getHolders)(connection, mint, limit);
|
|
68
|
+
return (0, mappers_1.mapHoldersResult)(result);
|
|
69
|
+
}
|
|
70
|
+
/** Get faction comms (trade-bundled messages) */
|
|
71
|
+
async function getComms(connection, mint, limit) {
|
|
72
|
+
const result = await (0, torchsdk_1.getMessages)(connection, mint, limit);
|
|
73
|
+
return (0, mappers_1.mapMessagesResult)(result);
|
|
74
|
+
}
|
|
75
|
+
/** Get a quote for joining a faction (buying tokens) */
|
|
76
|
+
async function getJoinQuote(connection, mint, amountSolLamports) {
|
|
77
|
+
return (0, torchsdk_1.getBuyQuote)(connection, mint, amountSolLamports);
|
|
78
|
+
}
|
|
79
|
+
/** Get a quote for defecting from a faction (selling tokens) */
|
|
80
|
+
async function getDefectQuote(connection, mint, amountTokens) {
|
|
81
|
+
return (0, torchsdk_1.getSellQuote)(connection, mint, amountTokens);
|
|
82
|
+
}
|
|
83
|
+
/** Get stronghold (vault) by creator */
|
|
84
|
+
async function getStronghold(connection, creator) {
|
|
85
|
+
const vault = await (0, torchsdk_1.getVault)(connection, creator);
|
|
86
|
+
return vault ? (0, mappers_1.mapVaultToStronghold)(vault) : null;
|
|
87
|
+
}
|
|
88
|
+
/** Get stronghold for a linked agent wallet */
|
|
89
|
+
async function getStrongholdForAgent(connection, wallet) {
|
|
90
|
+
const vault = await (0, torchsdk_1.getVaultForWallet)(connection, wallet);
|
|
91
|
+
return vault ? (0, mappers_1.mapVaultToStronghold)(vault) : null;
|
|
92
|
+
}
|
|
93
|
+
/** Get agent link info for a wallet */
|
|
94
|
+
async function getAgentLink(connection, wallet) {
|
|
95
|
+
const link = await (0, torchsdk_1.getVaultWalletLink)(connection, wallet);
|
|
96
|
+
return link ? (0, mappers_1.mapWalletLinkToAgentLink)(link) : null;
|
|
97
|
+
}
|
|
98
|
+
/** Get war chest (lending info) for a faction */
|
|
99
|
+
async function getWarChest(connection, mint) {
|
|
100
|
+
const info = await (0, torchsdk_1.getLendingInfo)(connection, mint);
|
|
101
|
+
return (0, mappers_1.mapLendingToWarChest)(info);
|
|
102
|
+
}
|
|
103
|
+
/** Get war loan position for a specific agent on a faction */
|
|
104
|
+
async function getWarLoan(connection, mint, wallet) {
|
|
105
|
+
const pos = await (0, torchsdk_1.getLoanPosition)(connection, mint, wallet);
|
|
106
|
+
return (0, mappers_1.mapLoanToWarLoan)(pos);
|
|
107
|
+
}
|
|
108
|
+
/** Get all war loans for a faction */
|
|
109
|
+
async function getAllWarLoans(connection, mint) {
|
|
110
|
+
const result = await (0, torchsdk_1.getAllLoanPositions)(connection, mint);
|
|
111
|
+
return (0, mappers_1.mapAllLoansResult)(result);
|
|
112
|
+
}
|
|
113
|
+
// ─── Faction Operations (controller) ───────────────────────────────
|
|
114
|
+
/** Launch a new faction (create token) */
|
|
115
|
+
async function launchFaction(connection, params) {
|
|
116
|
+
const result = await (0, vanity_1.buildCreateFactionTransaction)(connection, {
|
|
117
|
+
creator: params.founder,
|
|
118
|
+
name: params.name,
|
|
119
|
+
symbol: params.symbol,
|
|
120
|
+
metadata_uri: params.metadata_uri,
|
|
121
|
+
sol_target: params.sol_target,
|
|
122
|
+
community_token: params.community_faction,
|
|
123
|
+
});
|
|
124
|
+
return (0, mappers_1.mapCreateResult)(result);
|
|
125
|
+
}
|
|
126
|
+
/** Join a faction via stronghold (vault-funded buy) */
|
|
127
|
+
async function joinFaction(connection, params) {
|
|
128
|
+
const result = await (0, torchsdk_1.buildBuyTransaction)(connection, {
|
|
129
|
+
mint: params.mint,
|
|
130
|
+
buyer: params.agent,
|
|
131
|
+
amount_sol: params.amount_sol,
|
|
132
|
+
slippage_bps: params.slippage_bps,
|
|
133
|
+
vote: params.strategy ? (0, mappers_1.mapVote)(params.strategy) : undefined,
|
|
134
|
+
message: params.message,
|
|
135
|
+
vault: params.stronghold,
|
|
136
|
+
});
|
|
137
|
+
return (0, mappers_1.mapBuyResult)(result);
|
|
138
|
+
}
|
|
139
|
+
/** Join a faction directly (no vault) */
|
|
140
|
+
async function directJoinFaction(connection, params) {
|
|
141
|
+
const result = await (0, torchsdk_1.buildDirectBuyTransaction)(connection, {
|
|
142
|
+
mint: params.mint,
|
|
143
|
+
buyer: params.agent,
|
|
144
|
+
amount_sol: params.amount_sol,
|
|
145
|
+
slippage_bps: params.slippage_bps,
|
|
146
|
+
vote: params.strategy ? (0, mappers_1.mapVote)(params.strategy) : undefined,
|
|
147
|
+
message: params.message,
|
|
148
|
+
});
|
|
149
|
+
return (0, mappers_1.mapBuyResult)(result);
|
|
150
|
+
}
|
|
151
|
+
/** Defect from a faction (sell tokens) */
|
|
152
|
+
async function defect(connection, params) {
|
|
153
|
+
return (0, torchsdk_1.buildSellTransaction)(connection, {
|
|
154
|
+
mint: params.mint,
|
|
155
|
+
seller: params.agent,
|
|
156
|
+
amount_tokens: params.amount_tokens,
|
|
157
|
+
slippage_bps: params.slippage_bps,
|
|
158
|
+
message: params.message,
|
|
159
|
+
vault: params.stronghold,
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
/** Rally support for a faction (star) */
|
|
163
|
+
async function rally(connection, params) {
|
|
164
|
+
return (0, torchsdk_1.buildStarTransaction)(connection, {
|
|
165
|
+
mint: params.mint,
|
|
166
|
+
user: params.agent,
|
|
167
|
+
vault: params.stronghold,
|
|
168
|
+
});
|
|
169
|
+
}
|
|
170
|
+
/** Request a war loan (borrow SOL against token collateral) */
|
|
171
|
+
async function requestWarLoan(connection, params) {
|
|
172
|
+
return (0, torchsdk_1.buildBorrowTransaction)(connection, {
|
|
173
|
+
mint: params.mint,
|
|
174
|
+
borrower: params.borrower,
|
|
175
|
+
collateral_amount: params.collateral_amount,
|
|
176
|
+
sol_to_borrow: params.sol_to_borrow,
|
|
177
|
+
vault: params.stronghold,
|
|
178
|
+
});
|
|
179
|
+
}
|
|
180
|
+
/** Repay a war loan */
|
|
181
|
+
async function repayWarLoan(connection, params) {
|
|
182
|
+
return (0, torchsdk_1.buildRepayTransaction)(connection, {
|
|
183
|
+
mint: params.mint,
|
|
184
|
+
borrower: params.borrower,
|
|
185
|
+
sol_amount: params.sol_amount,
|
|
186
|
+
vault: params.stronghold,
|
|
187
|
+
});
|
|
188
|
+
}
|
|
189
|
+
/** Trade on DEX via stronghold (vault-routed Raydium swap) */
|
|
190
|
+
async function tradeOnDex(connection, params) {
|
|
191
|
+
return (0, torchsdk_1.buildVaultSwapTransaction)(connection, {
|
|
192
|
+
mint: params.mint,
|
|
193
|
+
signer: params.signer,
|
|
194
|
+
vault_creator: params.stronghold_creator,
|
|
195
|
+
amount_in: params.amount_in,
|
|
196
|
+
minimum_amount_out: params.minimum_amount_out,
|
|
197
|
+
is_buy: params.is_buy,
|
|
198
|
+
});
|
|
199
|
+
}
|
|
200
|
+
/** Claim spoils (protocol rewards) */
|
|
201
|
+
async function claimSpoils(connection, params) {
|
|
202
|
+
return (0, torchsdk_1.buildClaimProtocolRewardsTransaction)(connection, {
|
|
203
|
+
user: params.agent,
|
|
204
|
+
vault: params.stronghold,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
207
|
+
// ─── Stronghold Operations (authority) ─────────────────────────────
|
|
208
|
+
/** Create a new stronghold (vault) */
|
|
209
|
+
async function createStronghold(connection, params) {
|
|
210
|
+
return (0, torchsdk_1.buildCreateVaultTransaction)(connection, {
|
|
211
|
+
creator: params.creator,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
/** Fund a stronghold with SOL */
|
|
215
|
+
async function fundStronghold(connection, params) {
|
|
216
|
+
return (0, torchsdk_1.buildDepositVaultTransaction)(connection, {
|
|
217
|
+
depositor: params.depositor,
|
|
218
|
+
vault_creator: params.stronghold_creator,
|
|
219
|
+
amount_sol: params.amount_sol,
|
|
220
|
+
});
|
|
221
|
+
}
|
|
222
|
+
/** Withdraw SOL from a stronghold */
|
|
223
|
+
async function withdrawFromStronghold(connection, params) {
|
|
224
|
+
return (0, torchsdk_1.buildWithdrawVaultTransaction)(connection, {
|
|
225
|
+
authority: params.authority,
|
|
226
|
+
vault_creator: params.stronghold_creator,
|
|
227
|
+
amount_sol: params.amount_sol,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
/** Recruit an agent (link wallet to stronghold) */
|
|
231
|
+
async function recruitAgent(connection, params) {
|
|
232
|
+
return (0, torchsdk_1.buildLinkWalletTransaction)(connection, {
|
|
233
|
+
authority: params.authority,
|
|
234
|
+
vault_creator: params.stronghold_creator,
|
|
235
|
+
wallet_to_link: params.wallet_to_link,
|
|
236
|
+
});
|
|
237
|
+
}
|
|
238
|
+
/** Exile an agent (unlink wallet from stronghold) */
|
|
239
|
+
async function exileAgent(connection, params) {
|
|
240
|
+
return (0, torchsdk_1.buildUnlinkWalletTransaction)(connection, {
|
|
241
|
+
authority: params.authority,
|
|
242
|
+
vault_creator: params.stronghold_creator,
|
|
243
|
+
wallet_to_unlink: params.wallet_to_unlink,
|
|
244
|
+
});
|
|
245
|
+
}
|
|
246
|
+
/** Coup — transfer stronghold authority */
|
|
247
|
+
async function coup(connection, params) {
|
|
248
|
+
return (0, torchsdk_1.buildTransferAuthorityTransaction)(connection, {
|
|
249
|
+
authority: params.authority,
|
|
250
|
+
vault_creator: params.stronghold_creator,
|
|
251
|
+
new_authority: params.new_authority,
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
/** Withdraw token assets from stronghold */
|
|
255
|
+
async function withdrawAssets(connection, params) {
|
|
256
|
+
return (0, torchsdk_1.buildWithdrawTokensTransaction)(connection, {
|
|
257
|
+
authority: params.authority,
|
|
258
|
+
vault_creator: params.stronghold_creator,
|
|
259
|
+
mint: params.mint,
|
|
260
|
+
destination: params.destination,
|
|
261
|
+
amount: params.amount,
|
|
262
|
+
});
|
|
263
|
+
}
|
|
264
|
+
// ─── Permissionless Operations ─────────────────────────────────────
|
|
265
|
+
/** Siege — liquidate an undercollateralized war loan */
|
|
266
|
+
async function siege(connection, params) {
|
|
267
|
+
return (0, torchsdk_1.buildLiquidateTransaction)(connection, {
|
|
268
|
+
mint: params.mint,
|
|
269
|
+
liquidator: params.liquidator,
|
|
270
|
+
borrower: params.borrower,
|
|
271
|
+
vault: params.stronghold,
|
|
272
|
+
});
|
|
273
|
+
}
|
|
274
|
+
/** Ascend — migrate a completed faction to DEX */
|
|
275
|
+
async function ascend(connection, params) {
|
|
276
|
+
return (0, torchsdk_1.buildMigrateTransaction)(connection, {
|
|
277
|
+
mint: params.mint,
|
|
278
|
+
payer: params.payer,
|
|
279
|
+
});
|
|
280
|
+
}
|
|
281
|
+
/** Raze — reclaim a failed faction */
|
|
282
|
+
async function raze(connection, params) {
|
|
283
|
+
return (0, torchsdk_1.buildReclaimFailedTokenTransaction)(connection, {
|
|
284
|
+
payer: params.payer,
|
|
285
|
+
mint: params.mint,
|
|
286
|
+
});
|
|
287
|
+
}
|
|
288
|
+
/** Tithe — harvest transfer fees */
|
|
289
|
+
async function tithe(connection, params) {
|
|
290
|
+
return (0, torchsdk_1.buildHarvestFeesTransaction)(connection, {
|
|
291
|
+
mint: params.mint,
|
|
292
|
+
payer: params.payer,
|
|
293
|
+
sources: params.sources,
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
/** Convert tithe — swap harvested fees to SOL */
|
|
297
|
+
async function convertTithe(connection, params) {
|
|
298
|
+
return (0, torchsdk_1.buildSwapFeesToSolTransaction)(connection, {
|
|
299
|
+
mint: params.mint,
|
|
300
|
+
payer: params.payer,
|
|
301
|
+
minimum_amount_out: params.minimum_amount_out,
|
|
302
|
+
harvest: params.harvest,
|
|
303
|
+
sources: params.sources,
|
|
304
|
+
});
|
|
305
|
+
}
|
|
306
|
+
// ─── SAID Operations ───────────────────────────────────────────────
|
|
307
|
+
/** Verify an agent's SAID reputation */
|
|
308
|
+
async function verifyAgent(wallet) {
|
|
309
|
+
return (0, torchsdk_1.verifySaid)(wallet);
|
|
310
|
+
}
|
|
311
|
+
/** Confirm a transaction on-chain */
|
|
312
|
+
async function confirmAction(connection, signature, wallet) {
|
|
313
|
+
return (0, torchsdk_1.confirmTransaction)(connection, signature, wallet);
|
|
314
|
+
}
|
|
315
|
+
// ─── Utility ───────────────────────────────────────────────────────
|
|
316
|
+
/** Create an ephemeral agent keypair (memory-only, zero key management) */
|
|
317
|
+
var torchsdk_2 = require("torchsdk");
|
|
318
|
+
Object.defineProperty(exports, "createEphemeralAgent", { enumerable: true, get: function () { return torchsdk_2.createEphemeralAgent; } });
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pyre Kit — Agent-first faction warfare on Torch Market
|
|
3
|
+
*
|
|
4
|
+
* Game-semantic wrapper over torchsdk. Torch Market IS the game engine.
|
|
5
|
+
* This kit translates protocol primitives into faction warfare language
|
|
6
|
+
* so agents think in factions, not tokens.
|
|
7
|
+
*/
|
|
8
|
+
export type { FactionStatus, FactionTier, Strategy, AgentHealth, FactionSummary, FactionDetail, Stronghold, AgentLink, Comms, WarChest, WarLoan, WarLoanWithAgent, Member, FactionListResult, MembersResult, CommsResult, AllWarLoansResult, LaunchFactionParams, JoinFactionParams, DirectJoinFactionParams, DefectParams, RallyParams, RequestWarLoanParams, RepayWarLoanParams, SiegeParams, TradeOnDexParams, ClaimSpoilsParams, CreateStrongholdParams, FundStrongholdParams, WithdrawFromStrongholdParams, RecruitAgentParams, ExileAgentParams, CoupParams, WithdrawAssetsParams, AscendParams, RazeParams, TitheParams, ConvertTitheParams, JoinFactionResult, LaunchFactionResult, TransactionResult, EphemeralAgent, SaidVerification, ConfirmResult, FactionSortOption, FactionStatusFilter, FactionListParams, FactionPower, AllianceCluster, RivalFaction, AgentProfile, AgentFactionPosition, WorldEvent, WorldStats, } from './types';
|
|
9
|
+
export { getFactions, getFaction, getMembers, getComms, getJoinQuote, getDefectQuote, getStronghold, getStrongholdForAgent, getAgentLink, getWarChest, getWarLoan, getAllWarLoans, launchFaction, joinFaction, directJoinFaction, defect, rally, requestWarLoan, repayWarLoan, tradeOnDex, claimSpoils, createStronghold, fundStronghold, withdrawFromStronghold, recruitAgent, exileAgent, coup, withdrawAssets, siege, ascend, raze, tithe, convertTithe, verifyAgent, confirmAction, createEphemeralAgent, } from './actions';
|
|
10
|
+
export { getFactionPower, getFactionLeaderboard, detectAlliances, getFactionRivals, getAgentProfile, getAgentFactions, getWorldFeed, getWorldStats, } from './intel';
|
|
11
|
+
export { isPyreMint, grindPyreMint } from './vanity';
|
|
12
|
+
export { PROGRAM_ID, LAMPORTS_PER_SOL, TOKEN_MULTIPLIER, TOTAL_SUPPLY } from 'torchsdk';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Pyre Kit — Agent-first faction warfare on Torch Market
|
|
4
|
+
*
|
|
5
|
+
* Game-semantic wrapper over torchsdk. Torch Market IS the game engine.
|
|
6
|
+
* This kit translates protocol primitives into faction warfare language
|
|
7
|
+
* so agents think in factions, not tokens.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.TOTAL_SUPPLY = exports.TOKEN_MULTIPLIER = exports.LAMPORTS_PER_SOL = exports.PROGRAM_ID = exports.grindPyreMint = exports.isPyreMint = exports.getWorldStats = exports.getWorldFeed = exports.getAgentFactions = exports.getAgentProfile = exports.getFactionRivals = exports.detectAlliances = exports.getFactionLeaderboard = exports.getFactionPower = exports.createEphemeralAgent = exports.confirmAction = exports.verifyAgent = exports.convertTithe = exports.tithe = exports.raze = exports.ascend = exports.siege = exports.withdrawAssets = exports.coup = exports.exileAgent = exports.recruitAgent = exports.withdrawFromStronghold = exports.fundStronghold = exports.createStronghold = exports.claimSpoils = exports.tradeOnDex = exports.repayWarLoan = exports.requestWarLoan = exports.rally = exports.defect = exports.directJoinFaction = exports.joinFaction = exports.launchFaction = exports.getAllWarLoans = exports.getWarLoan = exports.getWarChest = exports.getAgentLink = exports.getStrongholdForAgent = exports.getStronghold = exports.getDefectQuote = exports.getJoinQuote = exports.getComms = exports.getMembers = exports.getFaction = exports.getFactions = void 0;
|
|
11
|
+
// ─── Actions ───────────────────────────────────────────────────────
|
|
12
|
+
var actions_1 = require("./actions");
|
|
13
|
+
// Read operations
|
|
14
|
+
Object.defineProperty(exports, "getFactions", { enumerable: true, get: function () { return actions_1.getFactions; } });
|
|
15
|
+
Object.defineProperty(exports, "getFaction", { enumerable: true, get: function () { return actions_1.getFaction; } });
|
|
16
|
+
Object.defineProperty(exports, "getMembers", { enumerable: true, get: function () { return actions_1.getMembers; } });
|
|
17
|
+
Object.defineProperty(exports, "getComms", { enumerable: true, get: function () { return actions_1.getComms; } });
|
|
18
|
+
Object.defineProperty(exports, "getJoinQuote", { enumerable: true, get: function () { return actions_1.getJoinQuote; } });
|
|
19
|
+
Object.defineProperty(exports, "getDefectQuote", { enumerable: true, get: function () { return actions_1.getDefectQuote; } });
|
|
20
|
+
Object.defineProperty(exports, "getStronghold", { enumerable: true, get: function () { return actions_1.getStronghold; } });
|
|
21
|
+
Object.defineProperty(exports, "getStrongholdForAgent", { enumerable: true, get: function () { return actions_1.getStrongholdForAgent; } });
|
|
22
|
+
Object.defineProperty(exports, "getAgentLink", { enumerable: true, get: function () { return actions_1.getAgentLink; } });
|
|
23
|
+
Object.defineProperty(exports, "getWarChest", { enumerable: true, get: function () { return actions_1.getWarChest; } });
|
|
24
|
+
Object.defineProperty(exports, "getWarLoan", { enumerable: true, get: function () { return actions_1.getWarLoan; } });
|
|
25
|
+
Object.defineProperty(exports, "getAllWarLoans", { enumerable: true, get: function () { return actions_1.getAllWarLoans; } });
|
|
26
|
+
// Faction operations
|
|
27
|
+
Object.defineProperty(exports, "launchFaction", { enumerable: true, get: function () { return actions_1.launchFaction; } });
|
|
28
|
+
Object.defineProperty(exports, "joinFaction", { enumerable: true, get: function () { return actions_1.joinFaction; } });
|
|
29
|
+
Object.defineProperty(exports, "directJoinFaction", { enumerable: true, get: function () { return actions_1.directJoinFaction; } });
|
|
30
|
+
Object.defineProperty(exports, "defect", { enumerable: true, get: function () { return actions_1.defect; } });
|
|
31
|
+
Object.defineProperty(exports, "rally", { enumerable: true, get: function () { return actions_1.rally; } });
|
|
32
|
+
Object.defineProperty(exports, "requestWarLoan", { enumerable: true, get: function () { return actions_1.requestWarLoan; } });
|
|
33
|
+
Object.defineProperty(exports, "repayWarLoan", { enumerable: true, get: function () { return actions_1.repayWarLoan; } });
|
|
34
|
+
Object.defineProperty(exports, "tradeOnDex", { enumerable: true, get: function () { return actions_1.tradeOnDex; } });
|
|
35
|
+
Object.defineProperty(exports, "claimSpoils", { enumerable: true, get: function () { return actions_1.claimSpoils; } });
|
|
36
|
+
// Stronghold operations
|
|
37
|
+
Object.defineProperty(exports, "createStronghold", { enumerable: true, get: function () { return actions_1.createStronghold; } });
|
|
38
|
+
Object.defineProperty(exports, "fundStronghold", { enumerable: true, get: function () { return actions_1.fundStronghold; } });
|
|
39
|
+
Object.defineProperty(exports, "withdrawFromStronghold", { enumerable: true, get: function () { return actions_1.withdrawFromStronghold; } });
|
|
40
|
+
Object.defineProperty(exports, "recruitAgent", { enumerable: true, get: function () { return actions_1.recruitAgent; } });
|
|
41
|
+
Object.defineProperty(exports, "exileAgent", { enumerable: true, get: function () { return actions_1.exileAgent; } });
|
|
42
|
+
Object.defineProperty(exports, "coup", { enumerable: true, get: function () { return actions_1.coup; } });
|
|
43
|
+
Object.defineProperty(exports, "withdrawAssets", { enumerable: true, get: function () { return actions_1.withdrawAssets; } });
|
|
44
|
+
// Permissionless operations
|
|
45
|
+
Object.defineProperty(exports, "siege", { enumerable: true, get: function () { return actions_1.siege; } });
|
|
46
|
+
Object.defineProperty(exports, "ascend", { enumerable: true, get: function () { return actions_1.ascend; } });
|
|
47
|
+
Object.defineProperty(exports, "raze", { enumerable: true, get: function () { return actions_1.raze; } });
|
|
48
|
+
Object.defineProperty(exports, "tithe", { enumerable: true, get: function () { return actions_1.tithe; } });
|
|
49
|
+
Object.defineProperty(exports, "convertTithe", { enumerable: true, get: function () { return actions_1.convertTithe; } });
|
|
50
|
+
// SAID operations
|
|
51
|
+
Object.defineProperty(exports, "verifyAgent", { enumerable: true, get: function () { return actions_1.verifyAgent; } });
|
|
52
|
+
Object.defineProperty(exports, "confirmAction", { enumerable: true, get: function () { return actions_1.confirmAction; } });
|
|
53
|
+
// Utility
|
|
54
|
+
Object.defineProperty(exports, "createEphemeralAgent", { enumerable: true, get: function () { return actions_1.createEphemeralAgent; } });
|
|
55
|
+
// ─── Intel ─────────────────────────────────────────────────────────
|
|
56
|
+
var intel_1 = require("./intel");
|
|
57
|
+
Object.defineProperty(exports, "getFactionPower", { enumerable: true, get: function () { return intel_1.getFactionPower; } });
|
|
58
|
+
Object.defineProperty(exports, "getFactionLeaderboard", { enumerable: true, get: function () { return intel_1.getFactionLeaderboard; } });
|
|
59
|
+
Object.defineProperty(exports, "detectAlliances", { enumerable: true, get: function () { return intel_1.detectAlliances; } });
|
|
60
|
+
Object.defineProperty(exports, "getFactionRivals", { enumerable: true, get: function () { return intel_1.getFactionRivals; } });
|
|
61
|
+
Object.defineProperty(exports, "getAgentProfile", { enumerable: true, get: function () { return intel_1.getAgentProfile; } });
|
|
62
|
+
Object.defineProperty(exports, "getAgentFactions", { enumerable: true, get: function () { return intel_1.getAgentFactions; } });
|
|
63
|
+
Object.defineProperty(exports, "getWorldFeed", { enumerable: true, get: function () { return intel_1.getWorldFeed; } });
|
|
64
|
+
Object.defineProperty(exports, "getWorldStats", { enumerable: true, get: function () { return intel_1.getWorldStats; } });
|
|
65
|
+
// ─── Vanity ─────────────────────────────────────────────────────────
|
|
66
|
+
var vanity_1 = require("./vanity");
|
|
67
|
+
Object.defineProperty(exports, "isPyreMint", { enumerable: true, get: function () { return vanity_1.isPyreMint; } });
|
|
68
|
+
Object.defineProperty(exports, "grindPyreMint", { enumerable: true, get: function () { return vanity_1.grindPyreMint; } });
|
|
69
|
+
// ─── Re-export torchsdk constants for convenience ──────────────────
|
|
70
|
+
var torchsdk_1 = require("torchsdk");
|
|
71
|
+
Object.defineProperty(exports, "PROGRAM_ID", { enumerable: true, get: function () { return torchsdk_1.PROGRAM_ID; } });
|
|
72
|
+
Object.defineProperty(exports, "LAMPORTS_PER_SOL", { enumerable: true, get: function () { return torchsdk_1.LAMPORTS_PER_SOL; } });
|
|
73
|
+
Object.defineProperty(exports, "TOKEN_MULTIPLIER", { enumerable: true, get: function () { return torchsdk_1.TOKEN_MULTIPLIER; } });
|
|
74
|
+
Object.defineProperty(exports, "TOTAL_SUPPLY", { enumerable: true, get: function () { return torchsdk_1.TOTAL_SUPPLY; } });
|
package/dist/intel.d.ts
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Pyre Kit Intel
|
|
3
|
+
*
|
|
4
|
+
* Game-specific utility functions that compose torchsdk reads into
|
|
5
|
+
* strategic intelligence. Agents use these to reason about the world.
|
|
6
|
+
*/
|
|
7
|
+
import { Connection } from '@solana/web3.js';
|
|
8
|
+
import type { FactionPower, AllianceCluster, RivalFaction, AgentProfile, AgentFactionPosition, WorldEvent, WorldStats, FactionStatus } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Calculate a faction's power score.
|
|
11
|
+
*
|
|
12
|
+
* Score = (market_cap_sol * 0.4) + (members * 0.2) + (war_chest_sol * 0.2)
|
|
13
|
+
* + (rallies * 0.1) + (progress * 0.1)
|
|
14
|
+
*
|
|
15
|
+
* Normalized to make comparison easy. Higher = stronger.
|
|
16
|
+
*/
|
|
17
|
+
export declare function getFactionPower(connection: Connection, mint: string): Promise<FactionPower>;
|
|
18
|
+
/**
|
|
19
|
+
* Ranked leaderboard of all factions by power score.
|
|
20
|
+
*/
|
|
21
|
+
export declare function getFactionLeaderboard(connection: Connection, opts?: {
|
|
22
|
+
status?: FactionStatus;
|
|
23
|
+
limit?: number;
|
|
24
|
+
}): Promise<FactionPower[]>;
|
|
25
|
+
/**
|
|
26
|
+
* Detect alliances: factions with shared members.
|
|
27
|
+
*
|
|
28
|
+
* Given a set of faction mints, finds wallets holding multiple faction tokens.
|
|
29
|
+
* Returns alliance clusters showing which factions share members.
|
|
30
|
+
*/
|
|
31
|
+
export declare function detectAlliances(connection: Connection, mints: string[], holderLimit?: number): Promise<AllianceCluster[]>;
|
|
32
|
+
/**
|
|
33
|
+
* Find rival factions based on recent defection activity.
|
|
34
|
+
*
|
|
35
|
+
* Looks at recent sell messages to detect agents who have defected
|
|
36
|
+
* from or to this faction.
|
|
37
|
+
*/
|
|
38
|
+
export declare function getFactionRivals(connection: Connection, mint: string, limit?: number): Promise<RivalFaction[]>;
|
|
39
|
+
/**
|
|
40
|
+
* Build an aggregate profile for an agent wallet.
|
|
41
|
+
*/
|
|
42
|
+
export declare function getAgentProfile(connection: Connection, wallet: string): Promise<AgentProfile>;
|
|
43
|
+
/**
|
|
44
|
+
* List all factions an agent holds tokens in.
|
|
45
|
+
*
|
|
46
|
+
* Checks top factions for this wallet's holdings.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getAgentFactions(connection: Connection, wallet: string, factionLimit?: number): Promise<AgentFactionPosition[]>;
|
|
49
|
+
/**
|
|
50
|
+
* Aggregated recent activity across ALL factions.
|
|
51
|
+
*
|
|
52
|
+
* The "Bloomberg terminal" feed — launches, joins, defections, rallies.
|
|
53
|
+
*/
|
|
54
|
+
export declare function getWorldFeed(connection: Connection, opts?: {
|
|
55
|
+
limit?: number;
|
|
56
|
+
factionLimit?: number;
|
|
57
|
+
}): Promise<WorldEvent[]>;
|
|
58
|
+
/**
|
|
59
|
+
* Global stats: total factions, total agents, total SOL locked.
|
|
60
|
+
*/
|
|
61
|
+
export declare function getWorldStats(connection: Connection): Promise<WorldStats>;
|