@percolatorct/sdk 1.0.0-beta.9 → 2.0.1

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.
@@ -0,0 +1,136 @@
1
+ /**
2
+ * Standalone percolator-nft program SDK module.
3
+ *
4
+ * This covers the NFT program at `PERCOLATOR_NFT_PROGRAM_ID` which is
5
+ * separate from the main Percolator program. It handles:
6
+ * - MintPositionNft (tag 0)
7
+ * - BurnPositionNft (tag 1)
8
+ * - SettleFunding (tag 2)
9
+ * - GetPositionValue (tag 3)
10
+ * - ExecuteTransferHook (tag 4, SPL interface — not called directly)
11
+ * - EmergencyBurn (tag 5)
12
+ *
13
+ * PDA seeds (matches percolator-nft/src/state.rs):
14
+ * PositionNft state : ["position_nft", slab, user_idx_u16_LE]
15
+ * PositionNft mint : ["position_nft_mint", slab, user_idx_u16_LE]
16
+ * Mint authority : ["mint_authority"]
17
+ */
18
+ import { PublicKey } from "@solana/web3.js";
19
+ /** The standalone percolator-nft program (TransferHook + mint authority). */
20
+ export declare const NFT_PROGRAM_ID: PublicKey;
21
+ export declare function getNftProgramId(): PublicKey;
22
+ export declare const NFT_IX_TAG: {
23
+ readonly MintPositionNft: 0;
24
+ readonly BurnPositionNft: 1;
25
+ readonly SettleFunding: 2;
26
+ readonly GetPositionValue: 3;
27
+ readonly ExecuteTransferHook: 4;
28
+ readonly EmergencyBurn: 5;
29
+ };
30
+ /** Encode MintPositionNft (tag 0). Data: tag(1) + user_idx(2). */
31
+ export declare function encodeNftMint(userIdx: number): Uint8Array;
32
+ /** Encode BurnPositionNft (tag 1). Data: tag(1). */
33
+ export declare function encodeNftBurn(): Uint8Array;
34
+ /** Encode SettleFunding (tag 2). Data: tag(1). */
35
+ export declare function encodeNftSettleFunding(): Uint8Array;
36
+ /** Encode EmergencyBurn (tag 5). Data: tag(1). */
37
+ export declare function encodeNftEmergencyBurn(): Uint8Array;
38
+ type AccountMeta = "s" | "w" | "sw" | "r";
39
+ /**
40
+ * Account metas for MintPositionNft (tag 0).
41
+ *
42
+ * 0. [signer, writable] payer / position owner
43
+ * 1. [writable] PositionNft PDA (created)
44
+ * 2. [writable, signer] NFT mint (Token-2022, fresh keypair)
45
+ * 3. [writable] Owner's NFT ATA (created)
46
+ * 4. [] Slab account
47
+ * 5. [] Mint authority PDA
48
+ * 6. [] Token-2022 program
49
+ * 7. [] Associated token account program
50
+ * 8. [] System program
51
+ * 9. [writable] ExtraAccountMetaList PDA
52
+ */
53
+ export declare const ACCOUNTS_NFT_MINT: AccountMeta[];
54
+ /**
55
+ * Account metas for BurnPositionNft (tag 1).
56
+ *
57
+ * 0. [signer] NFT holder
58
+ * 1. [writable] PositionNft PDA (closed)
59
+ * 2. [writable] NFT mint (supply → 0)
60
+ * 3. [writable] Holder's NFT ATA (closed)
61
+ * 4. [] Slab account
62
+ * 5. [] Mint authority PDA
63
+ * 6. [] Token-2022 program
64
+ */
65
+ export declare const ACCOUNTS_NFT_BURN: AccountMeta[];
66
+ /**
67
+ * Account metas for EmergencyBurn (tag 5).
68
+ *
69
+ * 0. [signer] NFT holder
70
+ * 1. [writable] PositionNft PDA (closed)
71
+ * 2. [writable] NFT mint
72
+ * 3. [writable] Holder's NFT ATA
73
+ * 4. [] Slab account
74
+ * 5. [] Mint authority PDA
75
+ * 6. [] Token-2022 program
76
+ */
77
+ export declare const ACCOUNTS_NFT_EMERGENCY_BURN: AccountMeta[];
78
+ /**
79
+ * Derive the PositionNft state PDA.
80
+ * Seeds: ["position_nft", slab, user_idx_u16_LE]
81
+ */
82
+ export declare function deriveNftPda(slab: PublicKey, userIdx: number, programId?: PublicKey): [PublicKey, number];
83
+ /**
84
+ * Derive the PositionNft mint PDA.
85
+ * Seeds: ["position_nft_mint", slab, user_idx_u16_LE]
86
+ */
87
+ export declare function deriveNftMint(slab: PublicKey, userIdx: number, programId?: PublicKey): [PublicKey, number];
88
+ /**
89
+ * Derive the program-wide mint authority PDA.
90
+ * Seeds: ["mint_authority"]
91
+ */
92
+ export declare function deriveMintAuthority(programId?: PublicKey): [PublicKey, number];
93
+ /**
94
+ * On-chain PositionNft state (208 bytes, matches percolator-nft/src/state.rs).
95
+ *
96
+ * [0..8] magic u64
97
+ * [8] version u8
98
+ * [9] bump u8
99
+ * [10..16] _pad0
100
+ * [16..48] slab [u8; 32]
101
+ * [48..50] user_idx u16 LE
102
+ * [50..56] _pad1
103
+ * [56..88] nft_mint [u8; 32]
104
+ * [88..96] entry_price_e6 u64
105
+ * [96..104] position_size u64
106
+ * [104] is_long u8
107
+ * [105..112] _pad2
108
+ * [112..128] position_basis_q i128
109
+ * [128..144] last_funding_index_e18 i128
110
+ * [144..152] minted_at i64
111
+ * [152..160] account_id u64
112
+ * [160..192] position_owner [u8; 32]
113
+ * [192..208] _reserved
114
+ */
115
+ export declare const POSITION_NFT_STATE_LEN = 208;
116
+ export interface PositionNftState {
117
+ version: number;
118
+ bump: number;
119
+ slab: PublicKey;
120
+ userIdx: number;
121
+ nftMint: PublicKey;
122
+ positionOwner: PublicKey;
123
+ entryPriceE6: bigint;
124
+ positionSize: bigint;
125
+ isLong: boolean;
126
+ positionBasisQ: bigint;
127
+ lastFundingIndexE18: bigint;
128
+ mintedAt: bigint;
129
+ accountId: bigint;
130
+ }
131
+ /**
132
+ * Parse a PositionNft account from raw bytes.
133
+ * @throws if data is shorter than POSITION_NFT_STATE_LEN (208 bytes).
134
+ */
135
+ export declare function parsePositionNftAccount(data: Uint8Array): PositionNftState;
136
+ export {};
@@ -18,7 +18,7 @@ export declare const PROGRAM_IDS: {
18
18
  };
19
19
  readonly mainnet: {
20
20
  readonly percolator: "ESa89R5Es3rJ5mnwGybVRG1GrNt9etP11Z5V2QWD4edv";
21
- readonly matcher: "DHP6DtwXP1yJsz8YzfoeigRFPB979gzmumkmCxDLSkUX";
21
+ readonly matcher: "GDK8wx38kpiSVSfGTVNiSdptX3Z5R4kQyqh6Q3QX6wmi";
22
22
  };
23
23
  };
24
24
  export type Network = "devnet" | "mainnet";