flash-sdk 1.0.22 → 1.0.24
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/{lib → dist}/PerpetualsClient.d.ts +2 -0
- package/{lib → dist}/constants/index.js +3 -3
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +10 -4
- package/lib/tsconfig.tsbuildinfo +0 -1
- package/src/CustodyAccount.ts +0 -125
- package/src/OraclePrice.ts +0 -111
- package/src/PerpetualsClient.ts +0 -2112
- package/src/PoolAccount.ts +0 -491
- package/src/PoolConfig.json +0 -322
- package/src/PoolConfig.ts +0 -182
- package/src/PoolDataClient.ts +0 -173
- package/src/PositionAccount.ts +0 -58
- package/src/Token.ts +0 -1
- package/src/constants/index.ts +0 -21
- package/src/idl/perpetuals.ts +0 -7561
- package/src/index.ts +0 -19
- package/src/type-rules.md +0 -4
- package/src/types/index.ts +0 -290
- package/src/utils/index.ts +0 -234
- package/src/utils/rpc.ts +0 -162
- package/tsconfig.json +0 -23
- /package/{lib → dist}/CustodyAccount.d.ts +0 -0
- /package/{lib → dist}/CustodyAccount.js +0 -0
- /package/{lib → dist}/OraclePrice.d.ts +0 -0
- /package/{lib → dist}/OraclePrice.js +0 -0
- /package/{lib → dist}/PerpetualsClient.js +0 -0
- /package/{lib → dist}/PoolAccount.d.ts +0 -0
- /package/{lib → dist}/PoolAccount.js +0 -0
- /package/{lib → dist}/PoolConfig.d.ts +0 -0
- /package/{lib → dist}/PoolConfig.js +0 -0
- /package/{lib → dist}/PoolConfig.json +0 -0
- /package/{lib → dist}/PoolDataClient.d.ts +0 -0
- /package/{lib → dist}/PoolDataClient.js +0 -0
- /package/{lib → dist}/PositionAccount.d.ts +0 -0
- /package/{lib → dist}/PositionAccount.js +0 -0
- /package/{lib → dist}/Token.d.ts +0 -0
- /package/{lib → dist}/Token.js +0 -0
- /package/{lib → dist}/constants/index.d.ts +0 -0
- /package/{lib → dist}/idl/perpetuals.d.ts +0 -0
- /package/{lib → dist}/idl/perpetuals.js +0 -0
- /package/{lib → dist}/index.d.ts +0 -0
- /package/{lib → dist}/index.js +0 -0
- /package/{lib → dist}/types/index.d.ts +0 -0
- /package/{lib → dist}/types/index.js +0 -0
- /package/{lib → dist}/utils/index.d.ts +0 -0
- /package/{lib → dist}/utils/index.js +0 -0
- /package/{lib → dist}/utils/rpc.d.ts +0 -0
- /package/{lib → dist}/utils/rpc.js +0 -0
package/src/PositionAccount.ts
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
import { BN } from "@coral-xyz/anchor";
|
2
|
-
import { Connection, PublicKey } from "@solana/web3.js";
|
3
|
-
import { isVariant, Position, Side } from "./types";
|
4
|
-
|
5
|
-
|
6
|
-
export class PositionAccount implements Position {
|
7
|
-
|
8
|
-
public publicKey: PublicKey;
|
9
|
-
|
10
|
-
// all Position Type data IMP:: SHOULD MATCH NAMES
|
11
|
-
public owner: PublicKey;
|
12
|
-
public pool: PublicKey;
|
13
|
-
public custody: PublicKey;
|
14
|
-
//public lockCustody: PublicKey,
|
15
|
-
public openTime: BN;
|
16
|
-
public updateTime: BN;
|
17
|
-
|
18
|
-
public side: Side;
|
19
|
-
public price: BN;
|
20
|
-
public sizeUsd: BN;
|
21
|
-
public collateralUsd: BN;
|
22
|
-
public unrealizedProfitUsd: BN;
|
23
|
-
public unrealizedLossUsd: BN;
|
24
|
-
public cumulativeInterestSnapshot: BN;
|
25
|
-
public lockedAmount: BN;
|
26
|
-
public collateralAmount: BN;
|
27
|
-
// extra
|
28
|
-
public bump: number
|
29
|
-
|
30
|
-
constructor( publicKey : PublicKey, parseData : Position) {
|
31
|
-
this.publicKey = publicKey;
|
32
|
-
Object.assign(this, parseData);
|
33
|
-
}
|
34
|
-
|
35
|
-
static from(publicKey: PublicKey,parseData : Position): PositionAccount {
|
36
|
-
return new PositionAccount( publicKey,parseData);
|
37
|
-
}
|
38
|
-
|
39
|
-
updatePositionData(position: Position) {
|
40
|
-
Object.assign(this, { ...position })
|
41
|
-
}
|
42
|
-
|
43
|
-
static async getLiquidationPrice( poolKey: PublicKey, custodyKey: PublicKey, position: PublicKey) {
|
44
|
-
try {
|
45
|
-
} catch (error) {
|
46
|
-
return new BN(0);
|
47
|
-
}
|
48
|
-
}
|
49
|
-
|
50
|
-
static async getPnl( poolKey: PublicKey, custodyKey: PublicKey, position: PublicKey) {
|
51
|
-
try {
|
52
|
-
} catch (error) {
|
53
|
-
return new BN(0);
|
54
|
-
|
55
|
-
}
|
56
|
-
}
|
57
|
-
|
58
|
-
}
|
package/src/Token.ts
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
// later inport from UI
|
package/src/constants/index.ts
DELETED
@@ -1,21 +0,0 @@
|
|
1
|
-
import { Cluster } from "@solana/web3.js";
|
2
|
-
import { BN } from "bn.js";
|
3
|
-
|
4
|
-
export const DEFAULT_CLUSTER: Cluster = 'devnet';
|
5
|
-
export const DEFAULT_POOL: string = 'pool1';
|
6
|
-
|
7
|
-
export const PERCENTAGE_DECIMALS = 4; // stableCoinPercentage
|
8
|
-
export const PRICE_DECIMALS = 6; //
|
9
|
-
export const USD_DECIMALS = 6; //
|
10
|
-
|
11
|
-
|
12
|
-
export const BPS_DECIMALS = 4; //
|
13
|
-
export const BPS_POWER = 10**(BPS_DECIMALS);
|
14
|
-
|
15
|
-
export const LP_DECIMALS = USD_DECIMALS;
|
16
|
-
|
17
|
-
export const RATE_DECIMALS = 9; // borow rate
|
18
|
-
export const RATE_POWER = 10**(RATE_DECIMALS);
|
19
|
-
|
20
|
-
export const BN_ZERO = new BN(0);
|
21
|
-
export const BN_ONE = new BN(1);
|