@velocity-exchange/sdk 0.0.2 → 0.0.5
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/CHANGELOG.md +15 -0
- package/README.md +5 -6
- package/bunfig.toml +3 -0
- package/lib/browser/auctionSubscriber/auctionSubscriber.d.ts +4 -2
- package/lib/browser/auctionSubscriber/auctionSubscriber.js +9 -4
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.d.ts +4 -2
- package/lib/browser/auctionSubscriber/auctionSubscriberGrpc.js +9 -4
- package/lib/browser/auctionSubscriber/types.d.ts +4 -2
- package/lib/browser/config.d.ts +3 -8
- package/lib/browser/config.js +14 -22
- package/lib/browser/constituentMap/constituentMap.d.ts +4 -2
- package/lib/browser/constituentMap/constituentMap.js +14 -10
- package/lib/browser/core/VelocityCore.d.ts +4 -0
- package/lib/browser/core/VelocityCore.js +3 -1
- package/lib/browser/decode/user.js +5 -5
- package/lib/browser/dlob/DLOB.js +1 -1
- package/lib/browser/dlob/DLOBNode.js +1 -2
- package/lib/browser/dlob/DLOBSubscriber.d.ts +3 -1
- package/lib/browser/dlob/DLOBSubscriber.js +19 -10
- package/lib/browser/dlob/types.d.ts +3 -1
- package/lib/browser/idl/drift.d.ts +59 -6
- package/lib/browser/idl/drift.json +6049 -806
- package/lib/browser/math/auction.d.ts +1 -1
- package/lib/browser/math/auction.js +2 -9
- package/lib/browser/math/orders.js +3 -3
- package/lib/browser/orderSubscriber/OrderSubscriber.d.ts +3 -1
- package/lib/browser/orderSubscriber/OrderSubscriber.js +19 -11
- package/lib/browser/orderSubscriber/types.d.ts +3 -1
- package/lib/browser/priorityFee/priorityFeeSubscriber.d.ts +4 -2
- package/lib/browser/priorityFee/priorityFeeSubscriber.js +15 -11
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.d.ts +11 -9
- package/lib/browser/priorityFee/priorityFeeSubscriberMap.js +18 -18
- package/lib/browser/priorityFee/types.d.ts +9 -5
- package/lib/browser/priorityFee/types.js +1 -1
- package/lib/browser/swift/grpcSignedMsgUserAccountSubscriber.d.ts +3 -12
- package/lib/browser/swift/grpcSignedMsgUserAccountSubscriber.js +3 -9
- package/lib/browser/swift/signedMsgUserAccountSubscriber.d.ts +11 -8
- package/lib/browser/swift/signedMsgUserAccountSubscriber.js +10 -5
- package/lib/browser/swift/swiftOrderSubscriber.d.ts +7 -4
- package/lib/browser/swift/swiftOrderSubscriber.js +19 -11
- package/lib/browser/types.d.ts +2 -2
- package/lib/browser/user.d.ts +3 -1
- package/lib/browser/user.js +93 -86
- package/lib/browser/userConfig.d.ts +4 -2
- package/lib/browser/userMap/referrerMap.d.ts +5 -3
- package/lib/browser/userMap/referrerMap.js +18 -14
- package/lib/browser/userMap/revenueShareEscrowMap.d.ts +5 -3
- package/lib/browser/userMap/revenueShareEscrowMap.js +18 -14
- package/lib/browser/userMap/userMap.d.ts +3 -1
- package/lib/browser/userMap/userMap.js +24 -19
- package/lib/browser/userMap/userMapConfig.d.ts +4 -2
- package/lib/browser/userMap/userStatsMap.d.ts +5 -3
- package/lib/browser/userMap/userStatsMap.js +15 -11
- package/lib/browser/userStats.d.ts +3 -1
- package/lib/browser/userStats.js +21 -15
- package/lib/browser/userStatsConfig.d.ts +4 -2
- package/lib/browser/util/deprecatedAlias.d.ts +26 -0
- package/lib/browser/util/deprecatedAlias.js +10 -0
- package/lib/browser/velocityClient.d.ts +6 -6
- package/lib/browser/velocityClient.js +6 -6
- package/lib/browser/velocityClientConfig.d.ts +7 -4
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts +4 -2
- package/lib/node/auctionSubscriber/auctionSubscriber.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriber.js +9 -4
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts +4 -2
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.d.ts.map +1 -1
- package/lib/node/auctionSubscriber/auctionSubscriberGrpc.js +9 -4
- package/lib/node/auctionSubscriber/types.d.ts +4 -2
- package/lib/node/auctionSubscriber/types.d.ts.map +1 -1
- package/lib/node/config.d.ts +3 -8
- package/lib/node/config.d.ts.map +1 -1
- package/lib/node/config.js +14 -22
- package/lib/node/constituentMap/constituentMap.d.ts +4 -2
- package/lib/node/constituentMap/constituentMap.d.ts.map +1 -1
- package/lib/node/constituentMap/constituentMap.js +14 -10
- package/lib/node/core/VelocityCore.d.ts +4 -0
- package/lib/node/core/VelocityCore.d.ts.map +1 -1
- package/lib/node/core/VelocityCore.js +3 -1
- package/lib/node/decode/user.js +5 -5
- package/lib/node/dlob/DLOB.js +1 -1
- package/lib/node/dlob/DLOBNode.js +1 -2
- package/lib/node/dlob/DLOBSubscriber.d.ts +3 -1
- package/lib/node/dlob/DLOBSubscriber.d.ts.map +1 -1
- package/lib/node/dlob/DLOBSubscriber.js +19 -10
- package/lib/node/dlob/types.d.ts +3 -1
- package/lib/node/dlob/types.d.ts.map +1 -1
- package/lib/node/idl/drift.d.ts +59 -6
- package/lib/node/idl/drift.d.ts.map +1 -1
- package/lib/node/idl/drift.json +6049 -806
- package/lib/node/math/auction.d.ts +1 -1
- package/lib/node/math/auction.d.ts.map +1 -1
- package/lib/node/math/auction.js +2 -9
- package/lib/node/math/orders.d.ts.map +1 -1
- package/lib/node/math/orders.js +3 -3
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts +3 -1
- package/lib/node/orderSubscriber/OrderSubscriber.d.ts.map +1 -1
- package/lib/node/orderSubscriber/OrderSubscriber.js +19 -11
- package/lib/node/orderSubscriber/types.d.ts +3 -1
- package/lib/node/orderSubscriber/types.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts +4 -2
- package/lib/node/priorityFee/priorityFeeSubscriber.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriber.js +15 -11
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts +11 -9
- package/lib/node/priorityFee/priorityFeeSubscriberMap.d.ts.map +1 -1
- package/lib/node/priorityFee/priorityFeeSubscriberMap.js +18 -18
- package/lib/node/priorityFee/types.d.ts +9 -5
- package/lib/node/priorityFee/types.d.ts.map +1 -1
- package/lib/node/priorityFee/types.js +1 -1
- package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.d.ts +3 -12
- package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/swift/grpcSignedMsgUserAccountSubscriber.js +3 -9
- package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts +11 -8
- package/lib/node/swift/signedMsgUserAccountSubscriber.d.ts.map +1 -1
- package/lib/node/swift/signedMsgUserAccountSubscriber.js +10 -5
- package/lib/node/swift/swiftOrderSubscriber.d.ts +7 -4
- package/lib/node/swift/swiftOrderSubscriber.d.ts.map +1 -1
- package/lib/node/swift/swiftOrderSubscriber.js +19 -11
- package/lib/node/types.d.ts +2 -2
- package/lib/node/types.d.ts.map +1 -1
- package/lib/node/user.d.ts +3 -1
- package/lib/node/user.d.ts.map +1 -1
- package/lib/node/user.js +93 -86
- package/lib/node/userConfig.d.ts +4 -2
- package/lib/node/userConfig.d.ts.map +1 -1
- package/lib/node/userMap/referrerMap.d.ts +5 -3
- package/lib/node/userMap/referrerMap.d.ts.map +1 -1
- package/lib/node/userMap/referrerMap.js +18 -14
- package/lib/node/userMap/revenueShareEscrowMap.d.ts +5 -3
- package/lib/node/userMap/revenueShareEscrowMap.d.ts.map +1 -1
- package/lib/node/userMap/revenueShareEscrowMap.js +18 -14
- package/lib/node/userMap/userMap.d.ts +3 -1
- package/lib/node/userMap/userMap.d.ts.map +1 -1
- package/lib/node/userMap/userMap.js +24 -19
- package/lib/node/userMap/userMapConfig.d.ts +4 -2
- package/lib/node/userMap/userMapConfig.d.ts.map +1 -1
- package/lib/node/userMap/userStatsMap.d.ts +5 -3
- package/lib/node/userMap/userStatsMap.d.ts.map +1 -1
- package/lib/node/userMap/userStatsMap.js +15 -11
- package/lib/node/userStats.d.ts +3 -1
- package/lib/node/userStats.d.ts.map +1 -1
- package/lib/node/userStats.js +21 -15
- package/lib/node/userStatsConfig.d.ts +4 -2
- package/lib/node/userStatsConfig.d.ts.map +1 -1
- package/lib/node/util/deprecatedAlias.d.ts +27 -0
- package/lib/node/util/deprecatedAlias.d.ts.map +1 -0
- package/lib/node/util/deprecatedAlias.js +10 -0
- package/lib/node/velocityClient.d.ts +6 -6
- package/lib/node/velocityClient.d.ts.map +1 -1
- package/lib/node/velocityClient.js +6 -6
- package/lib/node/velocityClientConfig.d.ts +7 -4
- package/lib/node/velocityClientConfig.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/auctionSubscriber/auctionSubscriber.ts +12 -6
- package/src/auctionSubscriber/auctionSubscriberGrpc.ts +12 -6
- package/src/auctionSubscriber/types.ts +5 -2
- package/src/config.ts +38 -27
- package/src/constituentMap/constituentMap.ts +17 -9
- package/src/core/VelocityCore.ts +6 -0
- package/src/decode/user.ts +5 -5
- package/src/dlob/DLOB.ts +1 -1
- package/src/dlob/DLOBNode.ts +1 -1
- package/src/dlob/DLOBSubscriber.ts +21 -11
- package/src/dlob/types.ts +3 -1
- package/src/idl/drift.json +23940 -18697
- package/src/idl/drift.ts +59 -6
- package/src/math/auction.ts +3 -10
- package/src/math/orders.ts +3 -6
- package/src/orderSubscriber/OrderSubscriber.ts +17 -7
- package/src/orderSubscriber/types.ts +3 -1
- package/src/priorityFee/priorityFeeSubscriber.ts +13 -9
- package/src/priorityFee/priorityFeeSubscriberMap.ts +23 -25
- package/src/priorityFee/types.ts +19 -9
- package/src/swift/grpcSignedMsgUserAccountSubscriber.ts +10 -23
- package/src/swift/signedMsgUserAccountSubscriber.ts +22 -14
- package/src/swift/swiftOrderSubscriber.ts +24 -16
- package/src/types.ts +2 -2
- package/src/user.ts +93 -82
- package/src/userConfig.ts +5 -2
- package/src/userMap/referrerMap.ts +19 -15
- package/src/userMap/revenueShareEscrowMap.ts +20 -16
- package/src/userMap/userMap.ts +20 -15
- package/src/userMap/userMapConfig.ts +6 -3
- package/src/userMap/userStatsMap.ts +19 -15
- package/src/userStats.ts +13 -7
- package/src/userStatsConfig.ts +5 -2
- package/src/util/deprecatedAlias.ts +21 -0
- package/src/velocityClient.ts +12 -12
- package/src/velocityClientConfig.ts +27 -42
- package/tests/auctions/test.ts +4 -4
- package/tests/decode/test.ts +1 -1
- package/tests/dlob/test.ts +5 -5
- package/tests/user/helpers.ts +1 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
## [0.0.5](https://github.com/drift-labs/protocol-v2-shadow/compare/sdk-v0.0.4...sdk-v0.0.5) (2026-05-28)
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
### Refactors
|
|
7
|
+
|
|
8
|
+
* increase oracle_price_offset to i64 ([#51](https://github.com/drift-labs/protocol-v2-shadow/issues/51)) ([d04039a](https://github.com/drift-labs/protocol-v2-shadow/commit/d04039a22b2ff37d05afd8fe271b9913d66689e1))
|
|
9
|
+
|
|
10
|
+
## [0.0.4](https://github.com/drift-labs/protocol-v2-shadow/compare/sdk-v0.0.3...sdk-v0.0.4) (2026-05-28)
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
### Refactors
|
|
14
|
+
|
|
15
|
+
* increase oracle_price_offset to i64 ([#51](https://github.com/drift-labs/protocol-v2-shadow/issues/51)) ([d04039a](https://github.com/drift-labs/protocol-v2-shadow/commit/d04039a22b2ff37d05afd8fe271b9913d66689e1))
|
package/README.md
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
-
<img height="
|
|
2
|
+
<img height="120" src="https://raw.githubusercontent.com/drift-labs/protocol-v2-shadow/master/assets/velocity-logo.svg" />
|
|
3
3
|
|
|
4
|
-
<h1 style="margin-top:20px;">
|
|
4
|
+
<h1 style="margin-top:20px;">Velocity Exchange</h1>
|
|
5
5
|
|
|
6
6
|
<p>
|
|
7
|
-
<a href="https://www.npmjs.com/package/@
|
|
7
|
+
<a href="https://www.npmjs.com/package/@velocity-exchange/sdk"><img alt="SDK npm package" src="https://img.shields.io/npm/v/@velocity-exchange/sdk" /></a>
|
|
8
8
|
<a href="https://drift-labs.github.io/protocol-v2/sdk/"><img alt="Docs" src="https://img.shields.io/badge/docs-tutorials-blueviolet" /></a>
|
|
9
9
|
<a href="https://discord.com/channels/849494028176588802/878700556904980500"><img alt="Discord Chat" src="https://img.shields.io/discord/889577356681945098?color=blueviolet" /></a>
|
|
10
10
|
<a href="https://opensource.org/licenses/Apache-2.0"><img alt="License" src="https://img.shields.io/github/license/project-serum/anchor?color=blueviolet" /></a>
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
## Installation
|
|
15
15
|
|
|
16
16
|
```
|
|
17
|
-
npm i @
|
|
17
|
+
npm i @velocity-exchange/sdk
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
## Getting Started
|
|
@@ -75,7 +75,7 @@ The Drift SDK uses some common precisions, which are available as constants to i
|
|
|
75
75
|
Because BN only supports integers, you need to be conscious of the numbers you are using when dividing. BN will return the floor when using the regular division function; if you want to get the exact division, you need to add the modulus of the two numbers as well. There is a helper function `convertToNumber` in the SDK which will do this for you.
|
|
76
76
|
|
|
77
77
|
```typescript
|
|
78
|
-
import {convertToNumber} from @
|
|
78
|
+
import { convertToNumber } from '@velocity-exchange/sdk';
|
|
79
79
|
|
|
80
80
|
// Gets the floor value
|
|
81
81
|
new BN(10500).div(new BN(1000)).toNumber(); // = 10
|
|
@@ -272,4 +272,3 @@ Drift Protocol v2 is licensed under [Apache 2.0](./LICENSE).
|
|
|
272
272
|
Unless you explicitly state otherwise, any contribution intentionally submitted
|
|
273
273
|
for inclusion in Drift SDK by you, as defined in the Apache-2.0 license, shall be
|
|
274
274
|
licensed as above, without any additional terms or conditions.
|
|
275
|
-
|
package/bunfig.toml
ADDED
|
@@ -3,12 +3,14 @@ import { AuctionSubscriberConfig, AuctionSubscriberEvents } from './types';
|
|
|
3
3
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
export declare class AuctionSubscriber {
|
|
6
|
-
private
|
|
6
|
+
private velocityClient;
|
|
7
|
+
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
8
|
+
private get driftClient();
|
|
7
9
|
private opts;
|
|
8
10
|
private resubOpts?;
|
|
9
11
|
eventEmitter: StrictEventEmitter<EventEmitter, AuctionSubscriberEvents>;
|
|
10
12
|
private subscriber;
|
|
11
|
-
constructor({ driftClient, opts, resubTimeoutMs, logResubMessages, }: AuctionSubscriberConfig);
|
|
13
|
+
constructor({ velocityClient, driftClient, opts, resubTimeoutMs, logResubMessages, }: AuctionSubscriberConfig);
|
|
12
14
|
subscribe(): Promise<void>;
|
|
13
15
|
unsubscribe(): Promise<void>;
|
|
14
16
|
}
|
|
@@ -5,15 +5,20 @@ const memcmp_1 = require("../memcmp");
|
|
|
5
5
|
const events_1 = require("events");
|
|
6
6
|
const webSocketProgramAccountSubscriber_1 = require("../accounts/webSocketProgramAccountSubscriber");
|
|
7
7
|
class AuctionSubscriber {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
9
|
+
get driftClient() {
|
|
10
|
+
return this.velocityClient;
|
|
11
|
+
}
|
|
12
|
+
constructor({ velocityClient, driftClient, opts, resubTimeoutMs, logResubMessages, }) {
|
|
13
|
+
// Type-system guarantees at least one of the two is supplied.
|
|
14
|
+
this.velocityClient = (velocityClient !== null && velocityClient !== void 0 ? velocityClient : driftClient);
|
|
15
|
+
this.opts = opts || this.velocityClient.opts;
|
|
11
16
|
this.eventEmitter = new events_1.EventEmitter();
|
|
12
17
|
this.resubOpts = { resubTimeoutMs, logResubMessages };
|
|
13
18
|
}
|
|
14
19
|
async subscribe() {
|
|
15
20
|
if (!this.subscriber) {
|
|
16
|
-
this.subscriber = new webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber('AuctionSubscriber', 'user', this.
|
|
21
|
+
this.subscriber = new webSocketProgramAccountSubscriber_1.WebSocketProgramAccountSubscriber('AuctionSubscriber', 'user', this.velocityClient.program, this.velocityClient.program.account.user.coder.accounts.decode.bind(this.velocityClient.program.account.user.coder.accounts), {
|
|
17
22
|
filters: [(0, memcmp_1.getUserFilter)(), (0, memcmp_1.getUserWithAuctionFilter)()],
|
|
18
23
|
commitment: this.opts.commitment,
|
|
19
24
|
}, this.resubOpts);
|
|
@@ -3,13 +3,15 @@ import { AuctionSubscriberConfig, AuctionSubscriberEvents } from './types';
|
|
|
3
3
|
import StrictEventEmitter from 'strict-event-emitter-types';
|
|
4
4
|
import { EventEmitter } from 'events';
|
|
5
5
|
export declare class AuctionSubscriberGrpc {
|
|
6
|
-
private
|
|
6
|
+
private velocityClient;
|
|
7
|
+
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
8
|
+
private get driftClient();
|
|
7
9
|
private opts;
|
|
8
10
|
private resubOpts?;
|
|
9
11
|
private grpcConfigs?;
|
|
10
12
|
eventEmitter: StrictEventEmitter<EventEmitter, AuctionSubscriberEvents>;
|
|
11
13
|
private subscriber;
|
|
12
|
-
constructor({ driftClient, opts, grpcConfigs, resubTimeoutMs, logResubMessages, }: AuctionSubscriberConfig);
|
|
14
|
+
constructor({ velocityClient, driftClient, opts, grpcConfigs, resubTimeoutMs, logResubMessages, }: AuctionSubscriberConfig);
|
|
13
15
|
subscribe(): Promise<void>;
|
|
14
16
|
unsubscribe(): Promise<void>;
|
|
15
17
|
}
|
|
@@ -5,16 +5,21 @@ const memcmp_1 = require("../memcmp");
|
|
|
5
5
|
const events_1 = require("events");
|
|
6
6
|
const grpcProgramAccountSubscriber_1 = require("../accounts/grpcProgramAccountSubscriber");
|
|
7
7
|
class AuctionSubscriberGrpc {
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
9
|
+
get driftClient() {
|
|
10
|
+
return this.velocityClient;
|
|
11
|
+
}
|
|
12
|
+
constructor({ velocityClient, driftClient, opts, grpcConfigs, resubTimeoutMs, logResubMessages, }) {
|
|
13
|
+
// Type-system guarantees at least one of the two is supplied.
|
|
14
|
+
this.velocityClient = (velocityClient !== null && velocityClient !== void 0 ? velocityClient : driftClient);
|
|
15
|
+
this.opts = opts || this.velocityClient.opts;
|
|
11
16
|
this.eventEmitter = new events_1.EventEmitter();
|
|
12
17
|
this.resubOpts = { resubTimeoutMs, logResubMessages };
|
|
13
18
|
this.grpcConfigs = grpcConfigs;
|
|
14
19
|
}
|
|
15
20
|
async subscribe() {
|
|
16
21
|
if (!this.subscriber) {
|
|
17
|
-
this.subscriber = await grpcProgramAccountSubscriber_1.grpcProgramAccountSubscriber.create(this.grpcConfigs, 'AuctionSubscriber', 'user', this.
|
|
22
|
+
this.subscriber = await grpcProgramAccountSubscriber_1.grpcProgramAccountSubscriber.create(this.grpcConfigs, 'AuctionSubscriber', 'user', this.velocityClient.program, this.velocityClient.program.account.user.coder.accounts.decode.bind(this.velocityClient.program.account.user.coder.accounts), {
|
|
18
23
|
filters: [(0, memcmp_1.getUserFilter)(), (0, memcmp_1.getUserWithAuctionFilter)()],
|
|
19
24
|
}, this.resubOpts);
|
|
20
25
|
}
|
|
@@ -2,13 +2,15 @@ import { GrpcConfigs } from '../accounts/types';
|
|
|
2
2
|
import { VelocityClient } from '../velocityClient';
|
|
3
3
|
import { UserAccount } from '../types';
|
|
4
4
|
import { ConfirmOptions, PublicKey } from '@solana/web3.js';
|
|
5
|
-
|
|
6
|
-
|
|
5
|
+
import { AtLeastOne } from '../util/deprecatedAlias';
|
|
6
|
+
type AuctionSubscriberConfigBase = {
|
|
7
7
|
opts?: ConfirmOptions;
|
|
8
8
|
resubTimeoutMs?: number;
|
|
9
9
|
logResubMessages?: boolean;
|
|
10
10
|
grpcConfigs?: GrpcConfigs;
|
|
11
11
|
};
|
|
12
|
+
export type AuctionSubscriberConfig = AuctionSubscriberConfigBase & AtLeastOne<'velocityClient', 'driftClient', VelocityClient>;
|
|
12
13
|
export interface AuctionSubscriberEvents {
|
|
13
14
|
onAccountUpdate: (account: UserAccount, pubkey: PublicKey, slot: number) => void;
|
|
14
15
|
}
|
|
16
|
+
export {};
|
package/lib/browser/config.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export type DriftProgram = VelocityProgram;
|
|
|
11
11
|
export type VelocityEnv = 'devnet' | 'mainnet-beta';
|
|
12
12
|
/** @deprecated Use `VelocityEnv` instead. `DriftEnv` will be removed in a future major. */
|
|
13
13
|
export type DriftEnv = VelocityEnv;
|
|
14
|
+
/** Widened env type accepted by `initialize()`; `'master'` is a legacy alias for `'devnet'`. */
|
|
15
|
+
export type LegacyVelocityEnv = VelocityEnv | 'master';
|
|
14
16
|
export interface VelocityConfig {
|
|
15
17
|
ENV: VelocityEnv;
|
|
16
18
|
PYTH_ORACLE_MAPPING_ADDRESS: string;
|
|
@@ -50,15 +52,8 @@ export declare const configs: {
|
|
|
50
52
|
[key in VelocityEnv]: VelocityConfig;
|
|
51
53
|
};
|
|
52
54
|
export declare const getConfig: () => VelocityConfig;
|
|
53
|
-
/**
|
|
54
|
-
* Allows customization of the SDK's environment and endpoints. You can pass individual settings to override the settings with your own presets.
|
|
55
|
-
*
|
|
56
|
-
* Defaults to master environment if you don't use this function.
|
|
57
|
-
* @param props
|
|
58
|
-
* @returns
|
|
59
|
-
*/
|
|
60
55
|
export declare const initialize: (props: {
|
|
61
|
-
env:
|
|
56
|
+
env: LegacyVelocityEnv;
|
|
62
57
|
overrideEnv?: Partial<VelocityConfig>;
|
|
63
58
|
}) => VelocityConfig;
|
|
64
59
|
export declare function getMarketsAndOraclesForSubscription(env: VelocityEnv, perpMarkets?: PerpMarketConfig[], spotMarkets?: SpotMarketConfig[]): {
|
package/lib/browser/config.js
CHANGED
|
@@ -75,31 +75,23 @@ exports.getConfig = getConfig;
|
|
|
75
75
|
* @param props
|
|
76
76
|
* @returns
|
|
77
77
|
*/
|
|
78
|
+
/**
|
|
79
|
+
* Mirror a canonical/deprecated alias pair so the resolved config carries the
|
|
80
|
+
* same value under both keys regardless of which one the caller overrode.
|
|
81
|
+
*/
|
|
82
|
+
const mirrorAlias = (merged, override, canon, deprecated) => {
|
|
83
|
+
var _a, _b;
|
|
84
|
+
const value = (_b = (_a = override[canon]) !== null && _a !== void 0 ? _a : override[deprecated]) !== null && _b !== void 0 ? _b : merged[canon];
|
|
85
|
+
merged[canon] = value;
|
|
86
|
+
merged[deprecated] = value;
|
|
87
|
+
};
|
|
78
88
|
const initialize = (props) => {
|
|
79
89
|
var _a;
|
|
80
90
|
const override = (_a = props.overrideEnv) !== null && _a !== void 0 ? _a : {};
|
|
81
|
-
|
|
82
|
-
const
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
const overrodeDrift = 'DRIFT_PROGRAM_ID' in override;
|
|
86
|
-
if (overrodeVelocity && !overrodeDrift) {
|
|
87
|
-
merged.DRIFT_PROGRAM_ID = merged.VELOCITY_PROGRAM_ID;
|
|
88
|
-
}
|
|
89
|
-
else if (overrodeDrift && !overrodeVelocity) {
|
|
90
|
-
merged.VELOCITY_PROGRAM_ID = merged.DRIFT_PROGRAM_ID;
|
|
91
|
-
}
|
|
92
|
-
const overrodeVelocityOracleReceiver = 'VELOCITY_ORACLE_RECEIVER_ID' in override;
|
|
93
|
-
const overrodeDriftOracleReceiver = 'DRIFT_ORACLE_RECEIVER_ID' in override;
|
|
94
|
-
if (overrodeVelocityOracleReceiver && !overrodeDriftOracleReceiver) {
|
|
95
|
-
merged.DRIFT_ORACLE_RECEIVER_ID = merged.VELOCITY_ORACLE_RECEIVER_ID;
|
|
96
|
-
}
|
|
97
|
-
else if (overrodeDriftOracleReceiver && !overrodeVelocityOracleReceiver) {
|
|
98
|
-
merged.VELOCITY_ORACLE_RECEIVER_ID = merged.DRIFT_ORACLE_RECEIVER_ID;
|
|
99
|
-
}
|
|
100
|
-
//@ts-ignore
|
|
101
|
-
if (props.env === 'master')
|
|
102
|
-
return merged;
|
|
91
|
+
const normalizedEnv = props.env === 'master' ? 'devnet' : props.env;
|
|
92
|
+
const merged = { ...exports.configs[normalizedEnv], ...override };
|
|
93
|
+
mirrorAlias(merged, override, 'VELOCITY_PROGRAM_ID', 'DRIFT_PROGRAM_ID');
|
|
94
|
+
mirrorAlias(merged, override, 'VELOCITY_ORACLE_RECEIVER_ID', 'DRIFT_ORACLE_RECEIVER_ID');
|
|
103
95
|
currentConfig = merged;
|
|
104
96
|
return currentConfig;
|
|
105
97
|
};
|
|
@@ -3,7 +3,9 @@ import { DataAndSlot } from '../accounts/types';
|
|
|
3
3
|
import { ConstituentAccount } from '../types';
|
|
4
4
|
import { VelocityClient } from '../velocityClient';
|
|
5
5
|
export type ConstituentMapConfig = {
|
|
6
|
-
|
|
6
|
+
velocityClient?: VelocityClient;
|
|
7
|
+
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
8
|
+
driftClient?: VelocityClient;
|
|
7
9
|
connection?: Connection;
|
|
8
10
|
subscriptionConfig: {
|
|
9
11
|
type: 'polling';
|
|
@@ -31,7 +33,7 @@ export interface ConstituentMapInterface {
|
|
|
31
33
|
mustGetWithSlot(key: string): Promise<DataAndSlot<ConstituentAccount>>;
|
|
32
34
|
}
|
|
33
35
|
export declare class ConstituentMap implements ConstituentMapInterface {
|
|
34
|
-
private
|
|
36
|
+
private velocityClient;
|
|
35
37
|
private constituentMap;
|
|
36
38
|
private constituentAccountSubscriber;
|
|
37
39
|
private additionalFilters?;
|
|
@@ -9,23 +9,27 @@ const pda_1 = require("../addresses/pda");
|
|
|
9
9
|
const MAX_CONSTITUENT_SIZE_BYTES = 480; // TODO: update this when account is finalized
|
|
10
10
|
class ConstituentMap {
|
|
11
11
|
constructor(config) {
|
|
12
|
-
var _a, _b;
|
|
12
|
+
var _a, _b, _c;
|
|
13
13
|
this.constituentMap = new Map();
|
|
14
14
|
this.constituentIndexToKeyMap = new Map();
|
|
15
15
|
this.spotMarketIndexToKeyMap = new Map();
|
|
16
|
-
|
|
16
|
+
const velocityClient = (_a = config.velocityClient) !== null && _a !== void 0 ? _a : config.driftClient;
|
|
17
|
+
if (!velocityClient) {
|
|
18
|
+
throw new Error('ConstituentMap: velocityClient (or deprecated driftClient) must be provided');
|
|
19
|
+
}
|
|
20
|
+
this.velocityClient = velocityClient;
|
|
17
21
|
this.additionalFilters = config.additionalFilters;
|
|
18
22
|
this.commitment = config.subscriptionConfig.commitment;
|
|
19
|
-
this.connection = config.connection || this.
|
|
20
|
-
this.lpPoolId = (
|
|
21
|
-
this.decoder = (
|
|
23
|
+
this.connection = config.connection || this.velocityClient.connection;
|
|
24
|
+
this.lpPoolId = (_b = config.lpPoolId) !== null && _b !== void 0 ? _b : 0;
|
|
25
|
+
this.decoder = (_c = config.decoder) !== null && _c !== void 0 ? _c : 'base64+zstd';
|
|
22
26
|
if (config.subscriptionConfig.type === 'polling') {
|
|
23
27
|
this.constituentAccountSubscriber =
|
|
24
|
-
new pollingConstituentAccountSubscriber_1.PollingConstituentAccountSubscriber(this, this.
|
|
28
|
+
new pollingConstituentAccountSubscriber_1.PollingConstituentAccountSubscriber(this, this.velocityClient.program, config.subscriptionConfig.frequency, config.subscriptionConfig.commitment, this.getFilters());
|
|
25
29
|
}
|
|
26
30
|
else if (config.subscriptionConfig.type === 'websocket') {
|
|
27
31
|
this.constituentAccountSubscriber =
|
|
28
|
-
new webSocketConstituentAccountSubscriber_1.WebSocketConstituentAccountSubscriber(this, this.
|
|
32
|
+
new webSocketConstituentAccountSubscriber_1.WebSocketConstituentAccountSubscriber(this, this.velocityClient.program, config.subscriptionConfig.resubTimeoutMs, config.subscriptionConfig.commitment, this.getFilters());
|
|
29
33
|
}
|
|
30
34
|
// Listen for account updates from the subscriber
|
|
31
35
|
this.constituentAccountSubscriber.eventEmitter.on('onAccountUpdate', (account, pubkey, slot) => {
|
|
@@ -35,7 +39,7 @@ class ConstituentMap {
|
|
|
35
39
|
getFilters() {
|
|
36
40
|
const filters = [
|
|
37
41
|
(0, memcmp_1.getConstituentFilter)(),
|
|
38
|
-
(0, memcmp_1.getConstituentLpPoolFilter)((0, pda_1.getLpPoolPublicKey)(this.
|
|
42
|
+
(0, memcmp_1.getConstituentLpPoolFilter)((0, pda_1.getLpPoolPublicKey)(this.velocityClient.program.programId, this.lpPoolId)),
|
|
39
43
|
];
|
|
40
44
|
if (this.additionalFilters) {
|
|
41
45
|
filters.push(...this.additionalFilters);
|
|
@@ -43,12 +47,12 @@ class ConstituentMap {
|
|
|
43
47
|
return filters;
|
|
44
48
|
}
|
|
45
49
|
decode(name, buffer) {
|
|
46
|
-
return this.
|
|
50
|
+
return this.velocityClient.program.account.constituent.coder.accounts.decodeUnchecked(name, buffer);
|
|
47
51
|
}
|
|
48
52
|
async sync() {
|
|
49
53
|
try {
|
|
50
54
|
const rpcRequestArgs = [
|
|
51
|
-
this.
|
|
55
|
+
this.velocityClient.program.programId.toBase58(),
|
|
52
56
|
{
|
|
53
57
|
commitment: this.commitment,
|
|
54
58
|
filters: this.getFilters(),
|
|
@@ -224,3 +224,7 @@ export declare class VelocityCore {
|
|
|
224
224
|
*/
|
|
225
225
|
static buildInstructions(_ctx: VelocityCoreContext): TransactionInstruction[];
|
|
226
226
|
}
|
|
227
|
+
/** @deprecated Use `VelocityCore` instead. `DriftCore` will be removed in a future major. */
|
|
228
|
+
export declare const DriftCore: typeof VelocityCore;
|
|
229
|
+
/** @deprecated Use `VelocityCore` instead. `DriftCore` will be removed in a future major. */
|
|
230
|
+
export type DriftCore = VelocityCore;
|
|
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.VelocityCore = void 0;
|
|
29
|
+
exports.DriftCore = exports.VelocityCore = void 0;
|
|
30
30
|
const pdas = __importStar(require("../addresses/pda"));
|
|
31
31
|
const constants = __importStar(require("../constants"));
|
|
32
32
|
const user_1 = require("../decode/user");
|
|
@@ -136,3 +136,5 @@ VelocityCore.constants = constants;
|
|
|
136
136
|
/** Re-export remaining-accounts logic (pure). */
|
|
137
137
|
VelocityCore.remainingAccounts = remainingAccounts;
|
|
138
138
|
VelocityCore.signedMsg = signedMsg;
|
|
139
|
+
/** @deprecated Use `VelocityCore` instead. `DriftCore` will be removed in a future major. */
|
|
140
|
+
exports.DriftCore = VelocityCore;
|
|
@@ -120,8 +120,8 @@ function decodeUser(buffer) {
|
|
|
120
120
|
const orders = [];
|
|
121
121
|
for (let i = 0; i < 32; i++) {
|
|
122
122
|
// skip order if it's not open
|
|
123
|
-
if (buffer.readUint8(offset +
|
|
124
|
-
offset +=
|
|
123
|
+
if (buffer.readUint8(offset + 86) !== 1) {
|
|
124
|
+
offset += 104;
|
|
125
125
|
continue;
|
|
126
126
|
}
|
|
127
127
|
const slot = readUnsignedBigInt64LE(buffer, offset);
|
|
@@ -142,8 +142,8 @@ function decodeUser(buffer) {
|
|
|
142
142
|
offset += 8;
|
|
143
143
|
const maxTs = readSignedBigInt64LE(buffer, offset);
|
|
144
144
|
offset += 8;
|
|
145
|
-
const oraclePriceOffset = buffer
|
|
146
|
-
offset +=
|
|
145
|
+
const oraclePriceOffset = readSignedBigInt64LE(buffer, offset);
|
|
146
|
+
offset += 8;
|
|
147
147
|
const orderId = buffer.readUInt32LE(offset);
|
|
148
148
|
offset += 4;
|
|
149
149
|
const marketIndex = buffer.readUInt16LE(offset);
|
|
@@ -231,7 +231,7 @@ function decodeUser(buffer) {
|
|
|
231
231
|
offset += 1;
|
|
232
232
|
const bitFlags = buffer.readUint8(offset);
|
|
233
233
|
offset += 1;
|
|
234
|
-
offset +=
|
|
234
|
+
offset += 5; // padding
|
|
235
235
|
orders.push({
|
|
236
236
|
slot,
|
|
237
237
|
price,
|
package/lib/browser/dlob/DLOB.js
CHANGED
|
@@ -181,7 +181,7 @@ class DLOB {
|
|
|
181
181
|
else if ((0, types_1.isOneOfVariant)(order.orderType, ['market', 'triggerMarket', 'oracle'])) {
|
|
182
182
|
type = 'market';
|
|
183
183
|
}
|
|
184
|
-
else if (order.oraclePriceOffset
|
|
184
|
+
else if (!order.oraclePriceOffset.eq(numericConstants_1.ZERO)) {
|
|
185
185
|
type = 'floatingLimit';
|
|
186
186
|
}
|
|
187
187
|
else {
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.createNode = exports.SignedMsgOrderNode = exports.TriggerOrderNode = exports.MarketOrderNode = exports.FloatingLimitOrderNode = exports.RestingLimitOrderNode = exports.TakingLimitOrderNode = exports.OrderNode = void 0;
|
|
4
|
-
const anchor_1 = require("../isomorphic/anchor");
|
|
5
4
|
const numericConstants_1 = require("../constants/numericConstants");
|
|
6
5
|
const orders_1 = require("../math/orders");
|
|
7
6
|
const types_1 = require("../types");
|
|
@@ -56,7 +55,7 @@ class RestingLimitOrderNode extends OrderNode {
|
|
|
56
55
|
exports.RestingLimitOrderNode = RestingLimitOrderNode;
|
|
57
56
|
class FloatingLimitOrderNode extends OrderNode {
|
|
58
57
|
getSortValue(order) {
|
|
59
|
-
return
|
|
58
|
+
return order.oraclePriceOffset;
|
|
60
59
|
}
|
|
61
60
|
}
|
|
62
61
|
exports.FloatingLimitOrderNode = FloatingLimitOrderNode;
|
|
@@ -9,7 +9,9 @@ import { MarketType } from '../types';
|
|
|
9
9
|
import { L2OrderBook, L2OrderBookGenerator, L3OrderBook } from './orderBookLevels';
|
|
10
10
|
import { BN } from '../isomorphic/anchor';
|
|
11
11
|
export declare class DLOBSubscriber {
|
|
12
|
-
|
|
12
|
+
velocityClient: VelocityClient;
|
|
13
|
+
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
14
|
+
get driftClient(): VelocityClient;
|
|
13
15
|
dlobSource: DLOBSource;
|
|
14
16
|
slotSource: SlotSource;
|
|
15
17
|
updateFrequency: number;
|
|
@@ -6,8 +6,17 @@ const events_1 = require("events");
|
|
|
6
6
|
const types_1 = require("../types");
|
|
7
7
|
const orderBookLevels_1 = require("./orderBookLevels");
|
|
8
8
|
class DLOBSubscriber {
|
|
9
|
+
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
10
|
+
get driftClient() {
|
|
11
|
+
return this.velocityClient;
|
|
12
|
+
}
|
|
9
13
|
constructor(config) {
|
|
10
|
-
|
|
14
|
+
var _a;
|
|
15
|
+
const velocityClient = (_a = config.velocityClient) !== null && _a !== void 0 ? _a : config.driftClient;
|
|
16
|
+
if (!velocityClient) {
|
|
17
|
+
throw new Error('DLOBSubscriber: velocityClient (or deprecated driftClient) must be provided');
|
|
18
|
+
}
|
|
19
|
+
this.velocityClient = velocityClient;
|
|
11
20
|
this.dlobSource = config.dlobSource;
|
|
12
21
|
this.slotSource = config.slotSource;
|
|
13
22
|
this.updateFrequency = config.updateFrequency;
|
|
@@ -48,7 +57,7 @@ class DLOBSubscriber {
|
|
|
48
57
|
*/
|
|
49
58
|
getL2({ marketName, marketIndex, marketType, depth = 10, includeVamm = false, numVammOrders, fallbackL2Generators = [], latestSlot, }) {
|
|
50
59
|
if (marketName) {
|
|
51
|
-
const derivedMarketInfo = this.
|
|
60
|
+
const derivedMarketInfo = this.velocityClient.getMarketIndexAndType(marketName);
|
|
52
61
|
if (!derivedMarketInfo) {
|
|
53
62
|
throw new Error(`Market ${marketName} not found`);
|
|
54
63
|
}
|
|
@@ -63,12 +72,12 @@ class DLOBSubscriber {
|
|
|
63
72
|
let oraclePriceData;
|
|
64
73
|
const isPerp = (0, types_1.isVariant)(marketType, 'perp');
|
|
65
74
|
if (isPerp) {
|
|
66
|
-
const perpMarketAccount = this.
|
|
67
|
-
oraclePriceData = this.
|
|
75
|
+
const perpMarketAccount = this.velocityClient.getPerpMarketAccount(marketIndex);
|
|
76
|
+
oraclePriceData = this.velocityClient.getOracleDataForPerpMarket(perpMarketAccount.marketIndex);
|
|
68
77
|
}
|
|
69
78
|
else {
|
|
70
79
|
oraclePriceData =
|
|
71
|
-
this.
|
|
80
|
+
this.velocityClient.getOracleDataForSpotMarket(marketIndex);
|
|
72
81
|
}
|
|
73
82
|
if (isPerp && includeVamm) {
|
|
74
83
|
if (fallbackL2Generators.length > 0) {
|
|
@@ -76,8 +85,8 @@ class DLOBSubscriber {
|
|
|
76
85
|
}
|
|
77
86
|
fallbackL2Generators = [
|
|
78
87
|
(0, orderBookLevels_1.getVammL2Generator)({
|
|
79
|
-
marketAccount: this.
|
|
80
|
-
mmOraclePriceData: this.
|
|
88
|
+
marketAccount: this.velocityClient.getPerpMarketAccount(marketIndex),
|
|
89
|
+
mmOraclePriceData: this.velocityClient.getMMOracleDataForPerpMarket(marketIndex),
|
|
81
90
|
numOrders: numVammOrders !== null && numVammOrders !== void 0 ? numVammOrders : depth,
|
|
82
91
|
topOfBookQuoteAmounts: marketIndex < 3
|
|
83
92
|
? orderBookLevels_1.MAJORS_TOP_OF_BOOK_QUOTE_AMOUNTS
|
|
@@ -104,7 +113,7 @@ class DLOBSubscriber {
|
|
|
104
113
|
*/
|
|
105
114
|
getL3({ marketName, marketIndex, marketType, }) {
|
|
106
115
|
if (marketName) {
|
|
107
|
-
const derivedMarketInfo = this.
|
|
116
|
+
const derivedMarketInfo = this.velocityClient.getMarketIndexAndType(marketName);
|
|
108
117
|
if (!derivedMarketInfo) {
|
|
109
118
|
throw new Error(`Market ${marketName} not found`);
|
|
110
119
|
}
|
|
@@ -120,11 +129,11 @@ class DLOBSubscriber {
|
|
|
120
129
|
const isPerp = (0, types_1.isVariant)(marketType, 'perp');
|
|
121
130
|
if (isPerp) {
|
|
122
131
|
oraclePriceData =
|
|
123
|
-
this.
|
|
132
|
+
this.velocityClient.getOracleDataForPerpMarket(marketIndex);
|
|
124
133
|
}
|
|
125
134
|
else {
|
|
126
135
|
oraclePriceData =
|
|
127
|
-
this.
|
|
136
|
+
this.velocityClient.getOracleDataForSpotMarket(marketIndex);
|
|
128
137
|
}
|
|
129
138
|
return this.dlob.getL3({
|
|
130
139
|
marketIndex,
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import { DLOB } from './DLOB';
|
|
2
2
|
import { VelocityClient } from '../velocityClient';
|
|
3
3
|
export type DLOBSubscriptionConfig = {
|
|
4
|
-
|
|
4
|
+
velocityClient?: VelocityClient;
|
|
5
|
+
/** @deprecated Use `velocityClient` instead. `driftClient` will be removed in a future major. */
|
|
6
|
+
driftClient?: VelocityClient;
|
|
5
7
|
dlobSource: DLOBSource;
|
|
6
8
|
slotSource: SlotSource;
|
|
7
9
|
updateFrequency: number;
|
|
@@ -5,7 +5,7 @@
|
|
|
5
5
|
* IDL can be found at `target/idl/drift.json`.
|
|
6
6
|
*/
|
|
7
7
|
export type Drift = {
|
|
8
|
-
"address": "
|
|
8
|
+
"address": "vELoC1audYbSYVRXn1vPaV8Axoa9oU6BYmNGZZBDZ1P";
|
|
9
9
|
"metadata": {
|
|
10
10
|
"name": "drift";
|
|
11
11
|
"version": "2.162.0";
|
|
@@ -2884,6 +2884,59 @@ export type Drift = {
|
|
|
2884
2884
|
];
|
|
2885
2885
|
"args": [];
|
|
2886
2886
|
},
|
|
2887
|
+
{
|
|
2888
|
+
"name": "forceWipeAccountsDevnet";
|
|
2889
|
+
"docs": [
|
|
2890
|
+
"Devnet-only escape hatch: cleans up accounts stranded by a layout-breaking",
|
|
2891
|
+
"program upgrade (or by a partial re-init). For each account passed via",
|
|
2892
|
+
"`remaining_accounts`:",
|
|
2893
|
+
"- drift-owned PDA → drain lamports (runtime GCs at end of tx)",
|
|
2894
|
+
"- token-program owned vault (drift_signer close-authority) → CPI",
|
|
2895
|
+
"`close_account`, rent refunded to admin",
|
|
2896
|
+
"Admin gate reads State's first pubkey field at raw offset 8..40 so it",
|
|
2897
|
+
"works regardless of the State layout currently on chain. `drift_signer_nonce`",
|
|
2898
|
+
"must match `State.signer_nonce`; mismatch fails the token CPI signature.",
|
|
2899
|
+
"Stripped from mainnet builds via `mainnet-beta`."
|
|
2900
|
+
];
|
|
2901
|
+
"discriminator": [
|
|
2902
|
+
105,
|
|
2903
|
+
74,
|
|
2904
|
+
87,
|
|
2905
|
+
6,
|
|
2906
|
+
166,
|
|
2907
|
+
227,
|
|
2908
|
+
138,
|
|
2909
|
+
215
|
|
2910
|
+
];
|
|
2911
|
+
"accounts": [
|
|
2912
|
+
{
|
|
2913
|
+
"name": "admin";
|
|
2914
|
+
"writable": true;
|
|
2915
|
+
"signer": true;
|
|
2916
|
+
},
|
|
2917
|
+
{
|
|
2918
|
+
"name": "state";
|
|
2919
|
+
"docs": [
|
|
2920
|
+
"(cold-)admin pubkey at offset 8..40."
|
|
2921
|
+
];
|
|
2922
|
+
},
|
|
2923
|
+
{
|
|
2924
|
+
"name": "driftSigner";
|
|
2925
|
+
"docs": [
|
|
2926
|
+
"at CPI time when closing token vaults; ignored otherwise."
|
|
2927
|
+
];
|
|
2928
|
+
},
|
|
2929
|
+
{
|
|
2930
|
+
"name": "tokenProgram";
|
|
2931
|
+
}
|
|
2932
|
+
];
|
|
2933
|
+
"args": [
|
|
2934
|
+
{
|
|
2935
|
+
"name": "driftSignerNonce";
|
|
2936
|
+
"type": "u8";
|
|
2937
|
+
}
|
|
2938
|
+
];
|
|
2939
|
+
},
|
|
2887
2940
|
{
|
|
2888
2941
|
"name": "initialize";
|
|
2889
2942
|
"discriminator": [
|
|
@@ -19727,7 +19780,7 @@ export type Drift = {
|
|
|
19727
19780
|
{
|
|
19728
19781
|
"name": "oraclePriceOffset";
|
|
19729
19782
|
"type": {
|
|
19730
|
-
"option": "
|
|
19783
|
+
"option": "i64";
|
|
19731
19784
|
};
|
|
19732
19785
|
},
|
|
19733
19786
|
{
|
|
@@ -19968,7 +20021,7 @@ export type Drift = {
|
|
|
19968
20021
|
"If set, the order limit price is the oracle price + this offset",
|
|
19969
20022
|
"precision: PRICE_PRECISION"
|
|
19970
20023
|
];
|
|
19971
|
-
"type": "
|
|
20024
|
+
"type": "i64";
|
|
19972
20025
|
},
|
|
19973
20026
|
{
|
|
19974
20027
|
"name": "orderId";
|
|
@@ -20105,7 +20158,7 @@ export type Drift = {
|
|
|
20105
20158
|
"type": {
|
|
20106
20159
|
"array": [
|
|
20107
20160
|
"u8",
|
|
20108
|
-
|
|
20161
|
+
5
|
|
20109
20162
|
];
|
|
20110
20163
|
};
|
|
20111
20164
|
}
|
|
@@ -20631,7 +20684,7 @@ export type Drift = {
|
|
|
20631
20684
|
{
|
|
20632
20685
|
"name": "oraclePriceOffset";
|
|
20633
20686
|
"type": {
|
|
20634
|
-
"option": "
|
|
20687
|
+
"option": "i64";
|
|
20635
20688
|
};
|
|
20636
20689
|
},
|
|
20637
20690
|
{
|
|
@@ -21813,7 +21866,7 @@ export type Drift = {
|
|
|
21813
21866
|
{
|
|
21814
21867
|
"name": "bitFlags";
|
|
21815
21868
|
"docs": [
|
|
21816
|
-
"
|
|
21869
|
+
"Order bit flags"
|
|
21817
21870
|
];
|
|
21818
21871
|
"type": "u8";
|
|
21819
21872
|
},
|