@depthhq/sdk 0.0.0-stage → 0.1.0
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/dist/account/confirm.d.ts +5 -0
- package/dist/account/discovery.d.ts +43 -0
- package/dist/account/funding.d.ts +86 -0
- package/dist/account/funding.js +498 -0
- package/dist/account/release.d.ts +8 -0
- package/dist/account/token.d.ts +5 -0
- package/dist/app/app.d.ts +50 -0
- package/dist/catalog/catalog.d.ts +50 -0
- package/dist/catalog/data.d.ts +30 -0
- package/dist/catalog/data.js +169 -0
- package/dist/chain/arcium.d.ts +10 -0
- package/dist/chain/connection.d.ts +4 -0
- package/dist/chain/environment.d.ts +20 -0
- package/dist/chain/manifest.d.ts +36 -0
- package/dist/chain/network.d.ts +18 -0
- package/dist/chain/provider.d.ts +6 -0
- package/dist/chain/random.d.ts +1 -0
- package/dist/client/client.d.ts +130 -0
- package/dist/client/types.d.ts +102 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.js +47069 -0
- package/dist/operation/error.d.ts +10 -0
- package/dist/operation/operation.d.ts +42 -0
- package/dist/operator.d.ts +6 -0
- package/dist/operator.js +25383 -0
- package/dist/recovery/coordinator.d.ts +17 -0
- package/dist/recovery/recovery.d.ts +26 -0
- package/dist/recovery/recovery.js +1420 -0
- package/dist/recovery/shares.d.ts +26 -0
- package/dist/recovery/winddown.d.ts +38 -0
- package/dist/recovery/witness.d.ts +16 -0
- package/dist/trade/amount.d.ts +2 -0
- package/dist/trade/flow.d.ts +21 -0
- package/dist/trade/input.d.ts +3 -0
- package/dist/trade/terms.d.ts +3 -0
- package/dist/view/view.d.ts +59 -0
- package/dist/view/view.js +26681 -0
- package/package.json +52 -3
- package/README.md +0 -3
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
export type RecoveryEnvelope = {
|
|
3
|
+
market: string;
|
|
4
|
+
recoveryKey: string;
|
|
5
|
+
recipient: string;
|
|
6
|
+
index: number;
|
|
7
|
+
threshold: number;
|
|
8
|
+
ephemeral: string;
|
|
9
|
+
salt: string;
|
|
10
|
+
nonce: string;
|
|
11
|
+
ciphertext: string;
|
|
12
|
+
tag: string;
|
|
13
|
+
};
|
|
14
|
+
export type RecoveryShare = {
|
|
15
|
+
market: string;
|
|
16
|
+
recoveryKey: string;
|
|
17
|
+
index: number;
|
|
18
|
+
threshold: number;
|
|
19
|
+
data: Uint8Array;
|
|
20
|
+
};
|
|
21
|
+
export declare function createRecoveryShares(market: PublicKey, recipients: Uint8Array[]): {
|
|
22
|
+
recoveryKey: Uint8Array;
|
|
23
|
+
envelopes: RecoveryEnvelope[];
|
|
24
|
+
};
|
|
25
|
+
export declare function openRecoveryShare(envelope: RecoveryEnvelope, recipientSecret: Uint8Array): RecoveryShare;
|
|
26
|
+
export declare function combineRecoveryShares(market: PublicKey, recoveryKey: Uint8Array, shares: RecoveryShare[]): Uint8Array;
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import * as anchor from "@anchor-lang/core";
|
|
2
|
+
import { PublicKey, Transaction } from "@solana/web3.js";
|
|
3
|
+
export type ClearingWitness = {
|
|
4
|
+
insurance: bigint;
|
|
5
|
+
openInterest: bigint;
|
|
6
|
+
protocolFees: bigint;
|
|
7
|
+
appFees: bigint;
|
|
8
|
+
salt: bigint;
|
|
9
|
+
};
|
|
10
|
+
export type MarketWitness = {
|
|
11
|
+
collateral: bigint;
|
|
12
|
+
reserved: bigint;
|
|
13
|
+
position: bigint;
|
|
14
|
+
entryPrice: bigint;
|
|
15
|
+
fundingCheckpoint: bigint;
|
|
16
|
+
salt: bigint;
|
|
17
|
+
};
|
|
18
|
+
export type FeeWitness = {
|
|
19
|
+
protocolFee: bigint;
|
|
20
|
+
appFee: bigint;
|
|
21
|
+
salt: bigint;
|
|
22
|
+
};
|
|
23
|
+
export declare class WinddownOperator {
|
|
24
|
+
private readonly program;
|
|
25
|
+
private readonly provider;
|
|
26
|
+
readonly market: PublicKey;
|
|
27
|
+
readonly protocol: PublicKey;
|
|
28
|
+
readonly winddown: PublicKey;
|
|
29
|
+
readonly clearing: PublicKey;
|
|
30
|
+
constructor(program: anchor.Program);
|
|
31
|
+
private pda;
|
|
32
|
+
private read;
|
|
33
|
+
start(witness: ClearingWitness, signers: PublicKey[]): Promise<Transaction>;
|
|
34
|
+
private assertRevealing;
|
|
35
|
+
reveal(owner: PublicKey, witness: MarketWitness): Promise<string | undefined>;
|
|
36
|
+
revealFee(order: PublicKey, witness: FeeWitness): Promise<string | undefined>;
|
|
37
|
+
finalize(): Promise<string>;
|
|
38
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import * as anchor from "@anchor-lang/core";
|
|
2
|
+
import { PublicKey } from "@solana/web3.js";
|
|
3
|
+
import type { ClearingWitness, FeeWitness, MarketWitness } from "./winddown.js";
|
|
4
|
+
export declare class RecoveryWitnessReader {
|
|
5
|
+
private readonly program;
|
|
6
|
+
private readonly secret;
|
|
7
|
+
private readonly cipher;
|
|
8
|
+
private constructor();
|
|
9
|
+
static create(program: anchor.Program, secret: Uint8Array): Promise<RecoveryWitnessReader>;
|
|
10
|
+
private read;
|
|
11
|
+
private decrypt;
|
|
12
|
+
clearing(): Promise<ClearingWitness>;
|
|
13
|
+
market(owner: PublicKey): Promise<MarketWitness>;
|
|
14
|
+
fee(order: PublicKey): Promise<FeeWitness>;
|
|
15
|
+
destroy(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { PublicKey } from "@solana/web3.js";
|
|
2
|
+
import type { TransferHandle } from "../account/funding.js";
|
|
3
|
+
import type { DepthClient } from "../client/client.js";
|
|
4
|
+
import type { CloseInput, ReductionInput, ReverseInput, TradeInput, TradeIntent } from "../client/types.js";
|
|
5
|
+
import type { DepthOperation } from "../operation/operation.js";
|
|
6
|
+
export type TradeFlowSnapshot = {
|
|
7
|
+
id: PublicKey;
|
|
8
|
+
allocationId: PublicKey;
|
|
9
|
+
phase: "unstarted" | "allocating" | "allocated" | "order" | "failed";
|
|
10
|
+
allocation?: Awaited<ReturnType<TransferHandle["status"]>>;
|
|
11
|
+
order?: Awaited<ReturnType<DepthOperation["status"]>>;
|
|
12
|
+
};
|
|
13
|
+
export declare class TradeFlow {
|
|
14
|
+
readonly client: DepthClient;
|
|
15
|
+
readonly nonce: bigint;
|
|
16
|
+
readonly id: PublicKey;
|
|
17
|
+
readonly allocationId: PublicKey;
|
|
18
|
+
constructor(client: DepthClient, nonce: bigint);
|
|
19
|
+
status(): Promise<TradeFlowSnapshot>;
|
|
20
|
+
resume(input: TradeInput | ReductionInput | CloseInput | ReverseInput, intent: TradeIntent): Promise<DepthOperation>;
|
|
21
|
+
}
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import * as anchor from "@anchor-lang/core";
|
|
2
|
+
import { Connection, PublicKey } from "@solana/web3.js";
|
|
3
|
+
export type BalanceSnapshot = {
|
|
4
|
+
status: "pending" | "ready" | "stale";
|
|
5
|
+
id: string;
|
|
6
|
+
version: bigint;
|
|
7
|
+
slot: number;
|
|
8
|
+
amount?: bigint;
|
|
9
|
+
};
|
|
10
|
+
export type PositionSnapshot = {
|
|
11
|
+
status: "pending" | "ready" | "stale";
|
|
12
|
+
id: string;
|
|
13
|
+
version: bigint;
|
|
14
|
+
slot: number;
|
|
15
|
+
collateral?: bigint;
|
|
16
|
+
reserved?: bigint;
|
|
17
|
+
position?: bigint;
|
|
18
|
+
entryPriceE8?: bigint;
|
|
19
|
+
fundingCheckpoint?: bigint;
|
|
20
|
+
};
|
|
21
|
+
export type FillSnapshot = {
|
|
22
|
+
status: "pending" | "ready" | "stale";
|
|
23
|
+
id: string;
|
|
24
|
+
slot: number;
|
|
25
|
+
positionId?: PublicKey;
|
|
26
|
+
side?: bigint;
|
|
27
|
+
size?: bigint;
|
|
28
|
+
margin?: bigint;
|
|
29
|
+
executionPriceE8?: bigint;
|
|
30
|
+
fee?: bigint;
|
|
31
|
+
insuranceFee?: bigint;
|
|
32
|
+
appFee?: bigint;
|
|
33
|
+
makerRebate?: bigint;
|
|
34
|
+
};
|
|
35
|
+
export type QuoteBalanceSnapshot = {
|
|
36
|
+
status: "pending" | "ready" | "stale";
|
|
37
|
+
id: string;
|
|
38
|
+
slot: number;
|
|
39
|
+
remainingCapacity?: bigint;
|
|
40
|
+
remainingMargin?: bigint;
|
|
41
|
+
};
|
|
42
|
+
export declare class DepthView {
|
|
43
|
+
readonly id: PublicKey;
|
|
44
|
+
readonly signature: string;
|
|
45
|
+
readonly kind: "balance" | "market" | "fill" | "quote";
|
|
46
|
+
private readonly owner;
|
|
47
|
+
private readonly secret;
|
|
48
|
+
private readonly publicKey;
|
|
49
|
+
private readonly mxePublicKey;
|
|
50
|
+
private readonly program;
|
|
51
|
+
private readonly connection;
|
|
52
|
+
constructor(id: PublicKey, signature: string, kind: "balance" | "market" | "fill" | "quote", owner: PublicKey, secret: Uint8Array, publicKey: Uint8Array, mxePublicKey: Uint8Array, program: anchor.Program, connection: Connection);
|
|
53
|
+
status(): Promise<BalanceSnapshot | PositionSnapshot | FillSnapshot | QuoteBalanceSnapshot>;
|
|
54
|
+
wait(options: {
|
|
55
|
+
timeoutMs: number;
|
|
56
|
+
pollMs?: number;
|
|
57
|
+
}): Promise<BalanceSnapshot | PositionSnapshot | FillSnapshot | QuoteBalanceSnapshot>;
|
|
58
|
+
close(): Promise<string>;
|
|
59
|
+
}
|