Skip to content

Commit 570e5ba

Browse files
committed
ts build
1 parent a09e2a0 commit 570e5ba

File tree

60 files changed

+39377
-14014
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

60 files changed

+39377
-14014
lines changed

bun.lock

Lines changed: 168 additions & 71 deletions
Large diffs are not rendered by default.

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@
55
"author": "",
66
"license": "ISC",
77
"devDependencies": {
8-
"@coral-xyz/anchor": "0.29.0",
9-
"@coral-xyz/anchor-30": "npm:@coral-xyz/anchor@0.30.1",
8+
"@coral-xyz/anchor": "npm:@coral-xyz/anchor@0.31.1",
9+
"@coral-xyz/anchor-29": "npm:@coral-xyz/anchor@0.29.0",
1010
"@project-serum/common": "0.0.1-beta.3",
1111
"@project-serum/serum": "0.13.65",
1212
"@pythnetwork/client": "2.21.0",
@@ -30,8 +30,8 @@
3030
"dependencies": {
3131
"@ellipsis-labs/phoenix-sdk": "1.4.2",
3232
"@pythnetwork/pyth-solana-receiver": "0.8.0",
33-
"@switchboard-xyz/common": "3.0.14",
34-
"@switchboard-xyz/on-demand": "2.4.1",
33+
"@switchboard-xyz/common": "5.5.0",
34+
"@switchboard-xyz/on-demand": "3.7.3",
3535
"anchor-bankrun": "0.3.0",
3636
"chai-bn": "0.2.2",
3737
"csvtojson": "2.0.10",
@@ -95,4 +95,4 @@
9595
"supports-hyperlinks": "<4.1.1",
9696
"has-ansi": "<6.0.1"
9797
}
98-
}
98+
}

sdk/bun.lock

Lines changed: 69 additions & 38 deletions
Large diffs are not rendered by default.

sdk/package.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@
4141
"access": "public"
4242
},
4343
"dependencies": {
44-
"@coral-xyz/anchor": "0.29.0",
45-
"@coral-xyz/anchor-30": "npm:@coral-xyz/anchor@0.30.1",
44+
"@coral-xyz/anchor": "npm:@coral-xyz/anchor@0.31.1",
45+
"@coral-xyz/anchor-29": "npm:@coral-xyz/anchor@0.29.0",
4646
"@ellipsis-labs/phoenix-sdk": "1.4.5",
4747
"@grpc/grpc-js": "1.14.0",
4848
"@msgpack/msgpack": "^3.1.2",
@@ -53,11 +53,11 @@
5353
"@pythnetwork/pyth-solana-receiver": "0.7.0",
5454
"@solana/spl-token": "0.4.13",
5555
"@solana/web3.js": "1.98.0",
56-
"@switchboard-xyz/common": "3.0.14",
57-
"@switchboard-xyz/on-demand": "2.4.1",
56+
"@switchboard-xyz/common": "5.5.0",
57+
"@switchboard-xyz/on-demand": "3.7.3",
5858
"@triton-one/yellowstone-grpc": "1.4.1",
5959
"anchor-bankrun": "0.3.0",
60-
"gill": "^0.10.2",
60+
"gill": "^0.10.3",
6161
"helius-laserstream": "0.1.8",
6262
"nanoid": "3.3.4",
6363
"node-cache": "5.1.2",
@@ -147,4 +147,4 @@
147147
"@grpc/grpc-js": false,
148148
"zstddec": false
149149
}
150-
}
150+
}

sdk/src/accounts/fetch.ts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,11 @@ import {
1212
getUserStatsAccountPublicKey,
1313
} from '../addresses/pda';
1414
import { Program } from '@coral-xyz/anchor';
15+
import { Drift } from '../idl/drift';
1516

1617
export async function fetchUserAccounts(
1718
connection: Connection,
18-
program: Program,
19+
program: Program<Drift>,
1920
authority: PublicKey,
2021
limit = 8
2122
): Promise<(UserAccount | undefined)[]> {
@@ -31,7 +32,7 @@ export async function fetchUserAccounts(
3132

3233
export async function fetchUserAccountsUsingKeys(
3334
connection: Connection,
34-
program: Program,
35+
program: Program<Drift>,
3536
userAccountPublicKeys: PublicKey[]
3637
): Promise<(UserAccount | undefined)[]> {
3738
const accountInfos = await connection.getMultipleAccountsInfo(
@@ -52,7 +53,7 @@ export async function fetchUserAccountsUsingKeys(
5253

5354
export async function fetchUserStatsAccount(
5455
connection: Connection,
55-
program: Program,
56+
program: Program<Drift>,
5657
authority: PublicKey
5758
): Promise<UserStatsAccount | undefined> {
5859
const userStatsPublicKey = getUserStatsAccountPublicKey(
@@ -74,7 +75,7 @@ export async function fetchUserStatsAccount(
7475

7576
export async function fetchRevenueShareAccount(
7677
connection: Connection,
77-
program: Program,
78+
program: Program<Drift>,
7879
authority: PublicKey
7980
): Promise<RevenueShareAccount | null> {
8081
const revenueShareAccountPublicKey = getRevenueShareAccountPublicKey(
@@ -93,7 +94,7 @@ export async function fetchRevenueShareAccount(
9394

9495
export async function fetchRevenueShareEscrowAccount(
9596
connection: Connection,
96-
program: Program,
97+
program: Program<Drift>,
9798
authority: PublicKey
9899
): Promise<RevenueShareEscrowAccount | null> {
99100
const revenueShareEscrowPubKey = getRevenueShareEscrowAccountPublicKey(

sdk/src/accounts/grpcAccountSubscriber.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
SubscribeRequest,
1313
SubscribeUpdate,
1414
} from '../isomorphic/grpc';
15+
import { Drift } from '../idl/drift';
1516

1617
export class grpcAccountSubscriber<T> extends WebSocketAccountSubscriber<T> {
1718
private client: Client;
@@ -23,7 +24,7 @@ export class grpcAccountSubscriber<T> extends WebSocketAccountSubscriber<T> {
2324
client: Client,
2425
commitmentLevel: CommitmentLevel,
2526
accountName: string,
26-
program: Program,
27+
program: Program<Drift>,
2728
accountPublicKey: PublicKey,
2829
decodeBuffer?: (buffer: Buffer) => T,
2930
resubOpts?: ResubOpts
@@ -36,7 +37,7 @@ export class grpcAccountSubscriber<T> extends WebSocketAccountSubscriber<T> {
3637
public static async create<U>(
3738
grpcConfigs: GrpcConfigs,
3839
accountName: string,
39-
program: Program,
40+
program: Program<Drift>,
4041
accountPublicKey: PublicKey,
4142
decodeBuffer?: (buffer: Buffer) => U,
4243
resubOpts?: ResubOpts,

sdk/src/accounts/grpcDriftClientAccountSubscriber.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,14 @@ import { DelistedMarketSetting, GrpcConfigs, ResubOpts } from './types';
1111
import { grpcAccountSubscriber } from './grpcAccountSubscriber';
1212
import { PerpMarketAccount, SpotMarketAccount, StateAccount } from '../types';
1313
import { getOracleId } from '../oracles/oracleId';
14+
import { Drift } from '../idl/drift';
1415

1516
export class grpcDriftClientAccountSubscriber extends WebSocketDriftClientAccountSubscriber {
1617
private grpcConfigs: GrpcConfigs;
1718

1819
constructor(
1920
grpcConfigs: GrpcConfigs,
20-
program: Program,
21+
program: Program<Drift>,
2122
perpMarketIndexes: number[],
2223
spotMarketIndexes: number[],
2324
oracleInfos: OracleInfo[],

sdk/src/accounts/grpcDriftClientAccountSubscriberV2.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ import {
3030
} from '../oracles/oracleId';
3131
import { OracleClientCache } from '../oracles/oracleClientCache';
3232
import { findDelistedPerpMarketsAndOracles } from './utils';
33+
import { Drift } from '../idl/drift';
3334

3435
export class grpcDriftClientAccountSubscriberV2
3536
implements DriftClientAccountSubscriber
@@ -51,7 +52,7 @@ export class grpcDriftClientAccountSubscriberV2
5152
>;
5253
public isSubscribed: boolean;
5354
public isSubscribing: boolean;
54-
public program: Program;
55+
public program: Program<Drift>;
5556
public perpMarketIndexes: number[];
5657
public spotMarketIndexes: number[];
5758
public shouldFindAllMarketsAndOracles: boolean;
@@ -76,7 +77,7 @@ export class grpcDriftClientAccountSubscriberV2
7677

7778
constructor(
7879
grpcConfigs: GrpcConfigs,
79-
program: Program,
80+
program: Program<Drift>,
8081
perpMarketIndexes: number[],
8182
spotMarketIndexes: number[],
8283
oracleInfos: OracleInfo[],

sdk/src/accounts/grpcInsuranceFundStakeAccountSubscriber.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@ import { PublicKey } from '@solana/web3.js';
44
import { InsuranceFundStake } from '../types';
55
import { WebSocketInsuranceFundStakeAccountSubscriber } from './webSocketInsuranceFundStakeAccountSubscriber';
66
import { grpcAccountSubscriber } from './grpcAccountSubscriber';
7+
import { Drift } from '../idl/drift';
78

89
export class grpcInsuranceFundStakeAccountSubscriber extends WebSocketInsuranceFundStakeAccountSubscriber {
910
private grpcConfigs: GrpcConfigs;
1011

1112
public constructor(
1213
grpcConfigs: GrpcConfigs,
13-
program: Program,
14+
program: Program<Drift>,
1415
insuranceFundStakeAccountPublicKey: PublicKey,
1516
resubTimeoutMs?: number
1617
) {

sdk/src/accounts/grpcMultiAccountSubscriber.ts

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import {
1212
createClient,
1313
} from '../isomorphic/grpc';
1414
import { BufferAndSlot, DataAndSlot, GrpcConfigs, ResubOpts } from './types';
15+
import { Drift } from '../idl/drift';
1516

1617
interface AccountInfoLike {
1718
owner: PublicKey;
@@ -40,7 +41,7 @@ export class grpcMultiAccountSubscriber<T, U = undefined> {
4041
private client: Client;
4142
private stream: ClientDuplexStream<SubscribeRequest, SubscribeUpdate>;
4243
private commitmentLevel: CommitmentLevel;
43-
private program: Program;
44+
private program: Program<Drift>;
4445
private accountName: string;
4546
private decodeBufferFn?: (
4647
buffer: Buffer,
@@ -69,7 +70,7 @@ export class grpcMultiAccountSubscriber<T, U = undefined> {
6970
client: Client,
7071
commitmentLevel: CommitmentLevel,
7172
accountName: string,
72-
program: Program,
73+
program: Program<Drift>,
7374
decodeBuffer?: (buffer: Buffer, pubkey?: string) => T,
7475
resubOpts?: ResubOpts,
7576
onUnsubscribe?: () => Promise<void>,
@@ -88,7 +89,7 @@ export class grpcMultiAccountSubscriber<T, U = undefined> {
8889
public static async create<T, U = undefined>(
8990
grpcConfigs: GrpcConfigs,
9091
accountName: string,
91-
program: Program,
92+
program: Program<Drift>,
9293
decodeBuffer?: (buffer: Buffer, pubkey?: string, accountProps?: U) => T,
9394
resubOpts?: ResubOpts,
9495
clientProp?: Client,

0 commit comments

Comments
 (0)