@oobe-protocol-labs/sap-mcp-server 0.9.38 → 0.9.50
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/config/env.d.ts +19 -0
- package/dist/config/env.d.ts.map +1 -1
- package/dist/config/env.js +9 -2
- package/dist/config/env.js.map +1 -1
- package/dist/payments/monetization-gate.d.ts +5 -0
- package/dist/payments/monetization-gate.d.ts.map +1 -1
- package/dist/payments/monetization-gate.js +39 -2
- package/dist/payments/monetization-gate.js.map +1 -1
- package/dist/payments/prepaid-credit-store.d.ts +111 -0
- package/dist/payments/prepaid-credit-store.d.ts.map +1 -0
- package/dist/payments/prepaid-credit-store.js +230 -0
- package/dist/payments/prepaid-credit-store.js.map +1 -0
- package/dist/payments/pricing.d.ts.map +1 -1
- package/dist/payments/pricing.js +1 -0
- package/dist/payments/pricing.js.map +1 -1
- package/dist/payments/schema-validation.d.ts +52 -0
- package/dist/payments/schema-validation.d.ts.map +1 -0
- package/dist/payments/schema-validation.js +112 -0
- package/dist/payments/schema-validation.js.map +1 -0
- package/dist/payments/x402-paid-call.d.ts +21 -0
- package/dist/payments/x402-paid-call.d.ts.map +1 -1
- package/dist/payments/x402-paid-call.js +108 -3
- package/dist/payments/x402-paid-call.js.map +1 -1
- package/dist/perps/adrena/adrena-builder-commodity.d.ts +63 -0
- package/dist/perps/adrena/adrena-builder-commodity.d.ts.map +1 -0
- package/dist/perps/adrena/adrena-builder-commodity.js +200 -0
- package/dist/perps/adrena/adrena-builder-commodity.js.map +1 -0
- package/dist/perps/adrena/adrena-builder-core.d.ts +319 -0
- package/dist/perps/adrena/adrena-builder-core.d.ts.map +1 -0
- package/dist/perps/adrena/adrena-builder-core.js +517 -0
- package/dist/perps/adrena/adrena-builder-core.js.map +1 -0
- package/dist/perps/adrena/adrena-builder-liquidity.d.ts +50 -0
- package/dist/perps/adrena/adrena-builder-liquidity.d.ts.map +1 -0
- package/dist/perps/adrena/adrena-builder-liquidity.js +196 -0
- package/dist/perps/adrena/adrena-builder-liquidity.js.map +1 -0
- package/dist/perps/adrena/adrena-builder-staking.d.ts +57 -0
- package/dist/perps/adrena/adrena-builder-staking.d.ts.map +1 -0
- package/dist/perps/adrena/adrena-builder-staking.js +368 -0
- package/dist/perps/adrena/adrena-builder-staking.js.map +1 -0
- package/dist/perps/adrena/adrena-builder-trading.d.ts +160 -0
- package/dist/perps/adrena/adrena-builder-trading.d.ts.map +1 -0
- package/dist/perps/adrena/adrena-builder-trading.js +835 -0
- package/dist/perps/adrena/adrena-builder-trading.js.map +1 -0
- package/dist/perps/adrena/adrena-builder.d.ts +14 -293
- package/dist/perps/adrena/adrena-builder.d.ts.map +1 -1
- package/dist/perps/adrena/adrena-builder.js +14 -1140
- package/dist/perps/adrena/adrena-builder.js.map +1 -1
- package/dist/perps/adrena/adrena-constants.d.ts +33 -5
- package/dist/perps/adrena/adrena-constants.d.ts.map +1 -1
- package/dist/perps/adrena/adrena-constants.js +29 -7
- package/dist/perps/adrena/adrena-constants.js.map +1 -1
- package/dist/perps/adrena/adrena-idl.d.ts +15084 -0
- package/dist/perps/adrena/adrena-idl.d.ts.map +1 -0
- package/dist/perps/adrena/adrena-idl.js +29903 -0
- package/dist/perps/adrena/adrena-idl.js.map +1 -0
- package/dist/perps/adrena/adrena-pda.d.ts +5 -4
- package/dist/perps/adrena/adrena-pda.d.ts.map +1 -1
- package/dist/perps/adrena/adrena-pda.js +6 -10
- package/dist/perps/adrena/adrena-pda.js.map +1 -1
- package/dist/perps/adrena/index.d.ts +1 -0
- package/dist/perps/adrena/index.d.ts.map +1 -1
- package/dist/perps/adrena/index.js +1 -0
- package/dist/perps/adrena/index.js.map +1 -1
- package/dist/perps/chart-indicators.d.ts +27 -0
- package/dist/perps/chart-indicators.d.ts.map +1 -0
- package/dist/perps/chart-indicators.js +345 -0
- package/dist/perps/chart-indicators.js.map +1 -0
- package/dist/perps/chart-tools.d.ts +45 -0
- package/dist/perps/chart-tools.d.ts.map +1 -0
- package/dist/perps/chart-tools.js +341 -0
- package/dist/perps/chart-tools.js.map +1 -0
- package/dist/perps/perp-analytics-tools.d.ts +20 -0
- package/dist/perps/perp-analytics-tools.d.ts.map +1 -0
- package/dist/perps/perp-analytics-tools.js +868 -0
- package/dist/perps/perp-analytics-tools.js.map +1 -0
- package/dist/perps/perp-constants.d.ts +362 -0
- package/dist/perps/perp-constants.d.ts.map +1 -0
- package/dist/perps/perp-constants.js +210 -0
- package/dist/perps/perp-constants.js.map +1 -0
- package/dist/perps/perp-decoders.d.ts +47 -0
- package/dist/perps/perp-decoders.d.ts.map +1 -0
- package/dist/perps/perp-decoders.js +332 -0
- package/dist/perps/perp-decoders.js.map +1 -0
- package/dist/policy/policy-engine.d.ts +42 -0
- package/dist/policy/policy-engine.d.ts.map +1 -1
- package/dist/policy/policy-engine.js +43 -0
- package/dist/policy/policy-engine.js.map +1 -1
- package/dist/premium/activation-manager.d.ts.map +1 -1
- package/dist/premium/activation-manager.js +20 -2
- package/dist/premium/activation-manager.js.map +1 -1
- package/dist/prompts/context/sap-agent-context.prompt.js +15 -1
- package/dist/prompts/context/sap-agent-context.prompt.js.map +1 -1
- package/dist/server/server-metadata.d.ts +13 -0
- package/dist/server/server-metadata.d.ts.map +1 -1
- package/dist/server/server-metadata.js +15 -2
- package/dist/server/server-metadata.js.map +1 -1
- package/dist/solana/ata-utils.d.ts +39 -0
- package/dist/solana/ata-utils.d.ts.map +1 -0
- package/dist/solana/ata-utils.js +49 -0
- package/dist/solana/ata-utils.js.map +1 -0
- package/dist/strategies/trade-journal.d.ts +78 -0
- package/dist/strategies/trade-journal.d.ts.map +1 -0
- package/dist/strategies/trade-journal.js +92 -0
- package/dist/strategies/trade-journal.js.map +1 -0
- package/dist/tools/adrena/adrena-commodity-tools.d.ts +15 -0
- package/dist/tools/adrena/adrena-commodity-tools.d.ts.map +1 -0
- package/dist/tools/adrena/adrena-commodity-tools.js +137 -0
- package/dist/tools/adrena/adrena-commodity-tools.js.map +1 -0
- package/dist/tools/adrena/adrena-data-tools.d.ts +23 -0
- package/dist/tools/adrena/adrena-data-tools.d.ts.map +1 -0
- package/dist/tools/adrena/adrena-data-tools.js +437 -0
- package/dist/tools/adrena/adrena-data-tools.js.map +1 -0
- package/dist/tools/adrena/adrena-helpers.d.ts +46 -0
- package/dist/tools/adrena/adrena-helpers.d.ts.map +1 -0
- package/dist/tools/adrena/adrena-helpers.js +41 -0
- package/dist/tools/adrena/adrena-helpers.js.map +1 -0
- package/dist/tools/adrena/adrena-index.d.ts +20 -0
- package/dist/tools/adrena/adrena-index.d.ts.map +1 -0
- package/dist/tools/adrena/adrena-index.js +75 -0
- package/dist/tools/adrena/adrena-index.js.map +1 -0
- package/dist/tools/adrena/adrena-limit-order-tools.d.ts +22 -0
- package/dist/tools/adrena/adrena-limit-order-tools.d.ts.map +1 -0
- package/dist/tools/adrena/adrena-limit-order-tools.js +91 -0
- package/dist/tools/adrena/adrena-limit-order-tools.js.map +1 -0
- package/dist/tools/adrena/adrena-liquidity-tools.d.ts +15 -0
- package/dist/tools/adrena/adrena-liquidity-tools.d.ts.map +1 -0
- package/dist/tools/adrena/adrena-liquidity-tools.js +108 -0
- package/dist/tools/adrena/adrena-liquidity-tools.js.map +1 -0
- package/dist/tools/adrena/adrena-snapshot-tools.d.ts +42 -0
- package/dist/tools/adrena/adrena-snapshot-tools.d.ts.map +1 -0
- package/dist/tools/adrena/adrena-snapshot-tools.js +124 -0
- package/dist/tools/adrena/adrena-snapshot-tools.js.map +1 -0
- package/dist/tools/adrena/adrena-staking-tools.d.ts +15 -0
- package/dist/tools/adrena/adrena-staking-tools.d.ts.map +1 -0
- package/dist/tools/adrena/adrena-staking-tools.js +139 -0
- package/dist/tools/adrena/adrena-staking-tools.js.map +1 -0
- package/dist/tools/adrena/adrena-trading-tools.d.ts +78 -0
- package/dist/tools/adrena/adrena-trading-tools.d.ts.map +1 -0
- package/dist/tools/adrena/adrena-trading-tools.js +556 -0
- package/dist/tools/adrena/adrena-trading-tools.js.map +1 -0
- package/dist/tools/adrena-tools.d.ts +1 -66
- package/dist/tools/adrena-tools.d.ts.map +1 -1
- package/dist/tools/adrena-tools.js +1 -1061
- package/dist/tools/adrena-tools.js.map +1 -1
- package/dist/tools/client-sdk-tools.js +1 -1
- package/dist/tools/client-sdk-tools.js.map +1 -1
- package/dist/tools/memory-tools.d.ts.map +1 -1
- package/dist/tools/memory-tools.js +170 -0
- package/dist/tools/memory-tools.js.map +1 -1
- package/dist/tools/perp-tools.d.ts +6 -174
- package/dist/tools/perp-tools.d.ts.map +1 -1
- package/dist/tools/perp-tools.js +6 -1716
- package/dist/tools/perp-tools.js.map +1 -1
- package/dist/tools/premium-tools.d.ts.map +1 -1
- package/dist/tools/premium-tools.js +123 -5
- package/dist/tools/premium-tools.js.map +1 -1
- package/dist/tools/transaction-tools.d.ts +21 -1
- package/dist/tools/transaction-tools.d.ts.map +1 -1
- package/dist/tools/transaction-tools.js +114 -30
- package/dist/tools/transaction-tools.js.map +1 -1
- package/dist/tools/x402-paid-call-tool.d.ts.map +1 -1
- package/dist/tools/x402-paid-call-tool.js +288 -0
- package/dist/tools/x402-paid-call-tool.js.map +1 -1
- package/package.json +3 -2
- package/server.json +3 -3
|
@@ -0,0 +1,200 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name perps/adrena/adrena-builder-commodity
|
|
3
|
+
* @description Commodity (synthetic perps) builders for the Adrena perps protocol.
|
|
4
|
+
*
|
|
5
|
+
* Contains builders for opening/closing long and short commodity positions
|
|
6
|
+
* (XAU, XAG, WTI) using the commodities pool, plus internal shared builders
|
|
7
|
+
* for pool-agnostic operations.
|
|
8
|
+
*
|
|
9
|
+
* @module perps/adrena/adrena-builder-commodity
|
|
10
|
+
*/
|
|
11
|
+
import { PublicKey, } from '@solana/web3.js';
|
|
12
|
+
import { ADRENA_CUSTODIES, ADRENA_PROGRAM_ID, TOKEN_PROGRAM_ID, SYSTEM_PROGRAM_ID, } from './adrena-constants.js';
|
|
13
|
+
import { deriveCortexPda, deriveOraclePda, deriveTransferAuthorityPda, deriveUserProfilePda, derivePositionPda, deriveAta, } from './adrena-pda.js';
|
|
14
|
+
import { toBN, toBNOrNull, getPoolPublicKey, getCustodyPublicKey, getMintPublicKey, fetchOraclePrice, readCustodyTokenAccount, getWalletTokenBalances, checkSufficientBalance, ensureUserProfileInstructions, ensureAtaInstructions, createAdrenaProgram, buildInstruction, serializeUnsignedTx, buildResult, } from './adrena-builder-core.js';
|
|
15
|
+
// ─── Commodity Builders (synthetic perps) ──────────────────────────────────────
|
|
16
|
+
/**
|
|
17
|
+
* @name buildOpenCommodityLong
|
|
18
|
+
* @description Build an unsigned transaction to open a long position on a commodity (XAU, XAG, WTI).
|
|
19
|
+
* Uses the commodities pool.
|
|
20
|
+
*
|
|
21
|
+
* @param connection — Solana RPC connection.
|
|
22
|
+
* @param owner — Position owner and fee payer.
|
|
23
|
+
* @param principalToken — Commodity symbol (XAU, XAG, WTI).
|
|
24
|
+
* @param collateralAmount — USDC collateral amount in human-readable units.
|
|
25
|
+
* @param leverage — Leverage multiplier.
|
|
26
|
+
* @param price — Price in USD (scaled by 10^10), or null for market order.
|
|
27
|
+
* @returns Unsigned transaction result.
|
|
28
|
+
*/
|
|
29
|
+
export async function buildOpenCommodityLong(connection, owner, principalToken, collateralAmount, leverage, price) {
|
|
30
|
+
return buildOpenPositionLongInternal(connection, owner, principalToken, 'USDC', collateralAmount, leverage, price, 'commodities-pool', 'openOrIncreasePositionLong', 'long');
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @name buildOpenCommodityShort
|
|
34
|
+
* @description Build an unsigned transaction to open a short position on a commodity.
|
|
35
|
+
* Uses the commodities pool.
|
|
36
|
+
*
|
|
37
|
+
* @param connection — Solana RPC connection.
|
|
38
|
+
* @param owner — Position owner and fee payer.
|
|
39
|
+
* @param principalToken — Commodity symbol (XAU, XAG, WTI).
|
|
40
|
+
* @param collateralAmount — USDC collateral amount in human-readable units.
|
|
41
|
+
* @param leverage — Leverage multiplier.
|
|
42
|
+
* @param price — Price in USD (scaled by 10^10), or null for market order.
|
|
43
|
+
* @returns Unsigned transaction result.
|
|
44
|
+
*/
|
|
45
|
+
export async function buildOpenCommodityShort(connection, owner, principalToken, collateralAmount, leverage, price) {
|
|
46
|
+
return buildOpenPositionLongInternal(connection, owner, principalToken, 'USDC', collateralAmount, leverage, price, 'commodities-pool', 'openOrIncreasePositionShort', 'short');
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* @name buildCloseCommodityLong
|
|
50
|
+
* @description Build an unsigned transaction to close a long commodity position.
|
|
51
|
+
* @param connection — Solana RPC connection.
|
|
52
|
+
* @param owner — Position owner and fee payer.
|
|
53
|
+
* @param principalToken — Commodity symbol.
|
|
54
|
+
* @param price — Optional close price.
|
|
55
|
+
* @param percentage — Percentage to close.
|
|
56
|
+
* @returns Unsigned transaction result.
|
|
57
|
+
*/
|
|
58
|
+
export async function buildCloseCommodityLong(connection, owner, principalToken, price, percentage = 1000000n) {
|
|
59
|
+
return buildClosePositionLongInternal(connection, owner, principalToken, 'USDC', price, percentage, 'commodities-pool', 'closePositionLong', 'long');
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* @name buildCloseCommodityShort
|
|
63
|
+
* @description Build an unsigned transaction to close a short commodity position.
|
|
64
|
+
* @param connection — Solana RPC connection.
|
|
65
|
+
* @param owner — Position owner and fee payer.
|
|
66
|
+
* @param principalToken — Commodity symbol.
|
|
67
|
+
* @param price — Optional close price.
|
|
68
|
+
* @param percentage — Percentage to close.
|
|
69
|
+
* @returns Unsigned transaction result.
|
|
70
|
+
*/
|
|
71
|
+
export async function buildCloseCommodityShort(connection, owner, principalToken, price, percentage = 1000000n) {
|
|
72
|
+
return buildClosePositionLongInternal(connection, owner, principalToken, 'USDC', price, percentage, 'commodities-pool', 'closePositionShort', 'short');
|
|
73
|
+
}
|
|
74
|
+
// ─── Internal shared builders for pool-agnostic operations ──────────────────────
|
|
75
|
+
async function buildOpenPositionLongInternal(connection, owner, principalToken, collateralToken, collateralAmount, leverage, price, poolName, ixName, side) {
|
|
76
|
+
const program = createAdrenaProgram(connection);
|
|
77
|
+
const pool = getPoolPublicKey(poolName);
|
|
78
|
+
const custody = getCustodyPublicKey(principalToken, poolName);
|
|
79
|
+
const collateralCustody = getCustodyPublicKey(collateralToken, poolName);
|
|
80
|
+
const cortex = deriveCortexPda();
|
|
81
|
+
const oracle = deriveOraclePda();
|
|
82
|
+
const transferAuthority = deriveTransferAuthorityPda();
|
|
83
|
+
const userProfile = deriveUserProfilePda(owner);
|
|
84
|
+
const position = derivePositionPda(owner, pool, custody, side);
|
|
85
|
+
const collateralCustodyTokenAccount = await readCustodyTokenAccount(connection, collateralCustody);
|
|
86
|
+
const fundingAccount = deriveAta(owner, getMintPublicKey(collateralToken));
|
|
87
|
+
const referrerProfile = null;
|
|
88
|
+
const collateralRaw = BigInt(Math.floor(collateralAmount * Math.pow(10, ADRENA_CUSTODIES[collateralToken.toUpperCase()].decimals)));
|
|
89
|
+
const priceRaw = price ?? await fetchOraclePrice(principalToken, side);
|
|
90
|
+
// Ensure the funding ATA exists before the Adrena instruction.
|
|
91
|
+
const collateralMint = getMintPublicKey(collateralToken);
|
|
92
|
+
const preInstructions = await ensureAtaInstructions(connection, owner, collateralMint, owner);
|
|
93
|
+
// Ensure user profile exists — Adrena requires it before opening positions.
|
|
94
|
+
const profileInstructions = await ensureUserProfileInstructions(connection, owner);
|
|
95
|
+
const allPreInstructions = [...preInstructions, ...profileInstructions];
|
|
96
|
+
// Leverage is passed as BPS (basis points) to Adrena: 3x = 30000 BPS.
|
|
97
|
+
const leverageBps = Math.floor(leverage * 10000);
|
|
98
|
+
const ix = await buildInstruction(program, ixName, [
|
|
99
|
+
{
|
|
100
|
+
price: toBN(priceRaw),
|
|
101
|
+
collateral: toBN(collateralRaw),
|
|
102
|
+
leverage: leverageBps,
|
|
103
|
+
oraclePrices: null,
|
|
104
|
+
multiOraclePrices: null,
|
|
105
|
+
},
|
|
106
|
+
], {
|
|
107
|
+
owner,
|
|
108
|
+
payer: owner,
|
|
109
|
+
fundingAccount,
|
|
110
|
+
oracle,
|
|
111
|
+
custody,
|
|
112
|
+
collateralCustody,
|
|
113
|
+
collateralCustodyTokenAccount,
|
|
114
|
+
transferAuthority,
|
|
115
|
+
cortex,
|
|
116
|
+
pool,
|
|
117
|
+
position,
|
|
118
|
+
systemProgram: new PublicKey(SYSTEM_PROGRAM_ID),
|
|
119
|
+
tokenProgram: new PublicKey(TOKEN_PROGRAM_ID),
|
|
120
|
+
adrenaProgram: new PublicKey(ADRENA_PROGRAM_ID),
|
|
121
|
+
userProfile,
|
|
122
|
+
referrerProfile,
|
|
123
|
+
});
|
|
124
|
+
const _serializeResult = await serializeUnsignedTx(connection, owner, [...allPreInstructions, ix]);
|
|
125
|
+
const transactionBase64 = _serializeResult.transactionBase64;
|
|
126
|
+
// Pre-flight balance check (commodity positions use USDC collateral).
|
|
127
|
+
const balanceCheck = await checkSufficientBalance(connection, owner, collateralToken, collateralAmount);
|
|
128
|
+
const warning = !balanceCheck.sufficient
|
|
129
|
+
? `Insufficient ${collateralToken.toUpperCase()} balance: need ${collateralAmount}, have ${balanceCheck.availableBalance} (shortfall: ${balanceCheck.shortfall}). The transaction will fail on-chain.`
|
|
130
|
+
: !balanceCheck.solSufficientForFees
|
|
131
|
+
? `Insufficient SOL for transaction fees: have ${balanceCheck.solBalance} SOL, need ~0.005 SOL.`
|
|
132
|
+
: undefined;
|
|
133
|
+
return buildResult(transactionBase64, owner, [ixName], position, balanceCheck, warning);
|
|
134
|
+
}
|
|
135
|
+
async function buildClosePositionLongInternal(connection, owner, principalToken, collateralToken, price, percentage, poolName, ixName, side) {
|
|
136
|
+
const program = createAdrenaProgram(connection);
|
|
137
|
+
const pool = getPoolPublicKey(poolName);
|
|
138
|
+
const custody = getCustodyPublicKey(principalToken, poolName);
|
|
139
|
+
const collateralCustody = getCustodyPublicKey(collateralToken, poolName);
|
|
140
|
+
const cortex = deriveCortexPda();
|
|
141
|
+
const oracle = deriveOraclePda();
|
|
142
|
+
const transferAuthority = deriveTransferAuthorityPda();
|
|
143
|
+
const userProfile = deriveUserProfilePda(owner);
|
|
144
|
+
const position = derivePositionPda(owner, pool, custody, side);
|
|
145
|
+
const collateralCustodyTokenAccount = await readCustodyTokenAccount(connection, collateralCustody);
|
|
146
|
+
const receivingAccount = deriveAta(owner, getMintPublicKey(collateralToken));
|
|
147
|
+
const referrerProfile = null;
|
|
148
|
+
// Ensure the receiving ATA exists before closing.
|
|
149
|
+
const receivingMint = getMintPublicKey(collateralToken);
|
|
150
|
+
const preInstructions = await ensureAtaInstructions(connection, owner, receivingMint, owner);
|
|
151
|
+
// Ensure user profile exists — Adrena requires it for position operations.
|
|
152
|
+
const profileInstructions = await ensureUserProfileInstructions(connection, owner);
|
|
153
|
+
const allPreInstructions = [...preInstructions, ...profileInstructions];
|
|
154
|
+
const ix = await buildInstruction(program, ixName, [
|
|
155
|
+
{
|
|
156
|
+
price: toBNOrNull(price),
|
|
157
|
+
oraclePrices: null,
|
|
158
|
+
multiOraclePrices: null,
|
|
159
|
+
percentage: toBN(percentage),
|
|
160
|
+
},
|
|
161
|
+
], {
|
|
162
|
+
caller: owner,
|
|
163
|
+
owner,
|
|
164
|
+
receivingAccount,
|
|
165
|
+
transferAuthority,
|
|
166
|
+
cortex,
|
|
167
|
+
pool,
|
|
168
|
+
position,
|
|
169
|
+
custody,
|
|
170
|
+
oracle,
|
|
171
|
+
collateralCustody,
|
|
172
|
+
collateralCustodyTokenAccount,
|
|
173
|
+
userProfile,
|
|
174
|
+
referrerProfile,
|
|
175
|
+
tokenProgram: new PublicKey(TOKEN_PROGRAM_ID),
|
|
176
|
+
adrenaProgram: new PublicKey(ADRENA_PROGRAM_ID),
|
|
177
|
+
systemProgram: new PublicKey(SYSTEM_PROGRAM_ID),
|
|
178
|
+
});
|
|
179
|
+
const _serializeResult = await serializeUnsignedTx(connection, owner, [...allPreInstructions, ix]);
|
|
180
|
+
const transactionBase64 = _serializeResult.transactionBase64;
|
|
181
|
+
// Pre-flight: show balances and check SOL for fees (close returns tokens, doesn't require collateral).
|
|
182
|
+
const balances = await getWalletTokenBalances(connection, owner);
|
|
183
|
+
const solBalance = balances.find(b => b.symbol === 'SOL')?.balance ?? 0;
|
|
184
|
+
const warning = solBalance < 0.005
|
|
185
|
+
? `Insufficient SOL for transaction fees: have ${solBalance} SOL, need ~0.005 SOL.`
|
|
186
|
+
: undefined;
|
|
187
|
+
const balanceCheck = {
|
|
188
|
+
wallet: owner.toBase58(),
|
|
189
|
+
balances,
|
|
190
|
+
requiredToken: 'NONE',
|
|
191
|
+
requiredAmount: 0,
|
|
192
|
+
availableBalance: 0,
|
|
193
|
+
sufficient: true,
|
|
194
|
+
shortfall: 0,
|
|
195
|
+
solBalance,
|
|
196
|
+
solSufficientForFees: solBalance >= 0.005,
|
|
197
|
+
};
|
|
198
|
+
return buildResult(transactionBase64, owner, [ixName], position, balanceCheck, warning);
|
|
199
|
+
}
|
|
200
|
+
//# sourceMappingURL=adrena-builder-commodity.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adrena-builder-commodity.js","sourceRoot":"","sources":["../../../src/perps/adrena/adrena-builder-commodity.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,SAAS,GAEV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,gBAAgB,EAChB,iBAAiB,EACjB,gBAAgB,EAChB,iBAAiB,GAClB,MAAM,uBAAuB,CAAC;AAC/B,OAAO,EACL,eAAe,EACf,eAAe,EACf,0BAA0B,EAC1B,oBAAoB,EACpB,iBAAiB,EACjB,SAAS,GACV,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAKL,IAAI,EACJ,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,gBAAgB,EAChB,gBAAgB,EAChB,uBAAuB,EACvB,sBAAsB,EACtB,sBAAsB,EACtB,6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K,EAAE,CAAC,GAAG,kBAAkB,EAAE,EAAE,CAAC,CAAC,CAAC;IACnG,MAAM,iBAAiB,GAAG,gBAAgB,CAAC,iBAAiB,CAAC;IAE7D,uGAAuG;IACvG,MAAM,QAAQ,GAAG,MAAM,sBAAsB,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC;IACjE,MAAM,UAAU,GAAG,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,KAAK,CAAC,EAAE,OAAO,IAAI,CAAC,CAAC;IACxE,MAAM,OAAO,GAAG,UAAU,GAAG,KAAK;QAChC,CAAC,CAAC,+CAA+C,UAAU,wBAAwB;QACnF,CAAC,CAAC,SAAS,CAAC;IACd,MAAM,YAAY,GAAiB;QACjC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE;QACxB,QAAQ;QACR,aAAa,EAAE,MAAM;QACrB,cAAc,EAAE,CAAC;QACjB,gBAAgB,EAAE,CAAC;QACnB,UAAU,EAAE,IAAI;QAChB,SAAS,EAAE,CAAC;QACZ,UAAU;QACV,oBAAoB,EAAE,UAAU,IAAI,KAAK;KAC1C,CAAC;IAEF,OAAO,WAAW,CAAC,iBAAiB,EAAE,KAAK,EAAE,CAAC,MAAM,CAAC,EAAE,QAAQ,EAAE,YAAY,EAAE,OAAO,CAAC,CAAC;AAC1F,CAAC"}
|
|
@@ -0,0 +1,319 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @name perps/adrena/adrena-builder-core
|
|
3
|
+
* @description Shared types, helpers, and utilities for Adrena perps builders.
|
|
4
|
+
*
|
|
5
|
+
* This module contains the common infrastructure used by all builder modules:
|
|
6
|
+
* types (PositionSide, AdrenaPool, TokenBalance, BalanceCheck, UnsignedTransactionResult),
|
|
7
|
+
* IDL loading, and all helper functions.
|
|
8
|
+
*
|
|
9
|
+
* @module perps/adrena/adrena-builder-core
|
|
10
|
+
*/
|
|
11
|
+
import { PublicKey, TransactionInstruction, Connection } from '@solana/web3.js';
|
|
12
|
+
import { Program } from '@coral-xyz/anchor';
|
|
13
|
+
import BN from 'bn.js';
|
|
14
|
+
/** Side of a perp position. */
|
|
15
|
+
export type PositionSide = 'long' | 'short';
|
|
16
|
+
/** Pool identifier. */
|
|
17
|
+
export type AdrenaPool = 'main-pool' | 'commodities-pool';
|
|
18
|
+
/**
|
|
19
|
+
* Token balance for a single token in the owner's wallet.
|
|
20
|
+
* All amounts are in human-readable units (e.g. 1.5 USDC = 1.5).
|
|
21
|
+
*/
|
|
22
|
+
export interface TokenBalance {
|
|
23
|
+
/** Token symbol (USDC, JITOSOL, WBTC, BONK, SOL). */
|
|
24
|
+
symbol: string;
|
|
25
|
+
/** Mint address. */
|
|
26
|
+
mint: string;
|
|
27
|
+
/** Human-readable balance (adjusted for decimals). */
|
|
28
|
+
balance: number;
|
|
29
|
+
/** Raw bigint balance (lamports/atoms). */
|
|
30
|
+
balanceRaw: string;
|
|
31
|
+
/** Token decimals. */
|
|
32
|
+
decimals: number;
|
|
33
|
+
/** ATA address (empty string if SOL). */
|
|
34
|
+
ata: string;
|
|
35
|
+
/** Whether the ATA exists on-chain. */
|
|
36
|
+
ataExists: boolean;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Pre-flight balance check result. Returned alongside the unsigned transaction
|
|
40
|
+
* so the agent/user can see exactly what token balances are available and
|
|
41
|
+
* whether the requested operation will succeed on-chain.
|
|
42
|
+
*/
|
|
43
|
+
export interface BalanceCheck {
|
|
44
|
+
/** Wallet address that was checked. */
|
|
45
|
+
wallet: string;
|
|
46
|
+
/** All token balances fetched (USDC, JITOSOL, WBTC, BONK, SOL). */
|
|
47
|
+
balances: TokenBalance[];
|
|
48
|
+
/** The token symbol required as collateral/funding for this operation. */
|
|
49
|
+
requiredToken: string;
|
|
50
|
+
/** Human-readable amount required. */
|
|
51
|
+
requiredAmount: number;
|
|
52
|
+
/** Human-readable balance available. */
|
|
53
|
+
availableBalance: number;
|
|
54
|
+
/** True if available >= required. */
|
|
55
|
+
sufficient: boolean;
|
|
56
|
+
/** Human-readable shortfall (0 if sufficient). */
|
|
57
|
+
shortfall: number;
|
|
58
|
+
/** SOL balance for gas/fees. */
|
|
59
|
+
solBalance: number;
|
|
60
|
+
/** True if SOL balance is enough for transaction fees (~0.005 SOL minimum). */
|
|
61
|
+
solSufficientForFees: boolean;
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Pool/custody metadata read from the on-chain custody account.
|
|
65
|
+
* Included in UnsignedTransactionResult for open-position builders so the
|
|
66
|
+
* agent/user can see leverage limits and open interest before signing.
|
|
67
|
+
*/
|
|
68
|
+
export interface PoolMetadata {
|
|
69
|
+
/** Maximum initial leverage for new positions (human-readable, e.g. 100 = 100x). */
|
|
70
|
+
maxInitialLeverage: number;
|
|
71
|
+
/** Maximum leverage after position is open (human-readable, e.g. 150 = 150x). */
|
|
72
|
+
maxLeverage: number;
|
|
73
|
+
/** Maximum position size locked in USD (human-readable). */
|
|
74
|
+
maxPositionLockedUsd: number;
|
|
75
|
+
/** Current open interest on the long side in USD (human-readable). */
|
|
76
|
+
openInterestLongUsd: number;
|
|
77
|
+
/** Current open interest on the short side in USD (human-readable). */
|
|
78
|
+
openInterestShortUsd: number;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Result of simulating a position open without building or serializing a transaction.
|
|
82
|
+
* Free dry-run — no x402 charge, no transaction bytes returned.
|
|
83
|
+
*/
|
|
84
|
+
export interface SimulatePositionResult {
|
|
85
|
+
/** Program simulation logs from the Adrena instruction. */
|
|
86
|
+
simulationLogs: string[];
|
|
87
|
+
/** Simulation error string if the transaction would fail on-chain. */
|
|
88
|
+
simulationError?: string;
|
|
89
|
+
/** Compute units consumed by the simulated instructions. */
|
|
90
|
+
unitsConsumed?: number;
|
|
91
|
+
/** True if the simulation succeeded (no error in simulation). */
|
|
92
|
+
wouldSucceed: boolean;
|
|
93
|
+
/** Pre-flight balance check for the collateral token. */
|
|
94
|
+
balanceCheck: BalanceCheck;
|
|
95
|
+
}
|
|
96
|
+
/** Result of building an unsigned transaction. */
|
|
97
|
+
export interface UnsignedTransactionResult {
|
|
98
|
+
/** Base64-serialized unsigned transaction. */
|
|
99
|
+
transactionBase64: string;
|
|
100
|
+
/** Transaction encoding. */
|
|
101
|
+
encoding: 'base64';
|
|
102
|
+
/** Fee payer public key. */
|
|
103
|
+
feePayer: string;
|
|
104
|
+
/** Description of the instructions included. */
|
|
105
|
+
instructions: string[];
|
|
106
|
+
/** The position PDA if relevant. */
|
|
107
|
+
positionAddress?: string;
|
|
108
|
+
/** Next tool to call for signing. */
|
|
109
|
+
nextTool: 'sap_payments_finalize_transaction';
|
|
110
|
+
/** Arguments to pass to the finalize tool. */
|
|
111
|
+
finalizeArgs: {
|
|
112
|
+
transactionBase64: string;
|
|
113
|
+
submit: boolean;
|
|
114
|
+
};
|
|
115
|
+
/** Pre-flight balance check (present when the builder performed one). */
|
|
116
|
+
balanceCheck?: BalanceCheck;
|
|
117
|
+
/** Pool/custody metadata (present for open-position builders). */
|
|
118
|
+
poolMetadata?: PoolMetadata;
|
|
119
|
+
/** Warning message if balance is insufficient or other pre-flight concern. */
|
|
120
|
+
warning?: string;
|
|
121
|
+
/** Pre-submit simulation logs from the builder (when available). */
|
|
122
|
+
simulationLogs?: string[];
|
|
123
|
+
/** Pre-submit simulation error (when simulation fails). */
|
|
124
|
+
simulationError?: string;
|
|
125
|
+
/** Compute units consumed (from simulation). */
|
|
126
|
+
simulationUnitsConsumed?: number;
|
|
127
|
+
/** Priority fee in micro-lamports applied to this transaction (0 = none). */
|
|
128
|
+
priorityFeeMicroLamports?: number;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Convert a bigint to a BN instance for Anchor instruction encoding.
|
|
132
|
+
* Anchor 0.30.x uses @coral-xyz/borsh which requires BN, not native BigInt.
|
|
133
|
+
* @param value — bigint value.
|
|
134
|
+
* @returns BN instance.
|
|
135
|
+
*/
|
|
136
|
+
export declare function toBN(value: bigint): BN;
|
|
137
|
+
/**
|
|
138
|
+
* Convert a bigint or null to a BN or null for optional Anchor fields.
|
|
139
|
+
* @param value — bigint or null.
|
|
140
|
+
* @returns BN instance or null.
|
|
141
|
+
*/
|
|
142
|
+
export declare function toBNOrNull(value: bigint | null): BN | null;
|
|
143
|
+
/**
|
|
144
|
+
* Get pool public key by name.
|
|
145
|
+
* @param poolName — Pool identifier.
|
|
146
|
+
* @returns Pool public key.
|
|
147
|
+
*/
|
|
148
|
+
export declare function getPoolPublicKey(poolName: AdrenaPool): PublicKey;
|
|
149
|
+
/**
|
|
150
|
+
* Get custody public key by symbol.
|
|
151
|
+
* @param symbol — Token symbol (e.g. "JITOSOL", "USDC").
|
|
152
|
+
* @param poolName — Pool identifier.
|
|
153
|
+
* @returns Custody public key.
|
|
154
|
+
*/
|
|
155
|
+
export declare function getCustodyPublicKey(symbol: string, poolName?: AdrenaPool): PublicKey;
|
|
156
|
+
/**
|
|
157
|
+
* Get token mint by symbol.
|
|
158
|
+
* @param symbol — Token symbol.
|
|
159
|
+
* @returns Mint public key.
|
|
160
|
+
*/
|
|
161
|
+
export declare function getMintPublicKey(symbol: string): PublicKey;
|
|
162
|
+
/**
|
|
163
|
+
* Build a CreateAssociatedTokenAccountIdempotent instruction using @solana/spl-token.
|
|
164
|
+
* This instruction creates the ATA if it doesn't exist, and is a no-op if it does.
|
|
165
|
+
*
|
|
166
|
+
* @param owner — Wallet public key that will own the ATA.
|
|
167
|
+
* @param mint — Token mint public key.
|
|
168
|
+
* @param payer — Fee payer public key (usually the owner).
|
|
169
|
+
* @returns TransactionInstruction for CreateAssociatedTokenAccountIdempotent.
|
|
170
|
+
*/
|
|
171
|
+
export declare function createAtaIdempotentIx(owner: PublicKey, mint: PublicKey, payer: PublicKey): TransactionInstruction;
|
|
172
|
+
/**
|
|
173
|
+
* Fetch the current USD price for a token from the Adrena Data API.
|
|
174
|
+
* Uses the same format as the Adrena SDK's DataApiClient.getLatestPrices():
|
|
175
|
+
* GET https://datapi.adrena.trade/last-trading-prices
|
|
176
|
+
* Response: { data: { autonom: { prices: [{ symbol, price, exponent }] } } }
|
|
177
|
+
*
|
|
178
|
+
* The price is a string at 10-decimal precision; adjust by exponent to get USD float.
|
|
179
|
+
* Returns the price as a BigInt scaled by 10^10 (PRICE_DECIMALS).
|
|
180
|
+
*
|
|
181
|
+
* @param principalToken — Token symbol (SOL, BONK, BTC, etc.)
|
|
182
|
+
* JITOSOL maps to SOL (same as the SDK).
|
|
183
|
+
* @returns Price as BigInt scaled by 10^10, or BigInt(0) if fetch fails.
|
|
184
|
+
*/
|
|
185
|
+
export declare function fetchOraclePrice(principalToken: string, side?: 'long' | 'short'): Promise<bigint>;
|
|
186
|
+
/**
|
|
187
|
+
* Read the collateral custody token account address from the on-chain custody account.
|
|
188
|
+
* The custody account stores the tokenAccount at byte offset 80 (after the 8-byte
|
|
189
|
+
* Anchor discriminator + 2 boolean flags + 1 decimal byte + 5 padding + 32 pool).
|
|
190
|
+
*
|
|
191
|
+
* This is more reliable than PDA derivation because the seed layout may differ
|
|
192
|
+
* from what the IDL declares.
|
|
193
|
+
*
|
|
194
|
+
* @param connection — Solana RPC connection.
|
|
195
|
+
* @param custodyAddress — The custody PDA public key.
|
|
196
|
+
* @returns The token account public key stored in the custody account.
|
|
197
|
+
*/
|
|
198
|
+
export declare function readCustodyTokenAccount(connection: Connection, custodyAddress: PublicKey): Promise<PublicKey>;
|
|
199
|
+
/**
|
|
200
|
+
* Read pool/custody metadata from the on-chain custody account.
|
|
201
|
+
*
|
|
202
|
+
* Fields and their byte offsets (all little-endian):
|
|
203
|
+
* - maxInitialLeverage: u32 at offset 176 (in BPS, 1000000 = 100x)
|
|
204
|
+
* - maxLeverage: u32 at offset 180 (in BPS, 1000000 = 100x)
|
|
205
|
+
* - maxPositionLockedUsd: u128 at offset 184 (scaled by 1e6)
|
|
206
|
+
* - openInterestLongUsd: u128 at offset 408 (scaled by 1e6)
|
|
207
|
+
* - openInterestShortUsd: u128 at offset 608 (scaled by 1e6)
|
|
208
|
+
*
|
|
209
|
+
* Leverage values are divided by 10000 for human-readable form.
|
|
210
|
+
* USD values are divided by 1e6 for human-readable form.
|
|
211
|
+
*
|
|
212
|
+
* @param connection — Solana RPC connection.
|
|
213
|
+
* @param custodyAddress — The custody PDA public key.
|
|
214
|
+
* @returns PoolMetadata with human-readable values.
|
|
215
|
+
*/
|
|
216
|
+
export declare function readCustodyMetadata(connection: Connection, custodyAddress: PublicKey): Promise<PoolMetadata>;
|
|
217
|
+
/**
|
|
218
|
+
* Validate that the requested leverage does not exceed the custody's
|
|
219
|
+
* maxInitialLeverage. Throws a clear error if it does.
|
|
220
|
+
*
|
|
221
|
+
* @param leverage — Requested leverage (human-readable, e.g. 3 = 3x).
|
|
222
|
+
* @param maxInitialLeverageBps — Max initial leverage in BPS (e.g. 1000000 = 100x).
|
|
223
|
+
* @param principalToken — Token symbol for the error message.
|
|
224
|
+
*/
|
|
225
|
+
export declare function validateLeverage(leverage: number, maxInitialLeverageBps: number, principalToken: string): void;
|
|
226
|
+
/**
|
|
227
|
+
* Fetch all Adrena-relevant token balances for a wallet: USDC, JITOSOL, WBTC, BONK, and SOL.
|
|
228
|
+
*
|
|
229
|
+
* For SPL tokens, reads the Associated Token Account (ATA) balance via
|
|
230
|
+
* `connection.getParsedTokenAccountsByOwner`. For SOL, reads lamports via
|
|
231
|
+
* `connection.getBalance`.
|
|
232
|
+
*
|
|
233
|
+
* @param connection — Solana RPC connection.
|
|
234
|
+
* @param owner — Wallet public key.
|
|
235
|
+
* @returns Array of TokenBalance for each supported token (including zero balances).
|
|
236
|
+
*/
|
|
237
|
+
export declare function getWalletTokenBalances(connection: Connection, owner: PublicKey): Promise<TokenBalance[]>;
|
|
238
|
+
/**
|
|
239
|
+
* Pre-flight balance check: compare requested collateral/amount against the
|
|
240
|
+
* wallet's actual token balance, and check SOL for fees.
|
|
241
|
+
*
|
|
242
|
+
* Returns a BalanceCheck object that can be embedded in the UnsignedTransactionResult
|
|
243
|
+
* so the agent/user sees balances and warnings before signing.
|
|
244
|
+
*
|
|
245
|
+
* @param connection — Solana RPC connection.
|
|
246
|
+
* @param owner — Wallet public key.
|
|
247
|
+
* @param requiredToken — Token symbol required (e.g. "USDC", "JITOSOL").
|
|
248
|
+
* @param requiredAmount — Human-readable amount required.
|
|
249
|
+
* @returns BalanceCheck with all balances and sufficiency flags.
|
|
250
|
+
*/
|
|
251
|
+
export declare function checkSufficientBalance(connection: Connection, owner: PublicKey, requiredToken: string, requiredAmount: number): Promise<BalanceCheck>;
|
|
252
|
+
/**
|
|
253
|
+
* Check if a user profile PDA exists on-chain. If it doesn't, build an
|
|
254
|
+
* init_user_profile instruction to create it before any Adrena position operation.
|
|
255
|
+
*
|
|
256
|
+
* @param connection — Solana RPC connection.
|
|
257
|
+
* @param owner — Wallet public key that needs a user profile.
|
|
258
|
+
* @returns Array of pre-instructions (empty if profile exists, or [initUserProfile] if not).
|
|
259
|
+
*/
|
|
260
|
+
export declare function ensureUserProfileInstructions(connection: Connection, owner: PublicKey): Promise<TransactionInstruction[]>;
|
|
261
|
+
/**
|
|
262
|
+
* Always return a CreateAssociatedTokenAccountIdempotent instruction.
|
|
263
|
+
* The instruction is a no-op if the ATA already exists, so it's safe to always include.
|
|
264
|
+
*
|
|
265
|
+
* @param _connection — Unused (kept for API compatibility).
|
|
266
|
+
* @param owner — Wallet public key.
|
|
267
|
+
* @param mint — Token mint public key.
|
|
268
|
+
* @param payer — Fee payer public key.
|
|
269
|
+
* @returns Array with a single CreateAssociatedTokenAccountIdempotent instruction.
|
|
270
|
+
*/
|
|
271
|
+
export declare function ensureAtaInstructions(_connection: Connection, owner: PublicKey, mint: PublicKey, payer: PublicKey): Promise<TransactionInstruction[]>;
|
|
272
|
+
/**
|
|
273
|
+
* Create an Anchor Program instance from the vendored IDL.
|
|
274
|
+
* @param connection — Solana RPC connection.
|
|
275
|
+
* @returns Anchor Program instance.
|
|
276
|
+
*/
|
|
277
|
+
export declare function createAdrenaProgram(connection: Connection): Program;
|
|
278
|
+
/**
|
|
279
|
+
* Convert an Anchor instruction to a @solana/web3.js TransactionInstruction.
|
|
280
|
+
* Anchor's `Instruction` namespace returns instructions with keys and data
|
|
281
|
+
* that can be directly mapped to TransactionInstruction.
|
|
282
|
+
* @param program — Anchor Program instance.
|
|
283
|
+
* @param ixName — Instruction name (camelCase).
|
|
284
|
+
* @param args — Instruction arguments.
|
|
285
|
+
* @param accounts — Account public keys by name.
|
|
286
|
+
* @returns web3.js TransactionInstruction.
|
|
287
|
+
*/
|
|
288
|
+
export declare function buildInstruction(program: Program, ixName: string, args: unknown[], accounts: Record<string, PublicKey | null>): Promise<TransactionInstruction>;
|
|
289
|
+
/**
|
|
290
|
+
* Serialize an unsigned transaction with latest blockhash.
|
|
291
|
+
* @param connection — Solana RPC connection.
|
|
292
|
+
* @param feePayer — Fee payer public key.
|
|
293
|
+
* @param instructions — Transaction instructions.
|
|
294
|
+
* @returns Base64-serialized unsigned transaction.
|
|
295
|
+
*/
|
|
296
|
+
/** Result of serializeUnsignedTx — includes the base64 transaction and simulation metadata. */
|
|
297
|
+
export interface SerializeResult {
|
|
298
|
+
transactionBase64: string;
|
|
299
|
+
simulationLogs?: string[];
|
|
300
|
+
simulationError?: string;
|
|
301
|
+
simulationUnitsConsumed?: number;
|
|
302
|
+
priorityFeeMicroLamports?: number;
|
|
303
|
+
}
|
|
304
|
+
export declare function serializeUnsignedTx(connection: Connection, feePayer: PublicKey, instructions: TransactionInstruction[]): Promise<SerializeResult>;
|
|
305
|
+
/**
|
|
306
|
+
* Build the result object for a builder function.
|
|
307
|
+
* @param transactionBase64 — Serialized unsigned transaction.
|
|
308
|
+
* @param feePayer — Fee payer public key.
|
|
309
|
+
* @param instructionNames — List of instruction names.
|
|
310
|
+
* @param positionAddress — Optional position PDA.
|
|
311
|
+
* @param balanceCheck — Optional pre-flight balance check result.
|
|
312
|
+
* @param warning — Optional warning message (e.g. insufficient balance).
|
|
313
|
+
* @param poolMetadata — Optional pool/custody metadata (for open-position builders).
|
|
314
|
+
* @returns Unsigned transaction result.
|
|
315
|
+
*/
|
|
316
|
+
export declare function buildResult(transactionBase64: string, feePayer: PublicKey, instructionNames: string[], positionAddress?: PublicKey, balanceCheck?: BalanceCheck, warning?: string, poolMetadata?: PoolMetadata): UnsignedTransactionResult;
|
|
317
|
+
export { ADRENA_CUSTODIES, ADRENA_TOKEN_MINTS, ADRENA_PROGRAM_ID, ADRENA_MAIN_POOL_ADDRESS, ADRENA_COMMODITIES_POOL_ADDRESS, } from './adrena-constants.js';
|
|
318
|
+
export { deriveCortexPda, deriveOraclePda, deriveTransferAuthorityPda, deriveUserProfilePda, derivePositionPda, deriveLimitOrderBookPda, deriveCollateralEscrowPda, deriveLpTokenMintPda, deriveStakingPda, deriveUserStakingPda, deriveGenesisLockPda, deriveLmTokenTreasuryPda, deriveLmTokenMintPda, deriveGovernanceTokenMintPda, deriveStakingStakedTokenVaultPda, deriveStakingRewardTokenVaultPda, deriveStakingLmRewardTokenVaultPda, deriveAta, } from './adrena-pda.js';
|
|
319
|
+
//# sourceMappingURL=adrena-builder-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"adrena-builder-core.d.ts","sourceRoot":"","sources":["../../../src/perps/adrena/adrena-builder-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EACL,SAAS,EAET,sBAAsB,EACtB,UAAU,EAEX,MAAM,iBAAiB,CAAC;AACzB,OAAO,EAAkB,OAAO,EAAY,MAAM,mBAAmB,CAAC;AACtE,OAAO,EAAE,MAAM,OAAO,CAAC;AAuCvB,+BAA+B;AAC/B,MAAM,MAAM,YAAY,GAAG,MAAM,GAAG,OAAO,CAAC;AAE5C,uBAAuB;AACvB,MAAM,MAAM,UAAU,GAAG,WAAW,GAAG,kBAAkB,CAAC;AAE1D;;;GAGG;AACH,MAAM,WAAW,YAAY;IAC3B,qDAAqD;IACrD,MAAM,EAAE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