@drift-labs/sdk 2.97.0-beta.27 → 2.97.0-beta.28
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/browser/index.d.ts +7 -0
- package/lib/browser/index.js +7 -0
- package/lib/browser/oracles/pythClient.d.ts +0 -1
- package/lib/browser/oracles/pythClient.js +1 -2
- package/lib/node/index.d.ts +7 -0
- package/lib/node/index.js +7 -0
- package/lib/node/oracles/pythClient.d.ts +0 -1
- package/lib/node/oracles/pythClient.js +1 -2
- package/package.json +1 -1
- package/src/index.ts +7 -0
- package/src/oracles/pythClient.ts +1 -5
package/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
2.97.0-beta.
|
|
1
|
+
2.97.0-beta.28
|
package/lib/browser/index.d.ts
CHANGED
|
@@ -24,12 +24,14 @@ export * from './accounts/oneShotUserAccountSubscriber';
|
|
|
24
24
|
export * from './accounts/types';
|
|
25
25
|
export * from './addresses/pda';
|
|
26
26
|
export * from './adminClient';
|
|
27
|
+
export * from './assert/assert';
|
|
27
28
|
export * from './testClient';
|
|
28
29
|
export * from './user';
|
|
29
30
|
export * from './userConfig';
|
|
30
31
|
export * from './userStats';
|
|
31
32
|
export * from './userName';
|
|
32
33
|
export * from './userStatsConfig';
|
|
34
|
+
export * from './decode/user';
|
|
33
35
|
export * from './driftClient';
|
|
34
36
|
export * from './factory/oracleClient';
|
|
35
37
|
export * from './factory/bigNum';
|
|
@@ -58,6 +60,7 @@ export * from './math/insurance';
|
|
|
58
60
|
export * from './math/superStake';
|
|
59
61
|
export * from './math/spotPosition';
|
|
60
62
|
export * from './math/state';
|
|
63
|
+
export * from './math/tiers';
|
|
61
64
|
export * from './marinade';
|
|
62
65
|
export * from './orderParams';
|
|
63
66
|
export * from './slot/SlotSubscriber';
|
|
@@ -75,6 +78,9 @@ export * from './priorityFee';
|
|
|
75
78
|
export * from './phoenix/phoenixFulfillmentConfigMap';
|
|
76
79
|
export * from './openbook/openbookV2Subscriber';
|
|
77
80
|
export * from './openbook/openbookV2FulfillmentConfigMap';
|
|
81
|
+
export * from './oracles/pythClient';
|
|
82
|
+
export * from './oracles/pythPullClient';
|
|
83
|
+
export * from './oracles/switchboardOnDemandClient';
|
|
78
84
|
export * from './tx/fastSingleTxSender';
|
|
79
85
|
export * from './tx/retryTxSender';
|
|
80
86
|
export * from './tx/whileValidTxSender';
|
|
@@ -85,6 +91,7 @@ export * from './tx/txHandler';
|
|
|
85
91
|
export * from './util/computeUnits';
|
|
86
92
|
export * from './util/tps';
|
|
87
93
|
export * from './util/promiseTimeout';
|
|
94
|
+
export * from './util/pythPullOracleUtils';
|
|
88
95
|
export * from './math/spotBalance';
|
|
89
96
|
export * from './constants/spotMarkets';
|
|
90
97
|
export * from './driftClientConfig';
|
package/lib/browser/index.js
CHANGED
|
@@ -47,12 +47,14 @@ __exportStar(require("./accounts/oneShotUserAccountSubscriber"), exports);
|
|
|
47
47
|
__exportStar(require("./accounts/types"), exports);
|
|
48
48
|
__exportStar(require("./addresses/pda"), exports);
|
|
49
49
|
__exportStar(require("./adminClient"), exports);
|
|
50
|
+
__exportStar(require("./assert/assert"), exports);
|
|
50
51
|
__exportStar(require("./testClient"), exports);
|
|
51
52
|
__exportStar(require("./user"), exports);
|
|
52
53
|
__exportStar(require("./userConfig"), exports);
|
|
53
54
|
__exportStar(require("./userStats"), exports);
|
|
54
55
|
__exportStar(require("./userName"), exports);
|
|
55
56
|
__exportStar(require("./userStatsConfig"), exports);
|
|
57
|
+
__exportStar(require("./decode/user"), exports);
|
|
56
58
|
__exportStar(require("./driftClient"), exports);
|
|
57
59
|
__exportStar(require("./factory/oracleClient"), exports);
|
|
58
60
|
__exportStar(require("./factory/bigNum"), exports);
|
|
@@ -81,6 +83,7 @@ __exportStar(require("./math/insurance"), exports);
|
|
|
81
83
|
__exportStar(require("./math/superStake"), exports);
|
|
82
84
|
__exportStar(require("./math/spotPosition"), exports);
|
|
83
85
|
__exportStar(require("./math/state"), exports);
|
|
86
|
+
__exportStar(require("./math/tiers"), exports);
|
|
84
87
|
__exportStar(require("./marinade"), exports);
|
|
85
88
|
__exportStar(require("./orderParams"), exports);
|
|
86
89
|
__exportStar(require("./slot/SlotSubscriber"), exports);
|
|
@@ -98,6 +101,9 @@ __exportStar(require("./priorityFee"), exports);
|
|
|
98
101
|
__exportStar(require("./phoenix/phoenixFulfillmentConfigMap"), exports);
|
|
99
102
|
__exportStar(require("./openbook/openbookV2Subscriber"), exports);
|
|
100
103
|
__exportStar(require("./openbook/openbookV2FulfillmentConfigMap"), exports);
|
|
104
|
+
__exportStar(require("./oracles/pythClient"), exports);
|
|
105
|
+
__exportStar(require("./oracles/pythPullClient"), exports);
|
|
106
|
+
__exportStar(require("./oracles/switchboardOnDemandClient"), exports);
|
|
101
107
|
__exportStar(require("./tx/fastSingleTxSender"), exports);
|
|
102
108
|
__exportStar(require("./tx/retryTxSender"), exports);
|
|
103
109
|
__exportStar(require("./tx/whileValidTxSender"), exports);
|
|
@@ -108,6 +114,7 @@ __exportStar(require("./tx/txHandler"), exports);
|
|
|
108
114
|
__exportStar(require("./util/computeUnits"), exports);
|
|
109
115
|
__exportStar(require("./util/tps"), exports);
|
|
110
116
|
__exportStar(require("./util/promiseTimeout"), exports);
|
|
117
|
+
__exportStar(require("./util/pythPullOracleUtils"), exports);
|
|
111
118
|
__exportStar(require("./math/spotBalance"), exports);
|
|
112
119
|
__exportStar(require("./constants/spotMarkets"), exports);
|
|
113
120
|
__exportStar(require("./driftClientConfig"), exports);
|
|
@@ -12,4 +12,3 @@ export declare class PythClient implements OracleClient {
|
|
|
12
12
|
getOraclePriceData(pricePublicKey: PublicKey): Promise<OraclePriceData>;
|
|
13
13
|
getOraclePriceDataFromBuffer(buffer: Buffer): OraclePriceData;
|
|
14
14
|
}
|
|
15
|
-
export declare function convertPythPrice(price: number, exponent: number, multiple: BN): BN;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PythClient = void 0;
|
|
4
4
|
const client_1 = require("@pythnetwork/client");
|
|
5
5
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
6
6
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
@@ -40,7 +40,6 @@ function convertPythPrice(price, exponent, multiple) {
|
|
|
40
40
|
.mul(numericConstants_1.PRICE_PRECISION)
|
|
41
41
|
.div(pythPrecision);
|
|
42
42
|
}
|
|
43
|
-
exports.convertPythPrice = convertPythPrice;
|
|
44
43
|
const fiveBPS = new anchor_1.BN(500);
|
|
45
44
|
function getStableCoinPrice(price, confidence) {
|
|
46
45
|
if (price.sub(numericConstants_1.QUOTE_PRECISION).abs().lt(anchor_1.BN.min(confidence, fiveBPS))) {
|
package/lib/node/index.d.ts
CHANGED
|
@@ -24,12 +24,14 @@ export * from './accounts/oneShotUserAccountSubscriber';
|
|
|
24
24
|
export * from './accounts/types';
|
|
25
25
|
export * from './addresses/pda';
|
|
26
26
|
export * from './adminClient';
|
|
27
|
+
export * from './assert/assert';
|
|
27
28
|
export * from './testClient';
|
|
28
29
|
export * from './user';
|
|
29
30
|
export * from './userConfig';
|
|
30
31
|
export * from './userStats';
|
|
31
32
|
export * from './userName';
|
|
32
33
|
export * from './userStatsConfig';
|
|
34
|
+
export * from './decode/user';
|
|
33
35
|
export * from './driftClient';
|
|
34
36
|
export * from './factory/oracleClient';
|
|
35
37
|
export * from './factory/bigNum';
|
|
@@ -58,6 +60,7 @@ export * from './math/insurance';
|
|
|
58
60
|
export * from './math/superStake';
|
|
59
61
|
export * from './math/spotPosition';
|
|
60
62
|
export * from './math/state';
|
|
63
|
+
export * from './math/tiers';
|
|
61
64
|
export * from './marinade';
|
|
62
65
|
export * from './orderParams';
|
|
63
66
|
export * from './slot/SlotSubscriber';
|
|
@@ -75,6 +78,9 @@ export * from './priorityFee';
|
|
|
75
78
|
export * from './phoenix/phoenixFulfillmentConfigMap';
|
|
76
79
|
export * from './openbook/openbookV2Subscriber';
|
|
77
80
|
export * from './openbook/openbookV2FulfillmentConfigMap';
|
|
81
|
+
export * from './oracles/pythClient';
|
|
82
|
+
export * from './oracles/pythPullClient';
|
|
83
|
+
export * from './oracles/switchboardOnDemandClient';
|
|
78
84
|
export * from './tx/fastSingleTxSender';
|
|
79
85
|
export * from './tx/retryTxSender';
|
|
80
86
|
export * from './tx/whileValidTxSender';
|
|
@@ -85,6 +91,7 @@ export * from './tx/txHandler';
|
|
|
85
91
|
export * from './util/computeUnits';
|
|
86
92
|
export * from './util/tps';
|
|
87
93
|
export * from './util/promiseTimeout';
|
|
94
|
+
export * from './util/pythPullOracleUtils';
|
|
88
95
|
export * from './math/spotBalance';
|
|
89
96
|
export * from './constants/spotMarkets';
|
|
90
97
|
export * from './driftClientConfig';
|
package/lib/node/index.js
CHANGED
|
@@ -47,12 +47,14 @@ __exportStar(require("./accounts/oneShotUserAccountSubscriber"), exports);
|
|
|
47
47
|
__exportStar(require("./accounts/types"), exports);
|
|
48
48
|
__exportStar(require("./addresses/pda"), exports);
|
|
49
49
|
__exportStar(require("./adminClient"), exports);
|
|
50
|
+
__exportStar(require("./assert/assert"), exports);
|
|
50
51
|
__exportStar(require("./testClient"), exports);
|
|
51
52
|
__exportStar(require("./user"), exports);
|
|
52
53
|
__exportStar(require("./userConfig"), exports);
|
|
53
54
|
__exportStar(require("./userStats"), exports);
|
|
54
55
|
__exportStar(require("./userName"), exports);
|
|
55
56
|
__exportStar(require("./userStatsConfig"), exports);
|
|
57
|
+
__exportStar(require("./decode/user"), exports);
|
|
56
58
|
__exportStar(require("./driftClient"), exports);
|
|
57
59
|
__exportStar(require("./factory/oracleClient"), exports);
|
|
58
60
|
__exportStar(require("./factory/bigNum"), exports);
|
|
@@ -81,6 +83,7 @@ __exportStar(require("./math/insurance"), exports);
|
|
|
81
83
|
__exportStar(require("./math/superStake"), exports);
|
|
82
84
|
__exportStar(require("./math/spotPosition"), exports);
|
|
83
85
|
__exportStar(require("./math/state"), exports);
|
|
86
|
+
__exportStar(require("./math/tiers"), exports);
|
|
84
87
|
__exportStar(require("./marinade"), exports);
|
|
85
88
|
__exportStar(require("./orderParams"), exports);
|
|
86
89
|
__exportStar(require("./slot/SlotSubscriber"), exports);
|
|
@@ -98,6 +101,9 @@ __exportStar(require("./priorityFee"), exports);
|
|
|
98
101
|
__exportStar(require("./phoenix/phoenixFulfillmentConfigMap"), exports);
|
|
99
102
|
__exportStar(require("./openbook/openbookV2Subscriber"), exports);
|
|
100
103
|
__exportStar(require("./openbook/openbookV2FulfillmentConfigMap"), exports);
|
|
104
|
+
__exportStar(require("./oracles/pythClient"), exports);
|
|
105
|
+
__exportStar(require("./oracles/pythPullClient"), exports);
|
|
106
|
+
__exportStar(require("./oracles/switchboardOnDemandClient"), exports);
|
|
101
107
|
__exportStar(require("./tx/fastSingleTxSender"), exports);
|
|
102
108
|
__exportStar(require("./tx/retryTxSender"), exports);
|
|
103
109
|
__exportStar(require("./tx/whileValidTxSender"), exports);
|
|
@@ -108,6 +114,7 @@ __exportStar(require("./tx/txHandler"), exports);
|
|
|
108
114
|
__exportStar(require("./util/computeUnits"), exports);
|
|
109
115
|
__exportStar(require("./util/tps"), exports);
|
|
110
116
|
__exportStar(require("./util/promiseTimeout"), exports);
|
|
117
|
+
__exportStar(require("./util/pythPullOracleUtils"), exports);
|
|
111
118
|
__exportStar(require("./math/spotBalance"), exports);
|
|
112
119
|
__exportStar(require("./constants/spotMarkets"), exports);
|
|
113
120
|
__exportStar(require("./driftClientConfig"), exports);
|
|
@@ -12,4 +12,3 @@ export declare class PythClient implements OracleClient {
|
|
|
12
12
|
getOraclePriceData(pricePublicKey: PublicKey): Promise<OraclePriceData>;
|
|
13
13
|
getOraclePriceDataFromBuffer(buffer: Buffer): OraclePriceData;
|
|
14
14
|
}
|
|
15
|
-
export declare function convertPythPrice(price: number, exponent: number, multiple: BN): BN;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.PythClient = void 0;
|
|
4
4
|
const client_1 = require("@pythnetwork/client");
|
|
5
5
|
const anchor_1 = require("@coral-xyz/anchor");
|
|
6
6
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
@@ -40,7 +40,6 @@ function convertPythPrice(price, exponent, multiple) {
|
|
|
40
40
|
.mul(numericConstants_1.PRICE_PRECISION)
|
|
41
41
|
.div(pythPrecision);
|
|
42
42
|
}
|
|
43
|
-
exports.convertPythPrice = convertPythPrice;
|
|
44
43
|
const fiveBPS = new anchor_1.BN(500);
|
|
45
44
|
function getStableCoinPrice(price, confidence) {
|
|
46
45
|
if (price.sub(numericConstants_1.QUOTE_PRECISION).abs().lt(anchor_1.BN.min(confidence, fiveBPS))) {
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -25,12 +25,14 @@ export * from './accounts/oneShotUserAccountSubscriber';
|
|
|
25
25
|
export * from './accounts/types';
|
|
26
26
|
export * from './addresses/pda';
|
|
27
27
|
export * from './adminClient';
|
|
28
|
+
export * from './assert/assert';
|
|
28
29
|
export * from './testClient';
|
|
29
30
|
export * from './user';
|
|
30
31
|
export * from './userConfig';
|
|
31
32
|
export * from './userStats';
|
|
32
33
|
export * from './userName';
|
|
33
34
|
export * from './userStatsConfig';
|
|
35
|
+
export * from './decode/user';
|
|
34
36
|
export * from './driftClient';
|
|
35
37
|
export * from './factory/oracleClient';
|
|
36
38
|
export * from './factory/bigNum';
|
|
@@ -59,6 +61,7 @@ export * from './math/insurance';
|
|
|
59
61
|
export * from './math/superStake';
|
|
60
62
|
export * from './math/spotPosition';
|
|
61
63
|
export * from './math/state';
|
|
64
|
+
export * from './math/tiers';
|
|
62
65
|
export * from './marinade';
|
|
63
66
|
export * from './orderParams';
|
|
64
67
|
export * from './slot/SlotSubscriber';
|
|
@@ -76,6 +79,9 @@ export * from './priorityFee';
|
|
|
76
79
|
export * from './phoenix/phoenixFulfillmentConfigMap';
|
|
77
80
|
export * from './openbook/openbookV2Subscriber';
|
|
78
81
|
export * from './openbook/openbookV2FulfillmentConfigMap';
|
|
82
|
+
export * from './oracles/pythClient';
|
|
83
|
+
export * from './oracles/pythPullClient';
|
|
84
|
+
export * from './oracles/switchboardOnDemandClient';
|
|
79
85
|
export * from './tx/fastSingleTxSender';
|
|
80
86
|
export * from './tx/retryTxSender';
|
|
81
87
|
export * from './tx/whileValidTxSender';
|
|
@@ -86,6 +92,7 @@ export * from './tx/txHandler';
|
|
|
86
92
|
export * from './util/computeUnits';
|
|
87
93
|
export * from './util/tps';
|
|
88
94
|
export * from './util/promiseTimeout';
|
|
95
|
+
export * from './util/pythPullOracleUtils';
|
|
89
96
|
export * from './math/spotBalance';
|
|
90
97
|
export * from './constants/spotMarkets';
|
|
91
98
|
export * from './driftClientConfig';
|
|
@@ -67,11 +67,7 @@ export class PythClient implements OracleClient {
|
|
|
67
67
|
}
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
|
|
71
|
-
price: number,
|
|
72
|
-
exponent: number,
|
|
73
|
-
multiple: BN
|
|
74
|
-
): BN {
|
|
70
|
+
function convertPythPrice(price: number, exponent: number, multiple: BN): BN {
|
|
75
71
|
exponent = Math.abs(exponent);
|
|
76
72
|
const pythPrecision = TEN.pow(new BN(exponent).abs()).div(multiple);
|
|
77
73
|
return new BN(price * Math.pow(10, exponent))
|