@wen-moon-ser/moonshot-sdk
Advanced tools
Comparing version 2.0.0-alpha.0.0.1 to 2.0.0-alpha.0.0.2
@@ -15,4 +15,5 @@ "use strict"; | ||
const data = { | ||
amount: (0, utils_1.convertBigIntToBN)(req.tokenAmount), | ||
tokenAmount: (0, utils_1.convertBigIntToBN)(req.tokenAmount), | ||
collateralAmount: (0, utils_1.convertBigIntToBN)(req.collateralAmount), | ||
fixedSide: req.fixedSide, | ||
slippageBps: new anchor_1.BN(req.slippageBps), | ||
@@ -19,0 +20,0 @@ }; |
@@ -15,3 +15,4 @@ "use strict"; | ||
const data = { | ||
amount: (0, utils_1.convertBigIntToBN)(req.tokenAmount), | ||
tokenAmount: (0, utils_1.convertBigIntToBN)(req.tokenAmount), | ||
fixedSide: req.fixedSide, | ||
collateralAmount: (0, utils_1.convertBigIntToBN)(req.collateralAmount), | ||
@@ -18,0 +19,0 @@ slippageBps: new anchor_1.BN(req.slippageBps), |
@@ -23,1 +23,2 @@ "use strict"; | ||
__exportStar(require("./PrepareTxOptions"), exports); | ||
__exportStar(require("./FixedSide"), exports); |
@@ -10,2 +10,3 @@ "use strict"; | ||
const curve_1 = require("../curve"); | ||
const FixedSide_1 = require("./FixedSide"); | ||
class Token { | ||
@@ -47,2 +48,5 @@ constructor(options) { | ||
const curveAccountPK = this.deriveCurveAddress(program); | ||
const fixedSide = options.fixedSide ?? tradeDirection === 'BUY' | ||
? FixedSide_1.FixedSide.OUT | ||
: FixedSide_1.FixedSide.IN; | ||
const req = { | ||
@@ -55,2 +59,3 @@ tokenAmount, | ||
mint: new web3_js_1.PublicKey(this.mintAddress), | ||
fixedSide, | ||
}; | ||
@@ -57,0 +62,0 @@ return { |
@@ -517,3 +517,3 @@ "use strict"; | ||
{ | ||
name: 'amount', | ||
name: 'tokenAmount', | ||
type: 'u64', | ||
@@ -526,2 +526,6 @@ }, | ||
{ | ||
name: 'fixedSide', | ||
type: 'u8', | ||
}, | ||
{ | ||
name: 'slippageBps', | ||
@@ -650,2 +654,5 @@ type: 'u64', | ||
}, | ||
{ | ||
name: 'ConstantProductV1', | ||
}, | ||
], | ||
@@ -668,2 +675,16 @@ }, | ||
}, | ||
{ | ||
name: 'FixedSide', | ||
type: { | ||
kind: 'enum', | ||
variants: [ | ||
{ | ||
name: 'ExactIn', | ||
}, | ||
{ | ||
name: 'ExactOut', | ||
}, | ||
], | ||
}, | ||
}, | ||
], | ||
@@ -912,2 +933,22 @@ events: [ | ||
code: 6030, | ||
name: 'IncorrectMarketCap', | ||
msg: 'For Constant Product the Market Cap threshold cannot be higher than 325 SOL', | ||
}, | ||
{ | ||
code: 6031, | ||
name: 'IncorrectDecimals', | ||
msg: 'For Constant Product the Decimal places cannot be other than 9', | ||
}, | ||
{ | ||
code: 6032, | ||
name: 'IncorrectMaxSupply', | ||
msg: 'For Constant Product the Maximal Token Supply cannot be other than 1_000_000_000', | ||
}, | ||
{ | ||
code: 6033, | ||
name: 'MarketCapTooHigh', | ||
msg: 'Market Cap Threshold set too high, will not be hit even if Curve Hard Limit reached', | ||
}, | ||
{ | ||
code: 6034, | ||
name: 'General', | ||
@@ -914,0 +955,0 @@ msg: 'General error', |
import { PublicKey } from '@solana/web3.js'; | ||
import { FixedSide } from '../token'; | ||
export type TradeRequest = { | ||
@@ -9,3 +10,4 @@ tokenAmount: bigint; | ||
mint: PublicKey; | ||
fixedSide: FixedSide; | ||
}; | ||
//# sourceMappingURL=types.d.ts.map |
@@ -7,2 +7,3 @@ export * from './Token'; | ||
export * from './PrepareTxOptions'; | ||
export * from './FixedSide'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -0,1 +1,2 @@ | ||
import { FixedSide } from './FixedSide'; | ||
export interface PrepareTxOptions { | ||
@@ -7,3 +8,4 @@ tokenAmount: bigint; | ||
tradeDirection: 'BUY' | 'SELL'; | ||
fixedSide?: FixedSide; | ||
} | ||
//# sourceMappingURL=PrepareTxOptions.d.ts.map |
{ | ||
"name": "@wen-moon-ser/moonshot-sdk", | ||
"version": "2.0.0-alpha.0.0.1", | ||
"version": "2.0.0-alpha.0.0.2", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "types": "dist/types/index.d.ts", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
113060
162
2380