@drift-labs/sdk 2.31.1-beta.9 → 2.32.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/VERSION +1 -1
- package/lib/constants/perpMarkets.js +20 -0
- package/lib/dlob/orderBookLevels.js +2 -2
- package/lib/driftClient.d.ts +51 -4
- package/lib/driftClient.js +195 -194
- package/lib/idl/drift.json +31 -1
- package/lib/index.d.ts +3 -0
- package/lib/index.js +3 -0
- package/lib/marinade/index.d.ts +11 -0
- package/lib/marinade/index.js +36 -0
- package/lib/marinade/types.d.ts +1963 -0
- package/lib/marinade/types.js +1965 -0
- package/lib/math/spotBalance.d.ts +9 -2
- package/lib/math/spotBalance.js +54 -6
- package/lib/math/superStake.d.ts +22 -0
- package/lib/math/superStake.js +108 -0
- package/lib/math/utils.d.ts +1 -0
- package/lib/math/utils.js +5 -1
- package/lib/orderParams.d.ts +18 -5
- package/lib/orderParams.js +17 -1
- package/lib/user.d.ts +45 -1
- package/lib/user.js +227 -9
- package/package.json +1 -1
- package/src/assert/assert.js +9 -0
- package/src/constants/perpMarkets.ts +20 -0
- package/src/dlob/orderBookLevels.ts +3 -2
- package/src/driftClient.ts +373 -223
- package/src/idl/drift.json +31 -1
- package/src/index.ts +3 -0
- package/src/marinade/idl/idl.json +1962 -0
- package/src/marinade/index.ts +64 -0
- package/src/marinade/types.ts +3925 -0
- package/src/math/spotBalance.ts +83 -5
- package/src/math/superStake.ts +148 -0
- package/src/math/utils.ts +4 -0
- package/src/orderParams.ts +35 -5
- package/src/token/index.js +38 -0
- package/src/user.ts +453 -15
- package/src/util/computeUnits.js +27 -0
- package/src/util/promiseTimeout.js +14 -0
- package/src/util/tps.js +27 -0
- package/tests/spot/test.ts +156 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getMarinadeMSolPrice = exports.getMarinadeDepositIx = exports.getMarinadeFinanceProgram = void 0;
|
|
4
|
+
const anchor_1 = require("@coral-xyz/anchor");
|
|
5
|
+
const types_1 = require("./types");
|
|
6
|
+
const web3_js_1 = require("@solana/web3.js");
|
|
7
|
+
const spl_token_1 = require("@solana/spl-token");
|
|
8
|
+
const marinadeFinanceProgramId = new web3_js_1.PublicKey('MarBmsSgKXdrN1egZf5sqe1TMai9K1rChYNDJgjq7aD');
|
|
9
|
+
function getMarinadeFinanceProgram(provider) {
|
|
10
|
+
return new anchor_1.Program(types_1.IDL, marinadeFinanceProgramId, provider);
|
|
11
|
+
}
|
|
12
|
+
exports.getMarinadeFinanceProgram = getMarinadeFinanceProgram;
|
|
13
|
+
function getMarinadeDepositIx({ program, amount, mSOLAccount, transferFrom, }) {
|
|
14
|
+
return program.methods
|
|
15
|
+
.deposit(amount)
|
|
16
|
+
.accountsStrict({
|
|
17
|
+
reservePda: new web3_js_1.PublicKey('Du3Ysj1wKbxPKkuPPnvzQLQh8oMSVifs3jGZjJWXFmHN'),
|
|
18
|
+
state: new web3_js_1.PublicKey('8szGkuLTAux9XMgZ2vtY39jVSowEcpBfFfD8hXSEqdGC'),
|
|
19
|
+
msolMint: new web3_js_1.PublicKey('mSoLzYCxHdYgdzU16g5QSh3i5K3z3KZK7ytfqcJm7So'),
|
|
20
|
+
msolMintAuthority: new web3_js_1.PublicKey('3JLPCS1qM2zRw3Dp6V4hZnYHd4toMNPkNesXdX9tg6KM'),
|
|
21
|
+
liqPoolMsolLegAuthority: new web3_js_1.PublicKey('EyaSjUtSgo9aRD1f8LWXwdvkpDTmXAW54yoSHZRF14WL'),
|
|
22
|
+
liqPoolMsolLeg: new web3_js_1.PublicKey('7GgPYjS5Dza89wV6FpZ23kUJRG5vbQ1GM25ezspYFSoE'),
|
|
23
|
+
liqPoolSolLegPda: new web3_js_1.PublicKey('UefNb6z6yvArqe4cJHTXCqStRsKmWhGxnZzuHbikP5Q'),
|
|
24
|
+
mintTo: mSOLAccount,
|
|
25
|
+
transferFrom,
|
|
26
|
+
systemProgram: web3_js_1.SystemProgram.programId,
|
|
27
|
+
tokenProgram: spl_token_1.TOKEN_PROGRAM_ID,
|
|
28
|
+
})
|
|
29
|
+
.instruction();
|
|
30
|
+
}
|
|
31
|
+
exports.getMarinadeDepositIx = getMarinadeDepositIx;
|
|
32
|
+
async function getMarinadeMSolPrice(program) {
|
|
33
|
+
const state = await program.account.state.fetch(new web3_js_1.PublicKey('8szGkuLTAux9XMgZ2vtY39jVSowEcpBfFfD8hXSEqdGC'));
|
|
34
|
+
return state.msolPrice.toNumber() / 4294967296;
|
|
35
|
+
}
|
|
36
|
+
exports.getMarinadeMSolPrice = getMarinadeMSolPrice;
|