@drift-labs/sdk 0.2.0-master.10 → 0.2.0-master.11
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/admin.d.ts +3 -3
- package/lib/admin.js +6 -6
- package/lib/clearingHouse.d.ts +15 -4
- package/lib/clearingHouse.js +200 -37
- package/lib/clearingHouseUser.d.ts +2 -2
- package/lib/clearingHouseUser.js +8 -17
- package/lib/config.js +1 -1
- package/lib/constants/banks.js +1 -1
- package/lib/constants/numericConstants.d.ts +1 -0
- package/lib/constants/numericConstants.js +2 -1
- package/lib/idl/clearing_house.json +484 -103
- package/lib/idl/{mock_usdc_faucet.json → token_faucet.json} +46 -23
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/{mockUSDCFaucet.d.ts → tokenFaucet.d.ts} +7 -5
- package/lib/{mockUSDCFaucet.js → tokenFaucet.js} +41 -40
- package/lib/types.d.ts +62 -13
- package/lib/types.js +12 -1
- package/lib/util/computeUnits.js +1 -1
- package/package.json +1 -1
- package/src/admin.ts +7 -7
- package/src/clearingHouse.ts +335 -47
- package/src/clearingHouseUser.ts +12 -23
- package/src/config.ts +1 -1
- package/src/constants/banks.ts +1 -1
- package/src/constants/numericConstants.ts +1 -0
- package/src/idl/clearing_house.json +484 -103
- package/src/idl/{mock_usdc_faucet.json → token_faucet.json} +46 -23
- package/src/index.js +98 -67
- package/src/index.ts +1 -1
- package/src/mockUSDCFaucet.js +276 -167
- package/src/{mockUSDCFaucet.ts → tokenFaucet.ts} +48 -59
- package/src/types.ts +63 -13
- package/src/util/computeUnits.ts +1 -1
|
@@ -1,23 +1,23 @@
|
|
|
1
1
|
{
|
|
2
|
-
"version": "0.
|
|
3
|
-
"name": "
|
|
2
|
+
"version": "0.1.0",
|
|
3
|
+
"name": "token_faucet",
|
|
4
4
|
"instructions": [
|
|
5
5
|
{
|
|
6
6
|
"name": "initialize",
|
|
7
7
|
"accounts": [
|
|
8
8
|
{
|
|
9
|
-
"name": "
|
|
9
|
+
"name": "faucetConfig",
|
|
10
10
|
"isMut": true,
|
|
11
11
|
"isSigner": false
|
|
12
12
|
},
|
|
13
13
|
{
|
|
14
14
|
"name": "admin",
|
|
15
|
-
"isMut":
|
|
15
|
+
"isMut": true,
|
|
16
16
|
"isSigner": true
|
|
17
17
|
},
|
|
18
18
|
{
|
|
19
19
|
"name": "mintAccount",
|
|
20
|
-
"isMut":
|
|
20
|
+
"isMut": true,
|
|
21
21
|
"isSigner": false
|
|
22
22
|
},
|
|
23
23
|
{
|
|
@@ -29,20 +29,20 @@
|
|
|
29
29
|
"name": "systemProgram",
|
|
30
30
|
"isMut": false,
|
|
31
31
|
"isSigner": false
|
|
32
|
-
}
|
|
33
|
-
],
|
|
34
|
-
"args": [
|
|
32
|
+
},
|
|
35
33
|
{
|
|
36
|
-
"name": "
|
|
37
|
-
"
|
|
34
|
+
"name": "tokenProgram",
|
|
35
|
+
"isMut": false,
|
|
36
|
+
"isSigner": false
|
|
38
37
|
}
|
|
39
|
-
]
|
|
38
|
+
],
|
|
39
|
+
"args": []
|
|
40
40
|
},
|
|
41
41
|
{
|
|
42
42
|
"name": "mintToUser",
|
|
43
43
|
"accounts": [
|
|
44
44
|
{
|
|
45
|
-
"name": "
|
|
45
|
+
"name": "faucetConfig",
|
|
46
46
|
"isMut": false,
|
|
47
47
|
"isSigner": false
|
|
48
48
|
},
|
|
@@ -73,11 +73,42 @@
|
|
|
73
73
|
"type": "u64"
|
|
74
74
|
}
|
|
75
75
|
]
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
"name": "transferMintAuthority",
|
|
79
|
+
"accounts": [
|
|
80
|
+
{
|
|
81
|
+
"name": "faucetConfig",
|
|
82
|
+
"isMut": false,
|
|
83
|
+
"isSigner": false
|
|
84
|
+
},
|
|
85
|
+
{
|
|
86
|
+
"name": "admin",
|
|
87
|
+
"isMut": true,
|
|
88
|
+
"isSigner": true
|
|
89
|
+
},
|
|
90
|
+
{
|
|
91
|
+
"name": "mintAccount",
|
|
92
|
+
"isMut": true,
|
|
93
|
+
"isSigner": false
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
"name": "mintAuthority",
|
|
97
|
+
"isMut": false,
|
|
98
|
+
"isSigner": false
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
"name": "tokenProgram",
|
|
102
|
+
"isMut": false,
|
|
103
|
+
"isSigner": false
|
|
104
|
+
}
|
|
105
|
+
],
|
|
106
|
+
"args": []
|
|
76
107
|
}
|
|
77
108
|
],
|
|
78
109
|
"accounts": [
|
|
79
110
|
{
|
|
80
|
-
"name": "
|
|
111
|
+
"name": "FaucetConfig",
|
|
81
112
|
"type": {
|
|
82
113
|
"kind": "struct",
|
|
83
114
|
"fields": [
|
|
@@ -103,17 +134,9 @@
|
|
|
103
134
|
],
|
|
104
135
|
"errors": [
|
|
105
136
|
{
|
|
106
|
-
"code":
|
|
137
|
+
"code": 6000,
|
|
107
138
|
"name": "InvalidMintAccountAuthority",
|
|
108
139
|
"msg": "Program not mint authority"
|
|
109
|
-
},
|
|
110
|
-
{
|
|
111
|
-
"code": 301,
|
|
112
|
-
"name": "Unauthorized",
|
|
113
|
-
"msg": "Signer must be MockUSDCFaucet admin"
|
|
114
140
|
}
|
|
115
|
-
]
|
|
116
|
-
"metadata": {
|
|
117
|
-
"address": "2z2DLVD3tBWc86pbvvy5qN31v1NXprM6zA5MDr2FMx64"
|
|
118
|
-
}
|
|
141
|
+
]
|
|
119
142
|
}
|
package/src/index.js
CHANGED
|
@@ -1,69 +1,100 @@
|
|
|
1
|
-
|
|
2
|
-
var __createBinding =
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
1
|
+
'use strict';
|
|
2
|
+
var __createBinding =
|
|
3
|
+
(this && this.__createBinding) ||
|
|
4
|
+
(Object.create
|
|
5
|
+
? function (o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
Object.defineProperty(o, k2, {
|
|
8
|
+
enumerable: true,
|
|
9
|
+
get: function () {
|
|
10
|
+
return m[k];
|
|
11
|
+
},
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
: function (o, m, k, k2) {
|
|
15
|
+
if (k2 === undefined) k2 = k;
|
|
16
|
+
o[k2] = m[k];
|
|
17
|
+
});
|
|
18
|
+
var __exportStar =
|
|
19
|
+
(this && this.__exportStar) ||
|
|
20
|
+
function (m, exports) {
|
|
21
|
+
for (var p in m)
|
|
22
|
+
if (p !== 'default' && !Object.prototype.hasOwnProperty.call(exports, p))
|
|
23
|
+
__createBinding(exports, m, p);
|
|
24
|
+
};
|
|
25
|
+
var __importDefault =
|
|
26
|
+
(this && this.__importDefault) ||
|
|
27
|
+
function (mod) {
|
|
28
|
+
return mod && mod.__esModule ? mod : { default: mod };
|
|
29
|
+
};
|
|
30
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
16
31
|
exports.pyth = exports.PublicKey = exports.BN = void 0;
|
|
17
|
-
const anchor_1 = require(
|
|
18
|
-
Object.defineProperty(exports,
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
32
|
+
const anchor_1 = require('@project-serum/anchor');
|
|
33
|
+
Object.defineProperty(exports, 'BN', {
|
|
34
|
+
enumerable: true,
|
|
35
|
+
get: function () {
|
|
36
|
+
return anchor_1.BN;
|
|
37
|
+
},
|
|
38
|
+
});
|
|
39
|
+
const web3_js_1 = require('@solana/web3.js');
|
|
40
|
+
Object.defineProperty(exports, 'PublicKey', {
|
|
41
|
+
enumerable: true,
|
|
42
|
+
get: function () {
|
|
43
|
+
return web3_js_1.PublicKey;
|
|
44
|
+
},
|
|
45
|
+
});
|
|
46
|
+
const client_1 = __importDefault(require('@pythnetwork/client'));
|
|
22
47
|
exports.pyth = client_1.default;
|
|
23
|
-
__exportStar(require(
|
|
24
|
-
__exportStar(require(
|
|
25
|
-
__exportStar(require(
|
|
26
|
-
__exportStar(require(
|
|
27
|
-
__exportStar(require(
|
|
28
|
-
__exportStar(require(
|
|
29
|
-
__exportStar(require(
|
|
30
|
-
__exportStar(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
__exportStar(require(
|
|
35
|
-
__exportStar(require(
|
|
36
|
-
__exportStar(
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
__exportStar(require(
|
|
41
|
-
__exportStar(require(
|
|
42
|
-
__exportStar(require(
|
|
43
|
-
__exportStar(require(
|
|
44
|
-
__exportStar(require(
|
|
45
|
-
__exportStar(require(
|
|
46
|
-
__exportStar(require(
|
|
47
|
-
__exportStar(require(
|
|
48
|
-
__exportStar(require(
|
|
49
|
-
__exportStar(require(
|
|
50
|
-
__exportStar(require(
|
|
51
|
-
__exportStar(require(
|
|
52
|
-
__exportStar(require(
|
|
53
|
-
__exportStar(require(
|
|
54
|
-
__exportStar(require(
|
|
55
|
-
__exportStar(require(
|
|
56
|
-
__exportStar(require(
|
|
57
|
-
__exportStar(require(
|
|
58
|
-
__exportStar(require(
|
|
59
|
-
__exportStar(require(
|
|
60
|
-
__exportStar(require(
|
|
61
|
-
__exportStar(require(
|
|
62
|
-
__exportStar(require(
|
|
63
|
-
__exportStar(require(
|
|
64
|
-
__exportStar(require(
|
|
65
|
-
__exportStar(require(
|
|
66
|
-
__exportStar(require(
|
|
67
|
-
__exportStar(require(
|
|
68
|
-
__exportStar(require(
|
|
69
|
-
__exportStar(require(
|
|
48
|
+
__exportStar(require('./tokenFaucet'), exports);
|
|
49
|
+
__exportStar(require('./oracles/types'), exports);
|
|
50
|
+
__exportStar(require('./oracles/pythClient'), exports);
|
|
51
|
+
__exportStar(require('./oracles/switchboardClient'), exports);
|
|
52
|
+
__exportStar(require('./types'), exports);
|
|
53
|
+
__exportStar(require('./constants/markets'), exports);
|
|
54
|
+
__exportStar(require('./accounts/fetch'), exports);
|
|
55
|
+
__exportStar(
|
|
56
|
+
require('./accounts/webSocketClearingHouseAccountSubscriber'),
|
|
57
|
+
exports
|
|
58
|
+
);
|
|
59
|
+
__exportStar(require('./accounts/bulkAccountLoader'), exports);
|
|
60
|
+
__exportStar(require('./accounts/bulkUserSubscription'), exports);
|
|
61
|
+
__exportStar(
|
|
62
|
+
require('./accounts/pollingClearingHouseAccountSubscriber'),
|
|
63
|
+
exports
|
|
64
|
+
);
|
|
65
|
+
__exportStar(require('./accounts/pollingOracleSubscriber'), exports);
|
|
66
|
+
__exportStar(require('./accounts/pollingTokenAccountSubscriber'), exports);
|
|
67
|
+
__exportStar(require('./accounts/types'), exports);
|
|
68
|
+
__exportStar(require('./addresses/pda'), exports);
|
|
69
|
+
__exportStar(require('./admin'), exports);
|
|
70
|
+
__exportStar(require('./clearingHouseUser'), exports);
|
|
71
|
+
__exportStar(require('./clearingHouseUserConfig'), exports);
|
|
72
|
+
__exportStar(require('./clearingHouse'), exports);
|
|
73
|
+
__exportStar(require('./factory/oracleClient'), exports);
|
|
74
|
+
__exportStar(require('./factory/bigNum'), exports);
|
|
75
|
+
__exportStar(require('./events/types'), exports);
|
|
76
|
+
__exportStar(require('./events/eventSubscriber'), exports);
|
|
77
|
+
__exportStar(require('./math/auction'), exports);
|
|
78
|
+
__exportStar(require('./math/conversion'), exports);
|
|
79
|
+
__exportStar(require('./math/funding'), exports);
|
|
80
|
+
__exportStar(require('./math/market'), exports);
|
|
81
|
+
__exportStar(require('./math/position'), exports);
|
|
82
|
+
__exportStar(require('./math/oracles'), exports);
|
|
83
|
+
__exportStar(require('./math/amm'), exports);
|
|
84
|
+
__exportStar(require('./math/trade'), exports);
|
|
85
|
+
__exportStar(require('./math/orders'), exports);
|
|
86
|
+
__exportStar(require('./math/repeg'), exports);
|
|
87
|
+
__exportStar(require('./orders'), exports);
|
|
88
|
+
__exportStar(require('./orderParams'), exports);
|
|
89
|
+
__exportStar(require('./slot/SlotSubscriber'), exports);
|
|
90
|
+
__exportStar(require('./wallet'), exports);
|
|
91
|
+
__exportStar(require('./types'), exports);
|
|
92
|
+
__exportStar(require('./math/utils'), exports);
|
|
93
|
+
__exportStar(require('./config'), exports);
|
|
94
|
+
__exportStar(require('./constants/numericConstants'), exports);
|
|
95
|
+
__exportStar(require('./tx/retryTxSender'), exports);
|
|
96
|
+
__exportStar(require('./util/computeUnits'), exports);
|
|
97
|
+
__exportStar(require('./util/tps'), exports);
|
|
98
|
+
__exportStar(require('./math/bankBalance'), exports);
|
|
99
|
+
__exportStar(require('./constants/banks'), exports);
|
|
100
|
+
__exportStar(require('./clearingHouseConfig'), exports);
|
package/src/index.ts
CHANGED
|
@@ -2,7 +2,7 @@ import { BN } from '@project-serum/anchor';
|
|
|
2
2
|
import { PublicKey } from '@solana/web3.js';
|
|
3
3
|
import pyth from '@pythnetwork/client';
|
|
4
4
|
|
|
5
|
-
export * from './
|
|
5
|
+
export * from './tokenFaucet';
|
|
6
6
|
export * from './oracles/types';
|
|
7
7
|
export * from './oracles/pythClient';
|
|
8
8
|
export * from './oracles/switchboardClient';
|