flash-sdk 1.0.14 → 1.0.16
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/PerpetualsClient.d.ts +9 -3
- package/lib/PerpetualsClient.js +196 -136
- package/lib/PoolConfig.json +7 -0
- package/lib/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/PerpetualsClient.ts +161 -77
- package/src/PoolConfig.json +7 -0
- package/src/PoolConfig.ts +6 -6
- package/lib/client/src/target/types/limit_order_cpi.d.ts +0 -130
- package/lib/client/src/target/types/limit_order_cpi.js +0 -132
- package/lib/client/src/target/types/perpetuals.d.ts +0 -3539
- package/lib/client/src/target/types/perpetuals.d.ts.map +0 -1
- package/lib/client/src/target/types/perpetuals.js +0 -3541
- package/lib/client/src/target/types/perpetuals.js.map +0 -1
- package/lib/target/types/perpetuals.d.ts +0 -3538
- package/lib/target/types/perpetuals.d.ts.map +0 -1
- package/lib/target/types/perpetuals.js +0 -3540
- package/lib/target/types/perpetuals.js.map +0 -1
package/src/PoolConfig.json
CHANGED
@@ -31,6 +31,13 @@
|
|
31
31
|
"isStable": false,
|
32
32
|
"pythTicker" : "Crypto.SOL/USD"
|
33
33
|
},
|
34
|
+
{
|
35
|
+
"symbol": "WSOL",
|
36
|
+
"mintKey": "So11111111111111111111111111111111111111112",
|
37
|
+
"decimals": 9,
|
38
|
+
"isStable": false,
|
39
|
+
"pythTicker" : "Crypto.SOL/USD"
|
40
|
+
},
|
34
41
|
{
|
35
42
|
"symbol": "BTC",
|
36
43
|
"mintKey": "B8DYqbh57aEPRbUq7reyueY6jaYoN75js5YsiM84tFfP",
|
package/src/PoolConfig.ts
CHANGED
@@ -83,14 +83,14 @@ export class PoolConfig {
|
|
83
83
|
// return poolConfigs.pools.map(p => this.fromIdsByName(p.poolName, cluster))
|
84
84
|
// }
|
85
85
|
|
86
|
-
static getCustodyConfig(custodyAccountPk: Address, poolName: string, cluster: Cluster) {
|
86
|
+
static getCustodyConfig(custodyAccountPk: Address, poolName: string, cluster: Cluster) : CustodyConfig {
|
87
87
|
return this.fromIdsByName(poolName, cluster).custodies.find(f => f.custodyAccount.toBase58() === custodyAccountPk.toString())
|
88
88
|
}
|
89
89
|
|
90
90
|
static getTokensInPool(name: string, cluster: Cluster): Token[] {
|
91
91
|
const poolConfig = poolConfigs.pools.find((pool) => pool['poolName'] === name && cluster === pool['cluster']);
|
92
92
|
if (!poolConfig) throw new Error(`No pool config ${name} found in Ids!`);
|
93
|
-
const tokens = poolConfig['tokens'].map(i => {
|
93
|
+
const tokens :Token[] = poolConfig['tokens'].map(i => {
|
94
94
|
return {
|
95
95
|
...i,
|
96
96
|
mintKey: new PublicKey(i.mintKey)
|
@@ -102,13 +102,13 @@ export class PoolConfig {
|
|
102
102
|
static fromIdsByName(name: string, cluster: Cluster): PoolConfig {
|
103
103
|
const poolConfig = poolConfigs.pools.find((pool) => pool['poolName'] === name && cluster === pool['cluster']);
|
104
104
|
if (!poolConfig) throw new Error(`No pool config ${name} found in Ids!`);
|
105
|
-
const tokens = poolConfig['tokens'].map(i => {
|
105
|
+
const tokens:Token[] = poolConfig['tokens'].map(i => {
|
106
106
|
return {
|
107
107
|
...i,
|
108
108
|
mintKey : new PublicKey(i.mintKey)
|
109
109
|
}
|
110
110
|
})
|
111
|
-
const custodies = poolConfig['custodies'].map(i => {
|
111
|
+
const custodies : CustodyConfig[] = poolConfig['custodies'].map(i => {
|
112
112
|
return {
|
113
113
|
...i,
|
114
114
|
custodyAccount : new PublicKey(i.custodyAccount),
|
@@ -139,13 +139,13 @@ export class PoolConfig {
|
|
139
139
|
if (!poolConfig)
|
140
140
|
throw new Error(`No pool config ${poolPk.toString()} found in Ids!`);
|
141
141
|
|
142
|
-
const tokens = poolConfig['tokens'].map(i => {
|
142
|
+
const tokens :Token[] = poolConfig['tokens'].map(i => {
|
143
143
|
return {
|
144
144
|
...i,
|
145
145
|
mintKey : new PublicKey(i.mintKey)
|
146
146
|
}
|
147
147
|
})
|
148
|
-
const custodies = poolConfig['custodies'].map(i => {
|
148
|
+
const custodies : CustodyConfig[] = poolConfig['custodies'].map(i => {
|
149
149
|
return {
|
150
150
|
...i,
|
151
151
|
custodyAccount : new PublicKey(i.custodyAccount),
|
@@ -1,130 +0,0 @@
|
|
1
|
-
export type LimitOrderCpi = {
|
2
|
-
"version": "0.1.0";
|
3
|
-
"name": "limit_order_cpi";
|
4
|
-
"instructions": [
|
5
|
-
{
|
6
|
-
"name": "processMarketOrder";
|
7
|
-
"accounts": [
|
8
|
-
{
|
9
|
-
"name": "keeper";
|
10
|
-
"isMut": true;
|
11
|
-
"isSigner": true;
|
12
|
-
},
|
13
|
-
{
|
14
|
-
"name": "pdaAccount";
|
15
|
-
"isMut": true;
|
16
|
-
"isSigner": false;
|
17
|
-
},
|
18
|
-
{
|
19
|
-
"name": "pdaTokenVault";
|
20
|
-
"isMut": true;
|
21
|
-
"isSigner": false;
|
22
|
-
},
|
23
|
-
{
|
24
|
-
"name": "transferAuthority";
|
25
|
-
"isMut": false;
|
26
|
-
"isSigner": false;
|
27
|
-
},
|
28
|
-
{
|
29
|
-
"name": "perpetuals";
|
30
|
-
"isMut": false;
|
31
|
-
"isSigner": false;
|
32
|
-
},
|
33
|
-
{
|
34
|
-
"name": "pool";
|
35
|
-
"isMut": true;
|
36
|
-
"isSigner": false;
|
37
|
-
},
|
38
|
-
{
|
39
|
-
"name": "position";
|
40
|
-
"isMut": true;
|
41
|
-
"isSigner": false;
|
42
|
-
},
|
43
|
-
{
|
44
|
-
"name": "custody";
|
45
|
-
"isMut": true;
|
46
|
-
"isSigner": false;
|
47
|
-
},
|
48
|
-
{
|
49
|
-
"name": "custodyOracleAccount";
|
50
|
-
"isMut": false;
|
51
|
-
"isSigner": false;
|
52
|
-
},
|
53
|
-
{
|
54
|
-
"name": "custodyTokenAccount";
|
55
|
-
"isMut": true;
|
56
|
-
"isSigner": false;
|
57
|
-
},
|
58
|
-
{
|
59
|
-
"name": "systemProgram";
|
60
|
-
"isMut": false;
|
61
|
-
"isSigner": false;
|
62
|
-
},
|
63
|
-
{
|
64
|
-
"name": "tokenProgram";
|
65
|
-
"isMut": false;
|
66
|
-
"isSigner": false;
|
67
|
-
},
|
68
|
-
{
|
69
|
-
"name": "flashProgram";
|
70
|
-
"isMut": false;
|
71
|
-
"isSigner": false;
|
72
|
-
}
|
73
|
-
];
|
74
|
-
"args": [
|
75
|
-
{
|
76
|
-
"name": "params";
|
77
|
-
"type": {
|
78
|
-
"defined": "OpenPositionParams";
|
79
|
-
};
|
80
|
-
}
|
81
|
-
];
|
82
|
-
}
|
83
|
-
];
|
84
|
-
"types": [
|
85
|
-
{
|
86
|
-
"name": "OpenPositionParams";
|
87
|
-
"type": {
|
88
|
-
"kind": "struct";
|
89
|
-
"fields": [
|
90
|
-
{
|
91
|
-
"name": "price";
|
92
|
-
"type": "u64";
|
93
|
-
},
|
94
|
-
{
|
95
|
-
"name": "collateral";
|
96
|
-
"type": "u64";
|
97
|
-
},
|
98
|
-
{
|
99
|
-
"name": "size";
|
100
|
-
"type": "u64";
|
101
|
-
},
|
102
|
-
{
|
103
|
-
"name": "side";
|
104
|
-
"type": {
|
105
|
-
"defined": "Side";
|
106
|
-
};
|
107
|
-
}
|
108
|
-
];
|
109
|
-
};
|
110
|
-
},
|
111
|
-
{
|
112
|
-
"name": "Side";
|
113
|
-
"type": {
|
114
|
-
"kind": "enum";
|
115
|
-
"variants": [
|
116
|
-
{
|
117
|
-
"name": "None";
|
118
|
-
},
|
119
|
-
{
|
120
|
-
"name": "Long";
|
121
|
-
},
|
122
|
-
{
|
123
|
-
"name": "Short";
|
124
|
-
}
|
125
|
-
];
|
126
|
-
};
|
127
|
-
}
|
128
|
-
];
|
129
|
-
};
|
130
|
-
export declare const IDL: LimitOrderCpi;
|
@@ -1,132 +0,0 @@
|
|
1
|
-
"use strict";
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
-
exports.IDL = void 0;
|
4
|
-
exports.IDL = {
|
5
|
-
"version": "0.1.0",
|
6
|
-
"name": "limit_order_cpi",
|
7
|
-
"instructions": [
|
8
|
-
{
|
9
|
-
"name": "processMarketOrder",
|
10
|
-
"accounts": [
|
11
|
-
{
|
12
|
-
"name": "keeper",
|
13
|
-
"isMut": true,
|
14
|
-
"isSigner": true
|
15
|
-
},
|
16
|
-
{
|
17
|
-
"name": "pdaAccount",
|
18
|
-
"isMut": true,
|
19
|
-
"isSigner": false
|
20
|
-
},
|
21
|
-
{
|
22
|
-
"name": "pdaTokenVault",
|
23
|
-
"isMut": true,
|
24
|
-
"isSigner": false
|
25
|
-
},
|
26
|
-
{
|
27
|
-
"name": "transferAuthority",
|
28
|
-
"isMut": false,
|
29
|
-
"isSigner": false
|
30
|
-
},
|
31
|
-
{
|
32
|
-
"name": "perpetuals",
|
33
|
-
"isMut": false,
|
34
|
-
"isSigner": false
|
35
|
-
},
|
36
|
-
{
|
37
|
-
"name": "pool",
|
38
|
-
"isMut": true,
|
39
|
-
"isSigner": false
|
40
|
-
},
|
41
|
-
{
|
42
|
-
"name": "position",
|
43
|
-
"isMut": true,
|
44
|
-
"isSigner": false
|
45
|
-
},
|
46
|
-
{
|
47
|
-
"name": "custody",
|
48
|
-
"isMut": true,
|
49
|
-
"isSigner": false
|
50
|
-
},
|
51
|
-
{
|
52
|
-
"name": "custodyOracleAccount",
|
53
|
-
"isMut": false,
|
54
|
-
"isSigner": false
|
55
|
-
},
|
56
|
-
{
|
57
|
-
"name": "custodyTokenAccount",
|
58
|
-
"isMut": true,
|
59
|
-
"isSigner": false
|
60
|
-
},
|
61
|
-
{
|
62
|
-
"name": "systemProgram",
|
63
|
-
"isMut": false,
|
64
|
-
"isSigner": false
|
65
|
-
},
|
66
|
-
{
|
67
|
-
"name": "tokenProgram",
|
68
|
-
"isMut": false,
|
69
|
-
"isSigner": false
|
70
|
-
},
|
71
|
-
{
|
72
|
-
"name": "flashProgram",
|
73
|
-
"isMut": false,
|
74
|
-
"isSigner": false
|
75
|
-
}
|
76
|
-
],
|
77
|
-
"args": [
|
78
|
-
{
|
79
|
-
"name": "params",
|
80
|
-
"type": {
|
81
|
-
"defined": "OpenPositionParams"
|
82
|
-
}
|
83
|
-
}
|
84
|
-
]
|
85
|
-
}
|
86
|
-
],
|
87
|
-
"types": [
|
88
|
-
{
|
89
|
-
"name": "OpenPositionParams",
|
90
|
-
"type": {
|
91
|
-
"kind": "struct",
|
92
|
-
"fields": [
|
93
|
-
{
|
94
|
-
"name": "price",
|
95
|
-
"type": "u64"
|
96
|
-
},
|
97
|
-
{
|
98
|
-
"name": "collateral",
|
99
|
-
"type": "u64"
|
100
|
-
},
|
101
|
-
{
|
102
|
-
"name": "size",
|
103
|
-
"type": "u64"
|
104
|
-
},
|
105
|
-
{
|
106
|
-
"name": "side",
|
107
|
-
"type": {
|
108
|
-
"defined": "Side"
|
109
|
-
}
|
110
|
-
}
|
111
|
-
]
|
112
|
-
}
|
113
|
-
},
|
114
|
-
{
|
115
|
-
"name": "Side",
|
116
|
-
"type": {
|
117
|
-
"kind": "enum",
|
118
|
-
"variants": [
|
119
|
-
{
|
120
|
-
"name": "None"
|
121
|
-
},
|
122
|
-
{
|
123
|
-
"name": "Long"
|
124
|
-
},
|
125
|
-
{
|
126
|
-
"name": "Short"
|
127
|
-
}
|
128
|
-
]
|
129
|
-
}
|
130
|
-
}
|
131
|
-
]
|
132
|
-
};
|