@craftec/flowcraft-sdk 0.1.7 → 0.1.9
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 +37 -37
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +120 -121
- package/dist/client.js.map +1 -1
- package/dist/constants.d.ts +1 -1
- package/dist/constants.d.ts.map +1 -1
- package/dist/constants.js +2 -2
- package/dist/constants.js.map +1 -1
- package/dist/idl.json +434 -444
- package/dist/index.d.ts +3 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/dist/types.d.ts +19 -19
- package/dist/types.d.ts.map +1 -1
- package/dist/utils.d.ts +5 -5
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +14 -14
- package/dist/utils.js.map +1 -1
- package/package.json +2 -2
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,9 +16,9 @@ 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
|
/**
|
|
23
23
|
* Get the vault PDA for a pool
|
|
24
24
|
*/
|
|
@@ -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
|
-
|
|
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,16 +71,16 @@ export declare class FlowcraftClient {
|
|
|
71
71
|
vault: PublicKey;
|
|
72
72
|
}>;
|
|
73
73
|
/**
|
|
74
|
-
*
|
|
75
|
-
* For new
|
|
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.
|
|
76
76
|
*/
|
|
77
|
-
|
|
77
|
+
createPass(holder: Keypair, params: CreatePassParams): Promise<{
|
|
78
78
|
signature: string;
|
|
79
|
-
|
|
79
|
+
pass: PublicKey;
|
|
80
80
|
segmentIndex: number;
|
|
81
81
|
}>;
|
|
82
82
|
/**
|
|
83
|
-
* Add a new segment to an existing
|
|
83
|
+
* Add a new segment to an existing pass
|
|
84
84
|
*/
|
|
85
85
|
addSegment(payer: Keypair, params: AddSegmentParams): Promise<{
|
|
86
86
|
signature: string;
|
|
@@ -91,63 +91,63 @@ export declare class FlowcraftClient {
|
|
|
91
91
|
*/
|
|
92
92
|
claim(owner: Keypair, params: ClaimParams): Promise<string>;
|
|
93
93
|
/**
|
|
94
|
-
* Claim vested tokens from multiple
|
|
94
|
+
* Claim vested tokens from multiple passes in a single transaction
|
|
95
95
|
*/
|
|
96
96
|
claimBatch(owner: Keypair, params: {
|
|
97
97
|
pool: PublicKey;
|
|
98
|
-
|
|
98
|
+
passes: PublicKey[];
|
|
99
99
|
ownerTokenAccount: PublicKey;
|
|
100
100
|
}): Promise<string>;
|
|
101
101
|
/**
|
|
102
|
-
* Build batch claim transactions for all
|
|
102
|
+
* Build batch claim transactions for all passes in a pool
|
|
103
103
|
* Returns transactions ready to be signed with signAllTransactions
|
|
104
104
|
*/
|
|
105
105
|
buildClaimAllTransactions(owner: PublicKey, pool: PublicKey, ownerTokenAccount: PublicKey, batchSize?: number): Promise<{
|
|
106
106
|
transactions: any[];
|
|
107
|
-
|
|
107
|
+
totalPasses: number;
|
|
108
108
|
}>;
|
|
109
109
|
/**
|
|
110
|
-
* Cancel a segment (
|
|
110
|
+
* Cancel a segment (holder only)
|
|
111
111
|
*/
|
|
112
|
-
cancelSegment(
|
|
112
|
+
cancelSegment(holder: Keypair, params: CancelSegmentParams): Promise<string>;
|
|
113
113
|
/**
|
|
114
|
-
*
|
|
114
|
+
* Change segment tier (upgrade or downgrade)
|
|
115
115
|
*/
|
|
116
|
-
|
|
116
|
+
changeSegment(caller: Keypair, params: ChangeSegmentParams): Promise<string>;
|
|
117
117
|
/**
|
|
118
118
|
* Check if a pool exists
|
|
119
119
|
*/
|
|
120
120
|
poolExists(owner: PublicKey, name: string): Promise<boolean>;
|
|
121
121
|
/**
|
|
122
|
-
* Check if a
|
|
122
|
+
* Check if a pass exists
|
|
123
123
|
*/
|
|
124
|
-
|
|
124
|
+
passExists(pool: PublicKey, holder: PublicKey): Promise<boolean>;
|
|
125
125
|
/**
|
|
126
|
-
* Get claimable amount for a
|
|
126
|
+
* Get claimable amount for a pass
|
|
127
127
|
*/
|
|
128
|
-
getClaimable(
|
|
128
|
+
getClaimable(pass: PublicKey): Promise<BN>;
|
|
129
129
|
/**
|
|
130
|
-
* Check if
|
|
130
|
+
* Check if pass is expired
|
|
131
131
|
*/
|
|
132
|
-
|
|
132
|
+
isPassExpired(pass: PublicKey): Promise<boolean>;
|
|
133
133
|
/**
|
|
134
|
-
* Fetch all
|
|
135
|
-
*
|
|
134
|
+
* Fetch all passes for a pool using getProgramAccounts
|
|
135
|
+
* Pass account layout: [8 discriminator][32 pool][32 holder]...
|
|
136
136
|
* Filter by pool pubkey at offset 8
|
|
137
137
|
*/
|
|
138
|
-
|
|
138
|
+
fetchPassesByPool(pool: PublicKey): Promise<PassWithAddress[]>;
|
|
139
139
|
/**
|
|
140
140
|
* Calculate real-time aggregate statistics for a pool
|
|
141
|
-
* Fetches all
|
|
141
|
+
* Fetches all passes and calculates vesting off-chain
|
|
142
142
|
*/
|
|
143
143
|
getPoolAggregateStats(pool: PublicKey): Promise<PoolAggregateStats>;
|
|
144
144
|
/**
|
|
145
|
-
* Get real-time claimable amount for a
|
|
145
|
+
* Get real-time claimable amount for a pass (calculated off-chain)
|
|
146
146
|
*/
|
|
147
|
-
getRealTimeClaimable(
|
|
147
|
+
getRealTimeClaimable(passAddress: PublicKey): Promise<BN>;
|
|
148
148
|
/**
|
|
149
|
-
* Get detailed
|
|
149
|
+
* Get detailed pass info with real-time vesting calculation
|
|
150
150
|
*/
|
|
151
|
-
|
|
151
|
+
getPassInfoRealTime(passAddress: PublicKey): Promise<PassInfo | null>;
|
|
152
152
|
}
|
|
153
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;IA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