torchsdk 3.5.0 → 3.6.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/constants.d.ts +25 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +52 -0
- package/dist/constants.js.map +1 -0
- package/dist/ephemeral.d.ts +33 -0
- package/dist/ephemeral.d.ts.map +1 -0
- package/dist/ephemeral.js +39 -0
- package/dist/ephemeral.js.map +1 -0
- package/dist/gateway.d.ts +17 -0
- package/dist/gateway.d.ts.map +1 -0
- package/dist/gateway.js +48 -0
- package/dist/gateway.js.map +1 -0
- package/dist/index.d.ts +20 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +62 -0
- package/dist/index.js.map +1 -0
- package/dist/program.d.ts +150 -0
- package/dist/program.d.ts.map +1 -0
- package/dist/program.js +216 -0
- package/dist/program.js.map +1 -0
- package/dist/quotes.d.ts +16 -0
- package/dist/quotes.d.ts.map +1 -0
- package/dist/quotes.js +79 -0
- package/dist/quotes.js.map +1 -0
- package/dist/said.d.ts +27 -0
- package/dist/said.d.ts.map +1 -0
- package/dist/said.js +89 -0
- package/dist/said.js.map +1 -0
- package/dist/tokens.d.ts +64 -0
- package/dist/tokens.d.ts.map +1 -0
- package/dist/tokens.js +650 -0
- package/dist/tokens.js.map +1 -0
- package/dist/torch_market.json +6385 -0
- package/dist/transactions.d.ts +183 -0
- package/dist/transactions.d.ts.map +1 -0
- package/dist/transactions.js +994 -0
- package/dist/transactions.js.map +1 -0
- package/dist/types.d.ts +283 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +6 -0
- package/dist/types.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Transaction builders
|
|
3
|
+
*
|
|
4
|
+
* Build unsigned transactions for buy, sell, create, star, vault, and lending.
|
|
5
|
+
* Agents sign these locally and submit to the network.
|
|
6
|
+
*/
|
|
7
|
+
import { Connection } from '@solana/web3.js';
|
|
8
|
+
import { BuyParams, DirectBuyParams, SellParams, CreateTokenParams, StarParams, BorrowParams, RepayParams, LiquidateParams, ClaimProtocolRewardsParams, VaultSwapParams, CreateVaultParams, DepositVaultParams, WithdrawVaultParams, WithdrawTokensParams, LinkWalletParams, UnlinkWalletParams, TransferAuthorityParams, TransactionResult, CreateTokenResult } from './types';
|
|
9
|
+
/**
|
|
10
|
+
* Build an unsigned vault-funded buy transaction.
|
|
11
|
+
*
|
|
12
|
+
* The vault pays for the buy. This is the recommended path for AI agents.
|
|
13
|
+
*
|
|
14
|
+
* @param connection - Solana RPC connection
|
|
15
|
+
* @param params - Buy parameters with required vault creator pubkey
|
|
16
|
+
* @returns Unsigned transaction and descriptive message
|
|
17
|
+
*/
|
|
18
|
+
export declare const buildBuyTransaction: (connection: Connection, params: BuyParams) => Promise<TransactionResult>;
|
|
19
|
+
/**
|
|
20
|
+
* Build an unsigned direct buy transaction (no vault).
|
|
21
|
+
*
|
|
22
|
+
* The buyer pays from their own wallet. Use this for human-operated wallets only.
|
|
23
|
+
* For AI agents, use buildBuyTransaction with a vault instead.
|
|
24
|
+
*
|
|
25
|
+
* @param connection - Solana RPC connection
|
|
26
|
+
* @param params - Buy parameters (no vault)
|
|
27
|
+
* @returns Unsigned transaction and descriptive message
|
|
28
|
+
*/
|
|
29
|
+
export declare const buildDirectBuyTransaction: (connection: Connection, params: DirectBuyParams) => Promise<TransactionResult>;
|
|
30
|
+
/**
|
|
31
|
+
* Build an unsigned sell transaction.
|
|
32
|
+
*
|
|
33
|
+
* @param connection - Solana RPC connection
|
|
34
|
+
* @param params - Sell parameters (mint, seller, amount_tokens in raw units, optional slippage_bps)
|
|
35
|
+
* @returns Unsigned transaction and descriptive message
|
|
36
|
+
*/
|
|
37
|
+
export declare const buildSellTransaction: (connection: Connection, params: SellParams) => Promise<TransactionResult>;
|
|
38
|
+
/**
|
|
39
|
+
* Build an unsigned create token transaction.
|
|
40
|
+
*
|
|
41
|
+
* Returns the transaction (partially signed by the mint keypair) and the mint keypair
|
|
42
|
+
* so the agent can extract the mint address.
|
|
43
|
+
*
|
|
44
|
+
* @param connection - Solana RPC connection
|
|
45
|
+
* @param params - Create parameters (creator, name, symbol, metadata_uri)
|
|
46
|
+
* @returns Partially-signed transaction, mint PublicKey, and mint Keypair
|
|
47
|
+
*/
|
|
48
|
+
export declare const buildCreateTokenTransaction: (connection: Connection, params: CreateTokenParams) => Promise<CreateTokenResult>;
|
|
49
|
+
/**
|
|
50
|
+
* Build an unsigned star transaction (costs 0.05 SOL).
|
|
51
|
+
*
|
|
52
|
+
* @param connection - Solana RPC connection
|
|
53
|
+
* @param params - Star parameters (mint, user)
|
|
54
|
+
* @returns Unsigned transaction and descriptive message
|
|
55
|
+
*/
|
|
56
|
+
export declare const buildStarTransaction: (connection: Connection, params: StarParams) => Promise<TransactionResult>;
|
|
57
|
+
/**
|
|
58
|
+
* Build an unsigned create vault transaction.
|
|
59
|
+
*
|
|
60
|
+
* Creates a TorchVault PDA and auto-links the creator's wallet.
|
|
61
|
+
*
|
|
62
|
+
* @param connection - Solana RPC connection
|
|
63
|
+
* @param params - Creator public key
|
|
64
|
+
* @returns Unsigned transaction
|
|
65
|
+
*/
|
|
66
|
+
export declare const buildCreateVaultTransaction: (connection: Connection, params: CreateVaultParams) => Promise<TransactionResult>;
|
|
67
|
+
/**
|
|
68
|
+
* Build an unsigned deposit vault transaction.
|
|
69
|
+
*
|
|
70
|
+
* Anyone can deposit SOL into any vault.
|
|
71
|
+
*
|
|
72
|
+
* @param connection - Solana RPC connection
|
|
73
|
+
* @param params - Depositor, vault creator, amount in lamports
|
|
74
|
+
* @returns Unsigned transaction
|
|
75
|
+
*/
|
|
76
|
+
export declare const buildDepositVaultTransaction: (connection: Connection, params: DepositVaultParams) => Promise<TransactionResult>;
|
|
77
|
+
/**
|
|
78
|
+
* Build an unsigned withdraw vault transaction.
|
|
79
|
+
*
|
|
80
|
+
* Only the vault authority can withdraw.
|
|
81
|
+
*
|
|
82
|
+
* @param connection - Solana RPC connection
|
|
83
|
+
* @param params - Authority, vault creator, amount in lamports
|
|
84
|
+
* @returns Unsigned transaction
|
|
85
|
+
*/
|
|
86
|
+
export declare const buildWithdrawVaultTransaction: (connection: Connection, params: WithdrawVaultParams) => Promise<TransactionResult>;
|
|
87
|
+
/**
|
|
88
|
+
* Build an unsigned link wallet transaction.
|
|
89
|
+
*
|
|
90
|
+
* Only the vault authority can link wallets.
|
|
91
|
+
*
|
|
92
|
+
* @param connection - Solana RPC connection
|
|
93
|
+
* @param params - Authority, vault creator, wallet to link
|
|
94
|
+
* @returns Unsigned transaction
|
|
95
|
+
*/
|
|
96
|
+
export declare const buildLinkWalletTransaction: (connection: Connection, params: LinkWalletParams) => Promise<TransactionResult>;
|
|
97
|
+
/**
|
|
98
|
+
* Build an unsigned unlink wallet transaction.
|
|
99
|
+
*
|
|
100
|
+
* Only the vault authority can unlink wallets. Rent returns to authority.
|
|
101
|
+
*
|
|
102
|
+
* @param connection - Solana RPC connection
|
|
103
|
+
* @param params - Authority, vault creator, wallet to unlink
|
|
104
|
+
* @returns Unsigned transaction
|
|
105
|
+
*/
|
|
106
|
+
export declare const buildUnlinkWalletTransaction: (connection: Connection, params: UnlinkWalletParams) => Promise<TransactionResult>;
|
|
107
|
+
/**
|
|
108
|
+
* Build an unsigned transfer authority transaction.
|
|
109
|
+
*
|
|
110
|
+
* Transfers vault admin control to a new wallet.
|
|
111
|
+
*
|
|
112
|
+
* @param connection - Solana RPC connection
|
|
113
|
+
* @param params - Current authority, vault creator, new authority
|
|
114
|
+
* @returns Unsigned transaction
|
|
115
|
+
*/
|
|
116
|
+
export declare const buildTransferAuthorityTransaction: (connection: Connection, params: TransferAuthorityParams) => Promise<TransactionResult>;
|
|
117
|
+
/**
|
|
118
|
+
* Build an unsigned borrow transaction.
|
|
119
|
+
*
|
|
120
|
+
* Lock tokens as collateral in the collateral vault and receive SOL from treasury.
|
|
121
|
+
* Token must be migrated (has Raydium pool for price calculation).
|
|
122
|
+
*
|
|
123
|
+
* @param connection - Solana RPC connection
|
|
124
|
+
* @param params - Borrow parameters (mint, borrower, collateral_amount, sol_to_borrow)
|
|
125
|
+
* @returns Unsigned transaction and descriptive message
|
|
126
|
+
*/
|
|
127
|
+
export declare const buildBorrowTransaction: (connection: Connection, params: BorrowParams) => Promise<TransactionResult>;
|
|
128
|
+
/**
|
|
129
|
+
* Build an unsigned repay transaction.
|
|
130
|
+
*
|
|
131
|
+
* Repay SOL debt. Interest is paid first, then principal.
|
|
132
|
+
* Full repay returns all collateral and closes the position.
|
|
133
|
+
*
|
|
134
|
+
* @param connection - Solana RPC connection
|
|
135
|
+
* @param params - Repay parameters (mint, borrower, sol_amount)
|
|
136
|
+
* @returns Unsigned transaction and descriptive message
|
|
137
|
+
*/
|
|
138
|
+
export declare const buildRepayTransaction: (connection: Connection, params: RepayParams) => Promise<TransactionResult>;
|
|
139
|
+
/**
|
|
140
|
+
* Build an unsigned liquidate transaction.
|
|
141
|
+
*
|
|
142
|
+
* Permissionless — anyone can call when a borrower's LTV exceeds the
|
|
143
|
+
* liquidation threshold. Liquidator pays SOL and receives collateral + bonus.
|
|
144
|
+
*
|
|
145
|
+
* @param connection - Solana RPC connection
|
|
146
|
+
* @param params - Liquidate parameters (mint, liquidator, borrower)
|
|
147
|
+
* @returns Unsigned transaction and descriptive message
|
|
148
|
+
*/
|
|
149
|
+
export declare const buildLiquidateTransaction: (connection: Connection, params: LiquidateParams) => Promise<TransactionResult>;
|
|
150
|
+
/**
|
|
151
|
+
* Build an unsigned claim protocol rewards transaction.
|
|
152
|
+
*
|
|
153
|
+
* Claims the user's proportional share of protocol treasury rewards
|
|
154
|
+
* based on trading volume in the previous epoch. Requires >= 10 SOL volume.
|
|
155
|
+
*
|
|
156
|
+
* @param connection - Solana RPC connection
|
|
157
|
+
* @param params - Claim parameters (user, optional vault)
|
|
158
|
+
* @returns Unsigned transaction and descriptive message
|
|
159
|
+
*/
|
|
160
|
+
export declare const buildClaimProtocolRewardsTransaction: (connection: Connection, params: ClaimProtocolRewardsParams) => Promise<TransactionResult>;
|
|
161
|
+
/**
|
|
162
|
+
* Build an unsigned withdraw tokens transaction.
|
|
163
|
+
*
|
|
164
|
+
* Withdraw tokens from a vault ATA to any destination token account.
|
|
165
|
+
* Authority only. Composability escape hatch for external DeFi.
|
|
166
|
+
*
|
|
167
|
+
* @param connection - Solana RPC connection
|
|
168
|
+
* @param params - Authority, vault creator, mint, destination, amount in raw units
|
|
169
|
+
* @returns Unsigned transaction
|
|
170
|
+
*/
|
|
171
|
+
export declare const buildWithdrawTokensTransaction: (connection: Connection, params: WithdrawTokensParams) => Promise<TransactionResult>;
|
|
172
|
+
/**
|
|
173
|
+
* Build an unsigned vault-routed DEX swap transaction.
|
|
174
|
+
*
|
|
175
|
+
* Executes a Raydium CPMM swap through the vault PDA for migrated Torch tokens.
|
|
176
|
+
* Full custody preserved — all value flows through the vault.
|
|
177
|
+
*
|
|
178
|
+
* @param connection - Solana RPC connection
|
|
179
|
+
* @param params - Swap parameters (mint, signer, vault_creator, amount_in, minimum_amount_out, is_buy)
|
|
180
|
+
* @returns Unsigned transaction and descriptive message
|
|
181
|
+
*/
|
|
182
|
+
export declare const buildVaultSwapTransaction: (connection: Connection, params: VaultSwapParams) => Promise<TransactionResult>;
|
|
183
|
+
//# sourceMappingURL=transactions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"transactions.d.ts","sourceRoot":"","sources":["../src/transactions.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EACL,UAAU,EAOX,MAAM,iBAAiB,CAAA;AA6BxB,OAAO,EACL,SAAS,EACT,eAAe,EACf,UAAU,EACV,iBAAiB,EACjB,UAAU,EACV,YAAY,EACZ,WAAW,EACX,eAAe,EACf,0BAA0B,EAC1B,eAAe,EACf,iBAAiB,EACjB,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,EACpB,gBAAgB,EAChB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