pyre-world-kit 3.2.4 → 3.3.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/providers/action.provider.js +0 -56
- package/dist/providers/mapper.provider.d.ts +5 -5
- package/dist/providers/registry.provider.js +16 -12
- package/dist/types.d.ts +2 -2
- package/dist/util.js +5 -5
- package/dist/vanity.js +9 -5
- package/package.json +2 -2
- package/readme.md +4 -2
- package/src/providers/action.provider.ts +0 -57
- package/src/providers/registry.provider.ts +18 -14
- package/src/types.ts +2 -2
- package/src/util.ts +1 -1
- package/src/vanity.ts +12 -6
|
@@ -170,20 +170,6 @@ class ActionProvider {
|
|
|
170
170
|
});
|
|
171
171
|
}
|
|
172
172
|
async defect(params) {
|
|
173
|
-
if (params.ascended) {
|
|
174
|
-
const slippage = params.slippage_bps ?? 500;
|
|
175
|
-
const quote = await (0, torchsdk_1.getSellQuote)(this.connection, params.mint, params.amount_tokens);
|
|
176
|
-
const minOut = Math.max(1, Math.floor(quote.output_sol * (1 - slippage / 10_000)));
|
|
177
|
-
return (0, torchsdk_1.buildVaultSwapTransaction)(this.connection, {
|
|
178
|
-
mint: params.mint,
|
|
179
|
-
signer: params.agent,
|
|
180
|
-
vault_creator: params.stronghold,
|
|
181
|
-
amount_in: params.amount_tokens,
|
|
182
|
-
minimum_amount_out: minOut,
|
|
183
|
-
is_buy: false,
|
|
184
|
-
message: params.message,
|
|
185
|
-
});
|
|
186
|
-
}
|
|
187
173
|
return (0, torchsdk_1.buildSellTransaction)(this.connection, {
|
|
188
174
|
mint: params.mint,
|
|
189
175
|
seller: params.agent,
|
|
@@ -195,19 +181,6 @@ class ActionProvider {
|
|
|
195
181
|
}
|
|
196
182
|
async fud(params) {
|
|
197
183
|
const MICRO_SELL_TOKENS = 10 * 1_000_000; // 10 tokens in raw units (6 decimals)
|
|
198
|
-
if (params.ascended) {
|
|
199
|
-
const quote = await (0, torchsdk_1.getSellQuote)(this.connection, params.mint, MICRO_SELL_TOKENS);
|
|
200
|
-
const minOut = Math.max(1, Math.floor(quote.output_sol * (1 - 500 / 10_000)));
|
|
201
|
-
return (0, torchsdk_1.buildVaultSwapTransaction)(this.connection, {
|
|
202
|
-
mint: params.mint,
|
|
203
|
-
signer: params.agent,
|
|
204
|
-
vault_creator: params.stronghold,
|
|
205
|
-
amount_in: MICRO_SELL_TOKENS,
|
|
206
|
-
minimum_amount_out: minOut,
|
|
207
|
-
is_buy: false,
|
|
208
|
-
message: params.message,
|
|
209
|
-
});
|
|
210
|
-
}
|
|
211
184
|
return (0, torchsdk_1.buildSellTransaction)(this.connection, {
|
|
212
185
|
mint: params.mint,
|
|
213
186
|
seller: params.agent,
|
|
@@ -217,21 +190,6 @@ class ActionProvider {
|
|
|
217
190
|
});
|
|
218
191
|
}
|
|
219
192
|
async join(params) {
|
|
220
|
-
if (params.ascended) {
|
|
221
|
-
const slippage = params.slippage_bps ?? 500;
|
|
222
|
-
const quote = await (0, torchsdk_1.getBuyQuote)(this.connection, params.mint, params.amount_sol);
|
|
223
|
-
const minOut = Math.max(1, Math.floor(quote.tokens_to_user * (1 - slippage / 10_000)));
|
|
224
|
-
const result = await (0, torchsdk_1.buildVaultSwapTransaction)(this.connection, {
|
|
225
|
-
mint: params.mint,
|
|
226
|
-
signer: params.agent,
|
|
227
|
-
vault_creator: params.stronghold,
|
|
228
|
-
amount_in: params.amount_sol,
|
|
229
|
-
minimum_amount_out: minOut,
|
|
230
|
-
is_buy: true,
|
|
231
|
-
message: params.message,
|
|
232
|
-
});
|
|
233
|
-
return this.mapper.buyResult(result);
|
|
234
|
-
}
|
|
235
193
|
const result = await (0, torchsdk_1.buildBuyTransaction)(this.connection, {
|
|
236
194
|
mint: params.mint,
|
|
237
195
|
buyer: params.agent,
|
|
@@ -256,20 +214,6 @@ class ActionProvider {
|
|
|
256
214
|
}
|
|
257
215
|
async message(params) {
|
|
258
216
|
const MICRO_BUY_LAMPORTS = 1_000_000; // 0.001 SOL
|
|
259
|
-
if (params.ascended) {
|
|
260
|
-
const quote = await (0, torchsdk_1.getBuyQuote)(this.connection, params.mint, MICRO_BUY_LAMPORTS);
|
|
261
|
-
const minOut = Math.max(1, Math.floor(quote.tokens_to_user * (1 - 500 / 10_000)));
|
|
262
|
-
const result = await (0, torchsdk_1.buildVaultSwapTransaction)(this.connection, {
|
|
263
|
-
mint: params.mint,
|
|
264
|
-
signer: params.agent,
|
|
265
|
-
vault_creator: params.stronghold,
|
|
266
|
-
amount_in: MICRO_BUY_LAMPORTS,
|
|
267
|
-
minimum_amount_out: minOut,
|
|
268
|
-
is_buy: true,
|
|
269
|
-
message: params.message,
|
|
270
|
-
});
|
|
271
|
-
return this.mapper.buyResult(result);
|
|
272
|
-
}
|
|
273
217
|
const result = await (0, torchsdk_1.buildBuyTransaction)(this.connection, {
|
|
274
218
|
mint: params.mint,
|
|
275
219
|
buyer: params.agent,
|
|
@@ -17,14 +17,14 @@ export declare class MapperProvider implements Mapper {
|
|
|
17
17
|
pool_price_sol: number | null;
|
|
18
18
|
};
|
|
19
19
|
buyResult: (r: BuyTransactionResult) => {
|
|
20
|
-
transaction: import("@solana/web3.js").
|
|
21
|
-
additionalTransactions: import("@solana/web3.js").
|
|
20
|
+
transaction: import("@solana/web3.js").VersionedTransaction;
|
|
21
|
+
additionalTransactions: import("@solana/web3.js").VersionedTransaction[] | undefined;
|
|
22
22
|
message: string;
|
|
23
|
-
migrationTransaction: import("@solana/web3.js").
|
|
23
|
+
migrationTransaction: import("@solana/web3.js").VersionedTransaction | undefined;
|
|
24
24
|
};
|
|
25
25
|
createResult: (r: CreateTokenResult) => {
|
|
26
|
-
transaction: import("@solana/web3.js").
|
|
27
|
-
additionalTransactions: import("@solana/web3.js").
|
|
26
|
+
transaction: import("@solana/web3.js").VersionedTransaction;
|
|
27
|
+
additionalTransactions: import("@solana/web3.js").VersionedTransaction[] | undefined;
|
|
28
28
|
message: string;
|
|
29
29
|
mint: import("@solana/web3.js").PublicKey;
|
|
30
30
|
mintKeypair: import("@solana/web3.js").Keypair;
|
|
@@ -21,8 +21,12 @@ const makeDummyProvider = (connection, payer) => new anchor_1.AnchorProvider(con
|
|
|
21
21
|
}, {});
|
|
22
22
|
async function finalizeTransaction(connection, tx, feePayer) {
|
|
23
23
|
const { blockhash } = await connection.getLatestBlockhash();
|
|
24
|
-
|
|
25
|
-
|
|
24
|
+
const message = new web3_js_1.TransactionMessage({
|
|
25
|
+
payerKey: feePayer,
|
|
26
|
+
recentBlockhash: blockhash,
|
|
27
|
+
instructions: tx.instructions,
|
|
28
|
+
}).compileToV0Message();
|
|
29
|
+
return new web3_js_1.VersionedTransaction(message);
|
|
26
30
|
}
|
|
27
31
|
class RegistryProvider {
|
|
28
32
|
connection;
|
|
@@ -105,9 +109,9 @@ class RegistryProvider {
|
|
|
105
109
|
.accounts({ creator, profile, walletLink, systemProgram: web3_js_1.SystemProgram.programId })
|
|
106
110
|
.instruction();
|
|
107
111
|
tx.add(ix);
|
|
108
|
-
await finalizeTransaction(this.connection, tx, creator);
|
|
112
|
+
const versionedTx = await finalizeTransaction(this.connection, tx, creator);
|
|
109
113
|
return {
|
|
110
|
-
transaction:
|
|
114
|
+
transaction: versionedTx,
|
|
111
115
|
message: `Register agent profile [${profile.toBase58()}]`,
|
|
112
116
|
};
|
|
113
117
|
}
|
|
@@ -140,9 +144,9 @@ class RegistryProvider {
|
|
|
140
144
|
.accounts({ signer, profile, systemProgram: web3_js_1.SystemProgram.programId })
|
|
141
145
|
.instruction();
|
|
142
146
|
tx.add(ix);
|
|
143
|
-
await finalizeTransaction(this.connection, tx, signer);
|
|
147
|
+
const versionedTx = await finalizeTransaction(this.connection, tx, signer);
|
|
144
148
|
return {
|
|
145
|
-
transaction:
|
|
149
|
+
transaction: versionedTx,
|
|
146
150
|
message: `Checkpoint agent [${profile.toBase58()}]`,
|
|
147
151
|
};
|
|
148
152
|
}
|
|
@@ -164,9 +168,9 @@ class RegistryProvider {
|
|
|
164
168
|
})
|
|
165
169
|
.instruction();
|
|
166
170
|
tx.add(ix);
|
|
167
|
-
await finalizeTransaction(this.connection, tx, authority);
|
|
171
|
+
const versionedTx = await finalizeTransaction(this.connection, tx, authority);
|
|
168
172
|
return {
|
|
169
|
-
transaction:
|
|
173
|
+
transaction: versionedTx,
|
|
170
174
|
message: `Link wallet ${walletToLink.toBase58()} to agent [${profile.toBase58()}]`,
|
|
171
175
|
};
|
|
172
176
|
}
|
|
@@ -188,9 +192,9 @@ class RegistryProvider {
|
|
|
188
192
|
})
|
|
189
193
|
.instruction();
|
|
190
194
|
tx.add(ix);
|
|
191
|
-
await finalizeTransaction(this.connection, tx, authority);
|
|
195
|
+
const versionedTx = await finalizeTransaction(this.connection, tx, authority);
|
|
192
196
|
return {
|
|
193
|
-
transaction:
|
|
197
|
+
transaction: versionedTx,
|
|
194
198
|
message: `Unlink wallet ${walletToUnlink.toBase58()} from agent [${profile.toBase58()}]`,
|
|
195
199
|
};
|
|
196
200
|
}
|
|
@@ -205,9 +209,9 @@ class RegistryProvider {
|
|
|
205
209
|
.accounts({ authority, profile, newAuthority })
|
|
206
210
|
.instruction();
|
|
207
211
|
tx.add(ix);
|
|
208
|
-
await finalizeTransaction(this.connection, tx, authority);
|
|
212
|
+
const versionedTx = await finalizeTransaction(this.connection, tx, authority);
|
|
209
213
|
return {
|
|
210
|
-
transaction:
|
|
214
|
+
transaction: versionedTx,
|
|
211
215
|
message: `Transfer agent authority to ${newAuthority.toBase58()}`,
|
|
212
216
|
};
|
|
213
217
|
}
|
package/dist/types.d.ts
CHANGED
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* Torch Market IS the game engine — these types translate
|
|
6
6
|
* protocol primitives into faction warfare language.
|
|
7
7
|
*/
|
|
8
|
-
import type {
|
|
8
|
+
import type { VersionedTransaction, Keypair, PublicKey } from '@solana/web3.js';
|
|
9
9
|
import type { TokenSortOption, TransactionResult, CreateTokenResult, SaidVerification, ConfirmResult, EphemeralAgent } from 'torchsdk';
|
|
10
10
|
/** Faction lifecycle: rising (bonding) → ready (complete) → ascended (migrated) → razed (reclaimed) */
|
|
11
11
|
export type FactionStatus = 'rising' | 'ready' | 'ascended' | 'razed';
|
|
@@ -284,7 +284,7 @@ export interface TitheParams {
|
|
|
284
284
|
/** Re-export base result types with game names */
|
|
285
285
|
export type { TransactionResult, CreateTokenResult, EphemeralAgent, SaidVerification, ConfirmResult, };
|
|
286
286
|
export interface JoinFactionResult extends TransactionResult {
|
|
287
|
-
migrationTransaction?:
|
|
287
|
+
migrationTransaction?: VersionedTransaction;
|
|
288
288
|
}
|
|
289
289
|
export interface LaunchFactionResult extends TransactionResult {
|
|
290
290
|
mint: PublicKey;
|
package/dist/util.js
CHANGED
|
@@ -13,7 +13,7 @@ exports.getBlacklistedMints = getBlacklistedMints;
|
|
|
13
13
|
exports.getDexPool = getDexPool;
|
|
14
14
|
exports.getDexVaults = getDexVaults;
|
|
15
15
|
const web3_js_1 = require("@solana/web3.js");
|
|
16
|
-
const
|
|
16
|
+
const program_1 = require("torchsdk/dist/program");
|
|
17
17
|
// ─── Blacklist ──────────────────────────────────────────────────────
|
|
18
18
|
// Mints from previous swarm runs. Agents should skip these and only
|
|
19
19
|
// interact with freshly launched factions.
|
|
@@ -131,16 +131,16 @@ function getBlacklistedMints() {
|
|
|
131
131
|
return Array.from(BLACKLISTED_MINTS);
|
|
132
132
|
}
|
|
133
133
|
/** Create an ephemeral agent keypair (memory-only, zero key management) */
|
|
134
|
-
var
|
|
135
|
-
Object.defineProperty(exports, "createEphemeralAgent", { enumerable: true, get: function () { return
|
|
134
|
+
var torchsdk_1 = require("torchsdk");
|
|
135
|
+
Object.defineProperty(exports, "createEphemeralAgent", { enumerable: true, get: function () { return torchsdk_1.createEphemeralAgent; } });
|
|
136
136
|
/** Get the Raydium pool state PDA for an ascended faction's DEX pool */
|
|
137
137
|
function getDexPool(mint) {
|
|
138
|
-
const { poolState } = (0,
|
|
138
|
+
const { poolState } = (0, program_1.getRaydiumMigrationAccounts)(new web3_js_1.PublicKey(mint));
|
|
139
139
|
return poolState;
|
|
140
140
|
}
|
|
141
141
|
/** Get Raydium pool vault addresses for an ascended faction */
|
|
142
142
|
function getDexVaults(mint) {
|
|
143
|
-
const accts = (0,
|
|
143
|
+
const accts = (0, program_1.getRaydiumMigrationAccounts)(new web3_js_1.PublicKey(mint));
|
|
144
144
|
return {
|
|
145
145
|
solVault: (accts.isWsolToken0 ? accts.token0Vault : accts.token1Vault).toString(),
|
|
146
146
|
tokenVault: (accts.isWsolToken0 ? accts.token1Vault : accts.token0Vault).toString(),
|
package/dist/vanity.js
CHANGED
|
@@ -41,8 +41,12 @@ const makeDummyProvider = (connection, payer) => new anchor_1.AnchorProvider(con
|
|
|
41
41
|
}, {});
|
|
42
42
|
const finalizeTransaction = async (connection, tx, feePayer) => {
|
|
43
43
|
const { blockhash } = await connection.getLatestBlockhash();
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const message = new web3_js_1.TransactionMessage({
|
|
45
|
+
payerKey: feePayer,
|
|
46
|
+
recentBlockhash: blockhash,
|
|
47
|
+
instructions: tx.instructions,
|
|
48
|
+
}).compileToV0Message();
|
|
49
|
+
return new web3_js_1.VersionedTransaction(message);
|
|
46
50
|
};
|
|
47
51
|
// ── Vanity grinder ──
|
|
48
52
|
const PYRE_SUFFIX = 'pw';
|
|
@@ -106,11 +110,11 @@ const buildCreateFactionTransaction = async (connection, params) => {
|
|
|
106
110
|
})
|
|
107
111
|
.instruction();
|
|
108
112
|
tx.add(createIx);
|
|
109
|
-
await finalizeTransaction(connection, tx, creator);
|
|
113
|
+
const versionedTx = await finalizeTransaction(connection, tx, creator);
|
|
110
114
|
// Partially sign with mint keypair
|
|
111
|
-
|
|
115
|
+
versionedTx.sign([mint]);
|
|
112
116
|
return {
|
|
113
|
-
transaction:
|
|
117
|
+
transaction: versionedTx,
|
|
114
118
|
mint: mint.publicKey,
|
|
115
119
|
mintKeypair: mint,
|
|
116
120
|
message: `Create faction "${name}" ($${symbol}) [pyre:${mint.publicKey.toBase58()}]`,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pyre-world-kit",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.0",
|
|
4
4
|
"description": "Agent-first faction warfare kit — game-semantic wrapper over torchsdk",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -16,7 +16,7 @@
|
|
|
16
16
|
"@solana/spl-token": "^0.4.6",
|
|
17
17
|
"@solana/web3.js": "^1.98.4",
|
|
18
18
|
"bs58": "^6.0.0",
|
|
19
|
-
"torchsdk": "^4.0
|
|
19
|
+
"torchsdk": "^4.1.0"
|
|
20
20
|
},
|
|
21
21
|
"devDependencies": {
|
|
22
22
|
"@types/node": "^22.15.0",
|
package/readme.md
CHANGED
|
@@ -4,6 +4,8 @@ Agent-first faction warfare kit for [Torch Market](https://torch.market). Game-s
|
|
|
4
4
|
|
|
5
5
|
The game IS the economy. There is no separate game engine — Torch Market is the engine. Faction founding, alliance, betrayal, trade, governance — all of it already exists as on-chain Solana primitives.
|
|
6
6
|
|
|
7
|
+
**v3.3.0** — Powered by `torchsdk@4.1.0`. VersionedTransaction-native with Address Lookup Table compression. Price quoting and slippage protection are built into every action — `join`, `defect`, `message`, `fud` all work on rising or ascended factions with zero branching. The SDK auto-routes bonding curve vs Raydium DEX internally. Smaller transactions, fewer failures, faster games.
|
|
8
|
+
|
|
7
9
|
## Install
|
|
8
10
|
|
|
9
11
|
```bash
|
|
@@ -169,7 +171,7 @@ kit.registry // RegistryProvider — on-chain identity
|
|
|
169
171
|
|
|
170
172
|
### ActionProvider
|
|
171
173
|
|
|
172
|
-
All operations are vault-routed. `join` and `
|
|
174
|
+
All operations are vault-routed. `join`, `defect`, `message`, and `fud` work on any faction regardless of status — the underlying SDK auto-routes between bonding curve and Raydium DEX with built-in price quoting and slippage protection. No `ascended` flag needed.
|
|
173
175
|
|
|
174
176
|
```typescript
|
|
175
177
|
kit.actions.launch(params) // found a new faction
|
|
@@ -320,7 +322,7 @@ The callback fires automatically when the tick count reaches the configured inte
|
|
|
320
322
|
|
|
321
323
|
## Comms
|
|
322
324
|
|
|
323
|
-
Messages are bundled with trades — there's no free messaging. `message()` attaches a message to a micro buy (0.001 SOL), displayed as **"said in"**. `fud()` attaches a message to a micro sell (10 tokens), displayed as **"argued in"**. Both
|
|
325
|
+
Messages are bundled with trades — there's no free messaging. `message()` attaches a message to a micro buy (0.001 SOL), displayed as **"said in"**. `fud()` attaches a message to a micro sell (10 tokens), displayed as **"argued in"**. Both work on any faction — the SDK handles routing internally.
|
|
324
326
|
|
|
325
327
|
## Power Score
|
|
326
328
|
|
|
@@ -15,7 +15,6 @@ import {
|
|
|
15
15
|
buildSwapFeesToSolTransaction,
|
|
16
16
|
buildTransferAuthorityTransaction,
|
|
17
17
|
buildUnlinkWalletTransaction,
|
|
18
|
-
buildVaultSwapTransaction,
|
|
19
18
|
buildWithdrawTokensTransaction,
|
|
20
19
|
buildWithdrawVaultTransaction,
|
|
21
20
|
BuyQuoteResult,
|
|
@@ -275,20 +274,6 @@ export class ActionProvider implements Action {
|
|
|
275
274
|
}
|
|
276
275
|
|
|
277
276
|
async defect(params: DefectParams): Promise<TransactionResult> {
|
|
278
|
-
if (params.ascended) {
|
|
279
|
-
const slippage = params.slippage_bps ?? 500
|
|
280
|
-
const quote = await getSellQuote(this.connection, params.mint, params.amount_tokens)
|
|
281
|
-
const minOut = Math.max(1, Math.floor(quote.output_sol * (1 - slippage / 10_000)))
|
|
282
|
-
return buildVaultSwapTransaction(this.connection, {
|
|
283
|
-
mint: params.mint,
|
|
284
|
-
signer: params.agent,
|
|
285
|
-
vault_creator: params.stronghold,
|
|
286
|
-
amount_in: params.amount_tokens,
|
|
287
|
-
minimum_amount_out: minOut,
|
|
288
|
-
is_buy: false,
|
|
289
|
-
message: params.message,
|
|
290
|
-
})
|
|
291
|
-
}
|
|
292
277
|
return buildSellTransaction(this.connection, {
|
|
293
278
|
mint: params.mint,
|
|
294
279
|
seller: params.agent,
|
|
@@ -301,19 +286,6 @@ export class ActionProvider implements Action {
|
|
|
301
286
|
|
|
302
287
|
async fud(params: FudFactionParams): Promise<TransactionResult> {
|
|
303
288
|
const MICRO_SELL_TOKENS = 10 * 1_000_000 // 10 tokens in raw units (6 decimals)
|
|
304
|
-
if (params.ascended) {
|
|
305
|
-
const quote = await getSellQuote(this.connection, params.mint, MICRO_SELL_TOKENS)
|
|
306
|
-
const minOut = Math.max(1, Math.floor(quote.output_sol * (1 - 500 / 10_000)))
|
|
307
|
-
return buildVaultSwapTransaction(this.connection, {
|
|
308
|
-
mint: params.mint,
|
|
309
|
-
signer: params.agent,
|
|
310
|
-
vault_creator: params.stronghold,
|
|
311
|
-
amount_in: MICRO_SELL_TOKENS,
|
|
312
|
-
minimum_amount_out: minOut,
|
|
313
|
-
is_buy: false,
|
|
314
|
-
message: params.message,
|
|
315
|
-
})
|
|
316
|
-
}
|
|
317
289
|
return buildSellTransaction(this.connection, {
|
|
318
290
|
mint: params.mint,
|
|
319
291
|
seller: params.agent,
|
|
@@ -324,21 +296,6 @@ export class ActionProvider implements Action {
|
|
|
324
296
|
}
|
|
325
297
|
|
|
326
298
|
async join(params: JoinFactionParams): Promise<JoinFactionResult> {
|
|
327
|
-
if (params.ascended) {
|
|
328
|
-
const slippage = params.slippage_bps ?? 500
|
|
329
|
-
const quote = await getBuyQuote(this.connection, params.mint, params.amount_sol)
|
|
330
|
-
const minOut = Math.max(1, Math.floor(quote.tokens_to_user * (1 - slippage / 10_000)))
|
|
331
|
-
const result = await buildVaultSwapTransaction(this.connection, {
|
|
332
|
-
mint: params.mint,
|
|
333
|
-
signer: params.agent,
|
|
334
|
-
vault_creator: params.stronghold,
|
|
335
|
-
amount_in: params.amount_sol,
|
|
336
|
-
minimum_amount_out: minOut,
|
|
337
|
-
is_buy: true,
|
|
338
|
-
message: params.message,
|
|
339
|
-
})
|
|
340
|
-
return this.mapper.buyResult(result)
|
|
341
|
-
}
|
|
342
299
|
const result = await buildBuyTransaction(this.connection, {
|
|
343
300
|
mint: params.mint,
|
|
344
301
|
buyer: params.agent,
|
|
@@ -365,20 +322,6 @@ export class ActionProvider implements Action {
|
|
|
365
322
|
|
|
366
323
|
async message(params: MessageFactionParams): Promise<TransactionResult> {
|
|
367
324
|
const MICRO_BUY_LAMPORTS = 1_000_000 // 0.001 SOL
|
|
368
|
-
if (params.ascended) {
|
|
369
|
-
const quote = await getBuyQuote(this.connection, params.mint, MICRO_BUY_LAMPORTS)
|
|
370
|
-
const minOut = Math.max(1, Math.floor(quote.tokens_to_user * (1 - 500 / 10_000)))
|
|
371
|
-
const result = await buildVaultSwapTransaction(this.connection, {
|
|
372
|
-
mint: params.mint,
|
|
373
|
-
signer: params.agent,
|
|
374
|
-
vault_creator: params.stronghold,
|
|
375
|
-
amount_in: MICRO_BUY_LAMPORTS,
|
|
376
|
-
minimum_amount_out: minOut,
|
|
377
|
-
is_buy: true,
|
|
378
|
-
message: params.message,
|
|
379
|
-
})
|
|
380
|
-
return this.mapper.buyResult(result)
|
|
381
|
-
}
|
|
382
325
|
const result = await buildBuyTransaction(this.connection, {
|
|
383
326
|
mint: params.mint,
|
|
384
327
|
buyer: params.agent,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Connection, PublicKey, Transaction, SystemProgram } from '@solana/web3.js'
|
|
1
|
+
import { Connection, PublicKey, Transaction, VersionedTransaction, TransactionMessage, SystemProgram } from '@solana/web3.js'
|
|
2
2
|
import { BN, Program, AnchorProvider, type Wallet } from '@coral-xyz/anchor'
|
|
3
3
|
import type { TransactionResult } from 'torchsdk'
|
|
4
4
|
|
|
@@ -46,10 +46,14 @@ async function finalizeTransaction(
|
|
|
46
46
|
connection: Connection,
|
|
47
47
|
tx: Transaction,
|
|
48
48
|
feePayer: PublicKey,
|
|
49
|
-
): Promise<
|
|
49
|
+
): Promise<VersionedTransaction> {
|
|
50
50
|
const { blockhash } = await connection.getLatestBlockhash()
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
const message = new TransactionMessage({
|
|
52
|
+
payerKey: feePayer,
|
|
53
|
+
recentBlockhash: blockhash,
|
|
54
|
+
instructions: tx.instructions,
|
|
55
|
+
}).compileToV0Message()
|
|
56
|
+
return new VersionedTransaction(message)
|
|
53
57
|
}
|
|
54
58
|
|
|
55
59
|
export class RegistryProvider implements Registry {
|
|
@@ -136,9 +140,9 @@ export class RegistryProvider implements Registry {
|
|
|
136
140
|
.instruction()
|
|
137
141
|
|
|
138
142
|
tx.add(ix)
|
|
139
|
-
await finalizeTransaction(this.connection, tx, creator)
|
|
143
|
+
const versionedTx = await finalizeTransaction(this.connection, tx, creator)
|
|
140
144
|
return {
|
|
141
|
-
transaction:
|
|
145
|
+
transaction: versionedTx,
|
|
142
146
|
message: `Register agent profile [${profile.toBase58()}]`,
|
|
143
147
|
}
|
|
144
148
|
}
|
|
@@ -175,9 +179,9 @@ export class RegistryProvider implements Registry {
|
|
|
175
179
|
.instruction()
|
|
176
180
|
|
|
177
181
|
tx.add(ix)
|
|
178
|
-
await finalizeTransaction(this.connection, tx, signer)
|
|
182
|
+
const versionedTx = await finalizeTransaction(this.connection, tx, signer)
|
|
179
183
|
return {
|
|
180
|
-
transaction:
|
|
184
|
+
transaction: versionedTx,
|
|
181
185
|
message: `Checkpoint agent [${profile.toBase58()}]`,
|
|
182
186
|
}
|
|
183
187
|
}
|
|
@@ -202,9 +206,9 @@ export class RegistryProvider implements Registry {
|
|
|
202
206
|
.instruction()
|
|
203
207
|
|
|
204
208
|
tx.add(ix)
|
|
205
|
-
await finalizeTransaction(this.connection, tx, authority)
|
|
209
|
+
const versionedTx = await finalizeTransaction(this.connection, tx, authority)
|
|
206
210
|
return {
|
|
207
|
-
transaction:
|
|
211
|
+
transaction: versionedTx,
|
|
208
212
|
message: `Link wallet ${walletToLink.toBase58()} to agent [${profile.toBase58()}]`,
|
|
209
213
|
}
|
|
210
214
|
}
|
|
@@ -229,9 +233,9 @@ export class RegistryProvider implements Registry {
|
|
|
229
233
|
.instruction()
|
|
230
234
|
|
|
231
235
|
tx.add(ix)
|
|
232
|
-
await finalizeTransaction(this.connection, tx, authority)
|
|
236
|
+
const versionedTx = await finalizeTransaction(this.connection, tx, authority)
|
|
233
237
|
return {
|
|
234
|
-
transaction:
|
|
238
|
+
transaction: versionedTx,
|
|
235
239
|
message: `Unlink wallet ${walletToUnlink.toBase58()} from agent [${profile.toBase58()}]`,
|
|
236
240
|
}
|
|
237
241
|
}
|
|
@@ -249,9 +253,9 @@ export class RegistryProvider implements Registry {
|
|
|
249
253
|
.instruction()
|
|
250
254
|
|
|
251
255
|
tx.add(ix)
|
|
252
|
-
await finalizeTransaction(this.connection, tx, authority)
|
|
256
|
+
const versionedTx = await finalizeTransaction(this.connection, tx, authority)
|
|
253
257
|
return {
|
|
254
|
-
transaction:
|
|
258
|
+
transaction: versionedTx,
|
|
255
259
|
message: `Transfer agent authority to ${newAuthority.toBase58()}`,
|
|
256
260
|
}
|
|
257
261
|
}
|
package/src/types.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
* protocol primitives into faction warfare language.
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import type {
|
|
9
|
+
import type { VersionedTransaction, Keypair, PublicKey } from '@solana/web3.js'
|
|
10
10
|
import type {
|
|
11
11
|
TokenSortOption,
|
|
12
12
|
TransactionResult,
|
|
@@ -347,7 +347,7 @@ export type {
|
|
|
347
347
|
}
|
|
348
348
|
|
|
349
349
|
export interface JoinFactionResult extends TransactionResult {
|
|
350
|
-
migrationTransaction?:
|
|
350
|
+
migrationTransaction?: VersionedTransaction
|
|
351
351
|
}
|
|
352
352
|
|
|
353
353
|
export interface LaunchFactionResult extends TransactionResult {
|
package/src/util.ts
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
import { PublicKey } from '@solana/web3.js'
|
|
9
|
-
import { getRaydiumMigrationAccounts } from 'torchsdk'
|
|
9
|
+
import { getRaydiumMigrationAccounts } from 'torchsdk/dist/program'
|
|
10
10
|
import { Intel } from './types/intel.types'
|
|
11
11
|
|
|
12
12
|
// ─── Blacklist ──────────────────────────────────────────────────────
|
package/src/vanity.ts
CHANGED
|
@@ -10,6 +10,8 @@ import {
|
|
|
10
10
|
Connection,
|
|
11
11
|
PublicKey,
|
|
12
12
|
Transaction,
|
|
13
|
+
VersionedTransaction,
|
|
14
|
+
TransactionMessage,
|
|
13
15
|
SystemProgram,
|
|
14
16
|
SYSVAR_RENT_PUBKEY,
|
|
15
17
|
Keypair,
|
|
@@ -66,10 +68,14 @@ const finalizeTransaction = async (
|
|
|
66
68
|
connection: Connection,
|
|
67
69
|
tx: Transaction,
|
|
68
70
|
feePayer: PublicKey,
|
|
69
|
-
): Promise<
|
|
71
|
+
): Promise<VersionedTransaction> => {
|
|
70
72
|
const { blockhash } = await connection.getLatestBlockhash()
|
|
71
|
-
|
|
72
|
-
|
|
73
|
+
const message = new TransactionMessage({
|
|
74
|
+
payerKey: feePayer,
|
|
75
|
+
recentBlockhash: blockhash,
|
|
76
|
+
instructions: tx.instructions,
|
|
77
|
+
}).compileToV0Message()
|
|
78
|
+
return new VersionedTransaction(message)
|
|
73
79
|
}
|
|
74
80
|
|
|
75
81
|
// ── Vanity grinder ──
|
|
@@ -160,13 +166,13 @@ export const buildCreateFactionTransaction = async (
|
|
|
160
166
|
.instruction()
|
|
161
167
|
|
|
162
168
|
tx.add(createIx)
|
|
163
|
-
await finalizeTransaction(connection, tx, creator)
|
|
169
|
+
const versionedTx = await finalizeTransaction(connection, tx, creator)
|
|
164
170
|
|
|
165
171
|
// Partially sign with mint keypair
|
|
166
|
-
|
|
172
|
+
versionedTx.sign([mint])
|
|
167
173
|
|
|
168
174
|
return {
|
|
169
|
-
transaction:
|
|
175
|
+
transaction: versionedTx,
|
|
170
176
|
mint: mint.publicKey,
|
|
171
177
|
mintKeypair: mint,
|
|
172
178
|
message: `Create faction "${name}" ($${symbol}) [pyre:${mint.publicKey.toBase58()}]`,
|