@craftec/flowcraft-sdk 0.1.12 → 0.1.13
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/client.d.ts +41 -36
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +129 -105
- package/dist/client.js.map +1 -1
- package/dist/idl.json +448 -378
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +20 -18
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +3 -3
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +9 -9
- package/dist/utils.js.map +1 -1
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Connection, PublicKey, Keypair } from "@solana/web3.js";
|
|
2
2
|
import { Program, AnchorProvider, Wallet, BN, Idl } from "@coral-xyz/anchor";
|
|
3
|
-
import { Config, Pool,
|
|
3
|
+
import { Config, Pool, Pass, PoolInfo, PassInfo, PoolAggregateStats, PassWithAddress, CreatePoolParams, CreatePassParams, AddSegmentParams, ClaimParams, CancelSegmentParams, ChangeSegmentParams } from "./types";
|
|
4
4
|
export declare const IDL: Idl;
|
|
5
5
|
export declare class FlowcraftClient {
|
|
6
6
|
readonly program: Program;
|
|
@@ -16,7 +16,7 @@ export declare class FlowcraftClient {
|
|
|
16
16
|
*/
|
|
17
17
|
getPoolPda(owner: PublicKey, name: string): [PublicKey, number];
|
|
18
18
|
/**
|
|
19
|
-
* Get the
|
|
19
|
+
* Get the pass PDA for a pool and holder
|
|
20
20
|
*/
|
|
21
21
|
getPassPda(pool: PublicKey, holder: PublicKey): [PublicKey, number];
|
|
22
22
|
/**
|
|
@@ -36,21 +36,21 @@ export declare class FlowcraftClient {
|
|
|
36
36
|
*/
|
|
37
37
|
fetchPoolByOwner(owner: PublicKey, name: string): Promise<Pool | null>;
|
|
38
38
|
/**
|
|
39
|
-
* Fetch a
|
|
39
|
+
* Fetch a pass by address
|
|
40
40
|
*/
|
|
41
|
-
|
|
41
|
+
fetchPass(pass: PublicKey): Promise<Pass | null>;
|
|
42
42
|
/**
|
|
43
|
-
* Fetch a
|
|
43
|
+
* Fetch a pass by pool and holder
|
|
44
44
|
*/
|
|
45
|
-
fetchPassByHolder(pool: PublicKey,
|
|
45
|
+
fetchPassByHolder(pool: PublicKey, holder: PublicKey): Promise<Pass | null>;
|
|
46
46
|
/**
|
|
47
47
|
* Fetch pool with computed info
|
|
48
48
|
*/
|
|
49
49
|
getPoolInfo(pool: PublicKey): Promise<PoolInfo | null>;
|
|
50
50
|
/**
|
|
51
|
-
* Fetch
|
|
51
|
+
* Fetch pass with computed info
|
|
52
52
|
*/
|
|
53
|
-
|
|
53
|
+
getPassInfo(pass: PublicKey): Promise<PassInfo | null>;
|
|
54
54
|
/**
|
|
55
55
|
* Initialize the protocol config (one-time setup)
|
|
56
56
|
*/
|
|
@@ -60,7 +60,7 @@ export declare class FlowcraftClient {
|
|
|
60
60
|
*/
|
|
61
61
|
updateConfig(admin: Keypair, newTreasury?: PublicKey, newFeeBps?: number, newAdmin?: PublicKey): Promise<string>;
|
|
62
62
|
/**
|
|
63
|
-
* Create a new
|
|
63
|
+
* Create a new pool
|
|
64
64
|
* @param payer - Keypair that pays for rent (signs the transaction)
|
|
65
65
|
* @param owner - PublicKey of pool owner (can be any account, including PDA)
|
|
66
66
|
* @param params - Pool creation parameters
|
|
@@ -71,78 +71,83 @@ export declare class FlowcraftClient {
|
|
|
71
71
|
vault: PublicKey;
|
|
72
72
|
}>;
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
74
|
+
* Create a pass (creates pass with first segment)
|
|
75
|
+
* For new passes, segmentIndex is 0. For reactivated expired passes, segments are cleared so index is also 0.
|
|
75
76
|
*/
|
|
76
|
-
|
|
77
|
+
createPass(holder: Keypair, params: CreatePassParams): Promise<{
|
|
77
78
|
signature: string;
|
|
78
|
-
|
|
79
|
+
pass: PublicKey;
|
|
80
|
+
segmentIndex: number;
|
|
79
81
|
}>;
|
|
80
82
|
/**
|
|
81
|
-
* Add a new segment to an existing
|
|
83
|
+
* Add a new segment to an existing pass
|
|
82
84
|
*/
|
|
83
|
-
addSegment(payer: Keypair, params: AddSegmentParams): Promise<
|
|
85
|
+
addSegment(payer: Keypair, params: AddSegmentParams): Promise<{
|
|
86
|
+
signature: string;
|
|
87
|
+
segmentIndex: number;
|
|
88
|
+
}>;
|
|
84
89
|
/**
|
|
85
90
|
* Claim vested tokens (pool owner only)
|
|
86
91
|
*/
|
|
87
92
|
claim(owner: Keypair, params: ClaimParams): Promise<string>;
|
|
88
93
|
/**
|
|
89
|
-
* Claim vested tokens from multiple
|
|
94
|
+
* Claim vested tokens from multiple passes in a single transaction
|
|
90
95
|
*/
|
|
91
96
|
claimBatch(owner: Keypair, params: {
|
|
92
97
|
pool: PublicKey;
|
|
93
|
-
|
|
98
|
+
passes: PublicKey[];
|
|
94
99
|
ownerTokenAccount: PublicKey;
|
|
95
100
|
}): Promise<string>;
|
|
96
101
|
/**
|
|
97
|
-
* Build batch claim transactions for all
|
|
102
|
+
* Build batch claim transactions for all passes in a pool
|
|
98
103
|
* Returns transactions ready to be signed with signAllTransactions
|
|
99
104
|
*/
|
|
100
105
|
buildClaimAllTransactions(owner: PublicKey, pool: PublicKey, ownerTokenAccount: PublicKey, batchSize?: number): Promise<{
|
|
101
106
|
transactions: any[];
|
|
102
|
-
|
|
107
|
+
totalPasses: number;
|
|
103
108
|
}>;
|
|
104
109
|
/**
|
|
105
|
-
* Cancel a segment (
|
|
110
|
+
* Cancel a segment (holder only)
|
|
106
111
|
*/
|
|
107
|
-
cancelSegment(
|
|
112
|
+
cancelSegment(holder: Keypair, params: CancelSegmentParams): Promise<string>;
|
|
108
113
|
/**
|
|
109
|
-
*
|
|
114
|
+
* Change segment tier (upgrade or downgrade)
|
|
110
115
|
*/
|
|
111
|
-
|
|
116
|
+
changeSegment(caller: Keypair, params: ChangeSegmentParams): Promise<string>;
|
|
112
117
|
/**
|
|
113
118
|
* Check if a pool exists
|
|
114
119
|
*/
|
|
115
120
|
poolExists(owner: PublicKey, name: string): Promise<boolean>;
|
|
116
121
|
/**
|
|
117
|
-
* Check if a
|
|
122
|
+
* Check if a pass exists
|
|
118
123
|
*/
|
|
119
|
-
|
|
124
|
+
passExists(pool: PublicKey, holder: PublicKey): Promise<boolean>;
|
|
120
125
|
/**
|
|
121
|
-
* Get claimable amount for a
|
|
126
|
+
* Get claimable amount for a pass
|
|
122
127
|
*/
|
|
123
|
-
getClaimable(
|
|
128
|
+
getClaimable(pass: PublicKey): Promise<BN>;
|
|
124
129
|
/**
|
|
125
|
-
* Check if
|
|
130
|
+
* Check if pass is expired
|
|
126
131
|
*/
|
|
127
|
-
|
|
132
|
+
isPassExpired(pass: PublicKey): Promise<boolean>;
|
|
128
133
|
/**
|
|
129
|
-
* Fetch all
|
|
130
|
-
*
|
|
134
|
+
* Fetch all passes for a pool using getProgramAccounts
|
|
135
|
+
* Pass account layout: [8 discriminator][32 pool][32 holder]...
|
|
131
136
|
* Filter by pool pubkey at offset 8
|
|
132
137
|
*/
|
|
133
|
-
|
|
138
|
+
fetchPassesByPool(pool: PublicKey): Promise<PassWithAddress[]>;
|
|
134
139
|
/**
|
|
135
140
|
* Calculate real-time aggregate statistics for a pool
|
|
136
|
-
* Fetches all
|
|
141
|
+
* Fetches all passes and calculates vesting off-chain
|
|
137
142
|
*/
|
|
138
143
|
getPoolAggregateStats(pool: PublicKey): Promise<PoolAggregateStats>;
|
|
139
144
|
/**
|
|
140
|
-
* Get real-time claimable amount for a
|
|
145
|
+
* Get real-time claimable amount for a pass (calculated off-chain)
|
|
141
146
|
*/
|
|
142
|
-
getRealTimeClaimable(
|
|
147
|
+
getRealTimeClaimable(passAddress: PublicKey): Promise<BN>;
|
|
143
148
|
/**
|
|
144
|
-
* Get detailed
|
|
149
|
+
* Get detailed pass info with real-time vesting calculation
|
|
145
150
|
*/
|
|
146
|
-
|
|
151
|
+
getPassInfoRealTime(passAddress: PublicKey): Promise<PassInfo | null>;
|
|
147
152
|
}
|
|
148
153
|
//# sourceMappingURL=client.d.ts.map
|
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,OAAO,EAER,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,OAAO,EACP,cAAc,EACd,MAAM,EACN,EAAE,EACF,GAAG,EACJ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,MAAM,EACN,IAAI,EACJ,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,UAAU,EACV,SAAS,EACT,OAAO,EAER,MAAM,iBAAiB,CAAC;AACzB,OAAO,EACL,OAAO,EACP,cAAc,EACd,MAAM,EACN,EAAE,EACF,GAAG,EACJ,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,MAAM,EACN,IAAI,EACJ,IAAI,EACJ,QAAQ,EACR,QAAQ,EAER,kBAAkB,EAClB,eAAe,EACf,gBAAgB,EAChB,gBAAgB,EAChB,gBAAgB,EAChB,WAAW,EACX,mBAAmB,EACnB,mBAAmB,EACpB,MAAM,SAAS,CAAC;AAYjB,eAAO,MAAM,GAAG,EAAE,GAAqB,CAAC;AAExC,qBAAa,eAAe;IAC1B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,QAAQ,EAAE,cAAc,CAAC;IAClC,QAAQ,CAAC,SAAS,EAAE,SAAS,CAAC;gBAG5B,UAAU,EAAE,UAAU,EACtB,MAAM,EAAE,MAAM,EACd,SAAS,GAAE,SAAsB,EACjC,GAAG,GAAE,GAAS;IAahB;;OAEG;IACH,YAAY,IAAI,CAAC,SAAS,EAAE,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