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,443 @@
|
|
|
1
|
+
import { Connection, GetProgramAccountsFilter, PublicKey } from '@solana/web3.js'
|
|
2
|
+
import { Action } from '../types/action.types'
|
|
3
|
+
import {
|
|
4
|
+
buildBorrowTransaction,
|
|
5
|
+
buildBuyTransaction,
|
|
6
|
+
buildClaimProtocolRewardsTransaction,
|
|
7
|
+
buildCreateVaultTransaction,
|
|
8
|
+
buildDepositVaultTransaction,
|
|
9
|
+
buildLinkWalletTransaction,
|
|
10
|
+
buildLiquidateTransaction,
|
|
11
|
+
buildMigrateTransaction,
|
|
12
|
+
buildReclaimFailedTokenTransaction,
|
|
13
|
+
buildRepayTransaction,
|
|
14
|
+
buildSellTransaction,
|
|
15
|
+
buildStarTransaction,
|
|
16
|
+
buildSwapFeesToSolTransaction,
|
|
17
|
+
buildTransferAuthorityTransaction,
|
|
18
|
+
buildUnlinkWalletTransaction,
|
|
19
|
+
buildVaultSwapTransaction,
|
|
20
|
+
buildWithdrawTokensTransaction,
|
|
21
|
+
buildWithdrawVaultTransaction,
|
|
22
|
+
BuyQuoteResult,
|
|
23
|
+
getAllLoanPositions,
|
|
24
|
+
getBorrowQuote,
|
|
25
|
+
getBuyQuote,
|
|
26
|
+
getHolders,
|
|
27
|
+
getLendingInfo,
|
|
28
|
+
getLoanPosition,
|
|
29
|
+
getMessages,
|
|
30
|
+
getSellQuote,
|
|
31
|
+
getToken,
|
|
32
|
+
getTokens,
|
|
33
|
+
getVault,
|
|
34
|
+
getVaultForWallet,
|
|
35
|
+
getVaultWalletLink,
|
|
36
|
+
PROGRAM_ID,
|
|
37
|
+
SellQuoteResult,
|
|
38
|
+
TransactionResult,
|
|
39
|
+
} from 'torchsdk'
|
|
40
|
+
import {
|
|
41
|
+
AgentLink,
|
|
42
|
+
AllWarLoansResult,
|
|
43
|
+
AscendParams,
|
|
44
|
+
ClaimSpoilsParams,
|
|
45
|
+
CommsResult,
|
|
46
|
+
CoupParams,
|
|
47
|
+
CreateStrongholdParams,
|
|
48
|
+
DefectParams,
|
|
49
|
+
ExileAgentParams,
|
|
50
|
+
FactionDetail,
|
|
51
|
+
FactionListParams,
|
|
52
|
+
FactionListResult,
|
|
53
|
+
FactionStatus,
|
|
54
|
+
FudFactionParams,
|
|
55
|
+
FundStrongholdParams,
|
|
56
|
+
JoinFactionParams,
|
|
57
|
+
JoinFactionResult,
|
|
58
|
+
LaunchFactionParams,
|
|
59
|
+
LaunchFactionResult,
|
|
60
|
+
MembersResult,
|
|
61
|
+
MessageFactionParams,
|
|
62
|
+
RallyParams,
|
|
63
|
+
RazeParams,
|
|
64
|
+
RecruitAgentParams,
|
|
65
|
+
RepayWarLoanParams,
|
|
66
|
+
RequestWarLoanParams,
|
|
67
|
+
SiegeParams,
|
|
68
|
+
Strategy,
|
|
69
|
+
Stronghold,
|
|
70
|
+
TitheParams,
|
|
71
|
+
WarChest,
|
|
72
|
+
WarLoan,
|
|
73
|
+
WarLoanQuote,
|
|
74
|
+
WithdrawAssetsParams,
|
|
75
|
+
WithdrawFromStrongholdParams,
|
|
76
|
+
} from '../types'
|
|
77
|
+
import { MapperProvider } from './mapper.provider'
|
|
78
|
+
import {
|
|
79
|
+
buildCreateFactionTransaction,
|
|
80
|
+
getBondingCurvePda,
|
|
81
|
+
getTokenTreasuryPda,
|
|
82
|
+
getTreasuryLockPda,
|
|
83
|
+
isPyreMint,
|
|
84
|
+
} from '../vanity'
|
|
85
|
+
import { isBlacklistedMint } from '../util'
|
|
86
|
+
|
|
87
|
+
export class ActionProvider implements Action {
|
|
88
|
+
private mapper = new MapperProvider()
|
|
89
|
+
constructor(private connection: Connection) {}
|
|
90
|
+
|
|
91
|
+
async createStronghold(params: CreateStrongholdParams): Promise<TransactionResult> {
|
|
92
|
+
return buildCreateVaultTransaction(this.connection, { creator: params.creator })
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
async coup(params: CoupParams): Promise<TransactionResult> {
|
|
96
|
+
return buildTransferAuthorityTransaction(this.connection, {
|
|
97
|
+
authority: params.authority,
|
|
98
|
+
vault_creator: params.stronghold_creator,
|
|
99
|
+
new_authority: params.new_authority,
|
|
100
|
+
})
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
async exileAgent(params: ExileAgentParams): Promise<TransactionResult> {
|
|
104
|
+
return buildUnlinkWalletTransaction(this.connection, {
|
|
105
|
+
authority: params.authority,
|
|
106
|
+
vault_creator: params.stronghold_creator,
|
|
107
|
+
wallet_to_unlink: params.wallet_to_unlink,
|
|
108
|
+
})
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
async fundStronghold(params: FundStrongholdParams): Promise<TransactionResult> {
|
|
112
|
+
return buildDepositVaultTransaction(this.connection, {
|
|
113
|
+
depositor: params.depositor,
|
|
114
|
+
vault_creator: params.stronghold_creator,
|
|
115
|
+
amount_sol: params.amount_sol,
|
|
116
|
+
})
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
async recruitAgent(params: RecruitAgentParams): Promise<TransactionResult> {
|
|
120
|
+
return buildLinkWalletTransaction(this.connection, {
|
|
121
|
+
authority: params.authority,
|
|
122
|
+
vault_creator: params.stronghold_creator,
|
|
123
|
+
wallet_to_link: params.wallet_to_link,
|
|
124
|
+
})
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
async withdrawAssets(params: WithdrawAssetsParams): Promise<TransactionResult> {
|
|
128
|
+
return buildWithdrawTokensTransaction(this.connection, {
|
|
129
|
+
authority: params.authority,
|
|
130
|
+
vault_creator: params.stronghold_creator,
|
|
131
|
+
mint: params.mint,
|
|
132
|
+
destination: params.destination,
|
|
133
|
+
amount: params.amount,
|
|
134
|
+
})
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
async withdrawFromStronghold(params: WithdrawFromStrongholdParams): Promise<TransactionResult> {
|
|
138
|
+
return buildWithdrawVaultTransaction(this.connection, {
|
|
139
|
+
authority: params.authority,
|
|
140
|
+
vault_creator: params.stronghold_creator,
|
|
141
|
+
amount_sol: params.amount_sol,
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
async getAgentLink(wallet: string): Promise<AgentLink | undefined> {
|
|
146
|
+
const link = await getVaultWalletLink(this.connection, wallet)
|
|
147
|
+
return link ? this.mapper.walletLinkToAgentLink(link) : undefined
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
async getComms(
|
|
151
|
+
mint: string,
|
|
152
|
+
{ limit, status }: { limit?: number; status?: FactionStatus },
|
|
153
|
+
): Promise<CommsResult> {
|
|
154
|
+
const source = status === 'ascended' ? 'pool' : status ? 'bonding' : 'all'
|
|
155
|
+
const result = await getMessages(this.connection, mint, limit, { source })
|
|
156
|
+
return this.mapper.messagesResult(result)
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
async getDefectQuote(mint: string, amountTokens: number): Promise<SellQuoteResult> {
|
|
160
|
+
return getSellQuote(this.connection, mint, amountTokens)
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
async getJoinQuote(mint: string, amountSolLamports: number): Promise<BuyQuoteResult> {
|
|
164
|
+
return getBuyQuote(this.connection, mint, amountSolLamports)
|
|
165
|
+
}
|
|
166
|
+
|
|
167
|
+
async getFaction(mint: string): Promise<FactionDetail> {
|
|
168
|
+
const detail = await getToken(this.connection, mint)
|
|
169
|
+
return this.mapper.tokenDetailToFaction(detail)
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
async getFactions(params?: FactionListParams): Promise<FactionListResult> {
|
|
173
|
+
const sdkParams = params
|
|
174
|
+
? {
|
|
175
|
+
limit: params.limit,
|
|
176
|
+
offset: params.offset,
|
|
177
|
+
status: params.status ? this.mapper.tokenStatusFilter(params.status) : undefined,
|
|
178
|
+
sort: params.sort,
|
|
179
|
+
}
|
|
180
|
+
: undefined
|
|
181
|
+
const result = await getTokens(this.connection, sdkParams)
|
|
182
|
+
const tokens = result.tokens.filter((t) => isPyreMint(t.mint))
|
|
183
|
+
return this.mapper.tokenListResult({
|
|
184
|
+
tokens: result.tokens.filter((t) => isPyreMint(t.mint) && !isBlacklistedMint(t.mint)),
|
|
185
|
+
limit: result.limit,
|
|
186
|
+
offset: result.offset,
|
|
187
|
+
total: tokens.length,
|
|
188
|
+
})
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
async getLinkedAgents(vaultAddress: string): Promise<AgentLink[]> {
|
|
192
|
+
const vaultPubkey = new PublicKey(vaultAddress)
|
|
193
|
+
const filters: GetProgramAccountsFilter[] = [
|
|
194
|
+
{ dataSize: 81 }, // 8 + 32 + 32 + 8 + 1
|
|
195
|
+
{ memcmp: { offset: 8, bytes: vaultPubkey.toBase58() } },
|
|
196
|
+
]
|
|
197
|
+
|
|
198
|
+
const accounts = await this.connection.getProgramAccounts(PROGRAM_ID, { filters })
|
|
199
|
+
return accounts.map((acc) => {
|
|
200
|
+
const data = acc.account.data
|
|
201
|
+
const wallet = new PublicKey(data.subarray(40, 72)).toBase58()
|
|
202
|
+
const linked_at = Number(data.readBigInt64LE(72))
|
|
203
|
+
return {
|
|
204
|
+
address: acc.pubkey.toBase58(),
|
|
205
|
+
stronghold: vaultAddress,
|
|
206
|
+
wallet,
|
|
207
|
+
linked_at,
|
|
208
|
+
}
|
|
209
|
+
})
|
|
210
|
+
}
|
|
211
|
+
|
|
212
|
+
async getMembers(mint: string, limit?: number): Promise<MembersResult> {
|
|
213
|
+
const mintPk = new PublicKey(mint)
|
|
214
|
+
const [bondingCurve] = getBondingCurvePda(mintPk)
|
|
215
|
+
const [treasury] = getTokenTreasuryPda(mintPk)
|
|
216
|
+
const [treasuryLock] = getTreasuryLockPda(mintPk)
|
|
217
|
+
const excluded = new Set([
|
|
218
|
+
bondingCurve.toString(),
|
|
219
|
+
treasury.toString(),
|
|
220
|
+
treasuryLock.toString(),
|
|
221
|
+
])
|
|
222
|
+
|
|
223
|
+
// Fetch extra to compensate for filtered-out program accounts
|
|
224
|
+
const result = await getHolders(this.connection, mint, (limit ?? 10) + 5)
|
|
225
|
+
result.holders = result.holders.filter((h) => !excluded.has(h.address))
|
|
226
|
+
if (limit) result.holders = result.holders.slice(0, limit)
|
|
227
|
+
return this.mapper.holdersResult(result)
|
|
228
|
+
}
|
|
229
|
+
|
|
230
|
+
async getStronghold(creator: string): Promise<Stronghold | undefined> {
|
|
231
|
+
const vault = await getVault(this.connection, creator)
|
|
232
|
+
return vault ? this.mapper.vaultToStronghold(vault) : undefined
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
async getStrongholdForAgent(wallet: string): Promise<Stronghold | undefined> {
|
|
236
|
+
const vault = await getVaultForWallet(this.connection, wallet)
|
|
237
|
+
return vault ? this.mapper.vaultToStronghold(vault) : undefined
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
async getWarChest(mint: string): Promise<WarChest> {
|
|
241
|
+
const info = await getLendingInfo(this.connection, mint)
|
|
242
|
+
return this.mapper.lendingToWarChest(info)
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
async getWarLoan(mint: string, wallet: string): Promise<WarLoan> {
|
|
246
|
+
const pos = await getLoanPosition(this.connection, mint, wallet)
|
|
247
|
+
return this.mapper.loanToWarLoan(pos)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
async getWarLoanQuote(mint: string, collateralAmount: number): Promise<WarLoanQuote> {
|
|
251
|
+
return getBorrowQuote(this.connection, mint, collateralAmount)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
async getWarLoansForFaction(mint: string): Promise<AllWarLoansResult> {
|
|
255
|
+
const result = await getAllLoanPositions(this.connection, mint)
|
|
256
|
+
return this.mapper.allLoansResult(result)
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
async ascend(params: AscendParams): Promise<TransactionResult> {
|
|
260
|
+
return buildMigrateTransaction(this.connection, {
|
|
261
|
+
mint: params.mint,
|
|
262
|
+
payer: params.payer,
|
|
263
|
+
})
|
|
264
|
+
}
|
|
265
|
+
|
|
266
|
+
async claimSpoils(params: ClaimSpoilsParams): Promise<TransactionResult> {
|
|
267
|
+
return buildClaimProtocolRewardsTransaction(this.connection, {
|
|
268
|
+
user: params.agent,
|
|
269
|
+
vault: params.stronghold,
|
|
270
|
+
})
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
async defect(params: DefectParams): Promise<TransactionResult> {
|
|
274
|
+
if (params.ascended) {
|
|
275
|
+
const slippage = params.slippage_bps ?? 500
|
|
276
|
+
const quote = await getSellQuote(this.connection, params.mint, params.amount_tokens)
|
|
277
|
+
const minOut = Math.max(1, Math.floor(quote.output_sol * (1 - slippage / 10_000)))
|
|
278
|
+
return buildVaultSwapTransaction(this.connection, {
|
|
279
|
+
mint: params.mint,
|
|
280
|
+
signer: params.agent,
|
|
281
|
+
vault_creator: params.stronghold,
|
|
282
|
+
amount_in: params.amount_tokens,
|
|
283
|
+
minimum_amount_out: minOut,
|
|
284
|
+
is_buy: false,
|
|
285
|
+
message: params.message,
|
|
286
|
+
})
|
|
287
|
+
}
|
|
288
|
+
return buildSellTransaction(this.connection, {
|
|
289
|
+
mint: params.mint,
|
|
290
|
+
seller: params.agent,
|
|
291
|
+
amount_tokens: params.amount_tokens,
|
|
292
|
+
slippage_bps: params.slippage_bps,
|
|
293
|
+
message: params.message,
|
|
294
|
+
vault: params.stronghold,
|
|
295
|
+
})
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
async fud(params: FudFactionParams): Promise<TransactionResult> {
|
|
299
|
+
const MICRO_SELL_TOKENS = 100
|
|
300
|
+
if (params.ascended) {
|
|
301
|
+
const quote = await getSellQuote(this.connection, params.mint, MICRO_SELL_TOKENS)
|
|
302
|
+
const minOut = Math.max(1, Math.floor(quote.output_sol * (1 - 500 / 10_000)))
|
|
303
|
+
return buildVaultSwapTransaction(this.connection, {
|
|
304
|
+
mint: params.mint,
|
|
305
|
+
signer: params.agent,
|
|
306
|
+
vault_creator: params.stronghold,
|
|
307
|
+
amount_in: MICRO_SELL_TOKENS,
|
|
308
|
+
minimum_amount_out: minOut,
|
|
309
|
+
is_buy: false,
|
|
310
|
+
message: params.message,
|
|
311
|
+
})
|
|
312
|
+
}
|
|
313
|
+
return buildSellTransaction(this.connection, {
|
|
314
|
+
mint: params.mint,
|
|
315
|
+
seller: params.agent,
|
|
316
|
+
amount_tokens: MICRO_SELL_TOKENS,
|
|
317
|
+
message: params.message,
|
|
318
|
+
vault: params.stronghold,
|
|
319
|
+
})
|
|
320
|
+
}
|
|
321
|
+
|
|
322
|
+
async join(params: JoinFactionParams): Promise<JoinFactionResult> {
|
|
323
|
+
if (params.ascended) {
|
|
324
|
+
const slippage = params.slippage_bps ?? 500
|
|
325
|
+
const quote = await getBuyQuote(this.connection, params.mint, params.amount_sol)
|
|
326
|
+
const minOut = Math.max(1, Math.floor(quote.tokens_to_user * (1 - slippage / 10_000)))
|
|
327
|
+
const result = await buildVaultSwapTransaction(this.connection, {
|
|
328
|
+
mint: params.mint,
|
|
329
|
+
signer: params.agent,
|
|
330
|
+
vault_creator: params.stronghold,
|
|
331
|
+
amount_in: params.amount_sol,
|
|
332
|
+
minimum_amount_out: minOut,
|
|
333
|
+
is_buy: true,
|
|
334
|
+
message: params.message,
|
|
335
|
+
})
|
|
336
|
+
return this.mapper.buyResult(result)
|
|
337
|
+
}
|
|
338
|
+
const result = await buildBuyTransaction(this.connection, {
|
|
339
|
+
mint: params.mint,
|
|
340
|
+
buyer: params.agent,
|
|
341
|
+
amount_sol: params.amount_sol,
|
|
342
|
+
slippage_bps: params.slippage_bps,
|
|
343
|
+
vote: params.strategy ? this.mapper.vote(params.strategy) : undefined,
|
|
344
|
+
message: params.message,
|
|
345
|
+
vault: params.stronghold,
|
|
346
|
+
})
|
|
347
|
+
return this.mapper.buyResult(result)
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
async launch(params: LaunchFactionParams): Promise<LaunchFactionResult> {
|
|
351
|
+
const result = await buildCreateFactionTransaction(this.connection, {
|
|
352
|
+
creator: params.founder,
|
|
353
|
+
name: params.name,
|
|
354
|
+
symbol: params.symbol,
|
|
355
|
+
metadata_uri: params.metadata_uri,
|
|
356
|
+
sol_target: params.sol_target,
|
|
357
|
+
community_token: params.community_faction,
|
|
358
|
+
})
|
|
359
|
+
return this.mapper.createResult(result)
|
|
360
|
+
}
|
|
361
|
+
|
|
362
|
+
async message(params: MessageFactionParams): Promise<TransactionResult> {
|
|
363
|
+
const MICRO_BUY_LAMPORTS = 1_000_000 // 0.001 SOL
|
|
364
|
+
if (params.ascended) {
|
|
365
|
+
const quote = await getBuyQuote(this.connection, params.mint, MICRO_BUY_LAMPORTS)
|
|
366
|
+
const minOut = Math.max(1, Math.floor(quote.tokens_to_user * (1 - 500 / 10_000)))
|
|
367
|
+
const result = await buildVaultSwapTransaction(this.connection, {
|
|
368
|
+
mint: params.mint,
|
|
369
|
+
signer: params.agent,
|
|
370
|
+
vault_creator: params.stronghold,
|
|
371
|
+
amount_in: MICRO_BUY_LAMPORTS,
|
|
372
|
+
minimum_amount_out: minOut,
|
|
373
|
+
is_buy: true,
|
|
374
|
+
message: params.message,
|
|
375
|
+
})
|
|
376
|
+
return this.mapper.buyResult(result)
|
|
377
|
+
}
|
|
378
|
+
const result = await buildBuyTransaction(this.connection, {
|
|
379
|
+
mint: params.mint,
|
|
380
|
+
buyer: params.agent,
|
|
381
|
+
amount_sol: MICRO_BUY_LAMPORTS,
|
|
382
|
+
message: params.message,
|
|
383
|
+
vault: params.stronghold,
|
|
384
|
+
vote: params.first_buy
|
|
385
|
+
? this.mapper.vote(Math.random() > 0.5 ? 'fortify' : ('scorched_earth' as Strategy))
|
|
386
|
+
: undefined,
|
|
387
|
+
})
|
|
388
|
+
return this.mapper.buyResult(result)
|
|
389
|
+
}
|
|
390
|
+
|
|
391
|
+
async rally(params: RallyParams): Promise<TransactionResult> {
|
|
392
|
+
return buildStarTransaction(this.connection, {
|
|
393
|
+
mint: params.mint,
|
|
394
|
+
user: params.agent,
|
|
395
|
+
vault: params.stronghold,
|
|
396
|
+
})
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
async raze(params: RazeParams): Promise<TransactionResult> {
|
|
400
|
+
return buildReclaimFailedTokenTransaction(this.connection, {
|
|
401
|
+
payer: params.payer,
|
|
402
|
+
mint: params.mint,
|
|
403
|
+
})
|
|
404
|
+
}
|
|
405
|
+
|
|
406
|
+
async repayWarLoan(params: RepayWarLoanParams): Promise<TransactionResult> {
|
|
407
|
+
return buildRepayTransaction(this.connection, {
|
|
408
|
+
mint: params.mint,
|
|
409
|
+
borrower: params.borrower,
|
|
410
|
+
sol_amount: params.sol_amount,
|
|
411
|
+
vault: params.stronghold,
|
|
412
|
+
})
|
|
413
|
+
}
|
|
414
|
+
|
|
415
|
+
async requestWarLoan(params: RequestWarLoanParams): Promise<TransactionResult> {
|
|
416
|
+
return buildBorrowTransaction(this.connection, {
|
|
417
|
+
mint: params.mint,
|
|
418
|
+
borrower: params.borrower,
|
|
419
|
+
collateral_amount: params.collateral_amount,
|
|
420
|
+
sol_to_borrow: params.sol_to_borrow,
|
|
421
|
+
vault: params.stronghold,
|
|
422
|
+
})
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
async siege(params: SiegeParams): Promise<TransactionResult> {
|
|
426
|
+
return buildLiquidateTransaction(this.connection, {
|
|
427
|
+
mint: params.mint,
|
|
428
|
+
liquidator: params.liquidator,
|
|
429
|
+
borrower: params.borrower,
|
|
430
|
+
vault: params.stronghold,
|
|
431
|
+
})
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
async tithe(params: TitheParams): Promise<TransactionResult> {
|
|
435
|
+
return buildSwapFeesToSolTransaction(this.connection, {
|
|
436
|
+
mint: params.mint,
|
|
437
|
+
payer: params.payer,
|
|
438
|
+
minimum_amount_out: params.minimum_amount_out,
|
|
439
|
+
harvest: true,
|
|
440
|
+
sources: params.sources,
|
|
441
|
+
})
|
|
442
|
+
}
|
|
443
|
+
}
|