@steerprotocol/sdk 0.1.4 → 1.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/cjs/base/SmartRewardClient.js +55 -0
- package/dist/cjs/base/SmartRewardClient.js.map +1 -0
- package/dist/cjs/base/SmartRewards.js +508 -0
- package/dist/cjs/base/SmartRewards.js.map +1 -0
- package/dist/cjs/base/SubgraphClient.js.map +1 -1
- package/dist/cjs/base/VaultClient.js +87 -0
- package/dist/cjs/base/VaultClient.js.map +1 -1
- package/dist/cjs/client.js +67 -1
- package/dist/cjs/client.js.map +1 -1
- package/dist/cjs/const/abis/UniswapPool.js +5 -0
- package/dist/cjs/const/abis/UniswapPool.js.map +1 -0
- package/dist/cjs/const/api.js +28 -0
- package/dist/cjs/const/api.js.map +1 -0
- package/dist/cjs/index.js +67 -0
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/base/SmartRewardClient.js +51 -0
- package/dist/esm/base/SmartRewardClient.js.map +1 -0
- package/dist/esm/base/SmartRewards.js +504 -0
- package/dist/esm/base/SmartRewards.js.map +1 -0
- package/dist/esm/base/SubgraphClient.js.map +1 -1
- package/dist/esm/base/VaultClient.js +87 -0
- package/dist/esm/base/VaultClient.js.map +1 -1
- package/dist/esm/client.js +67 -1
- package/dist/esm/client.js.map +1 -1
- package/dist/esm/const/abis/UniswapPool.js +2 -0
- package/dist/esm/const/abis/UniswapPool.js.map +1 -0
- package/dist/esm/const/api.js +24 -0
- package/dist/esm/const/api.js.map +1 -0
- package/dist/esm/index.js +67 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/types/base/SmartRewardClient.d.ts +46 -0
- package/dist/types/base/SmartRewardClient.d.ts.map +1 -0
- package/dist/types/base/SmartRewards.d.ts +291 -0
- package/dist/types/base/SmartRewards.d.ts.map +1 -0
- package/dist/types/base/SubgraphClient.d.ts +1 -1
- package/dist/types/base/SubgraphClient.d.ts.map +1 -1
- package/dist/types/base/VaultClient.d.ts +2 -0
- package/dist/types/base/VaultClient.d.ts.map +1 -1
- package/dist/types/client.d.ts +55 -0
- package/dist/types/client.d.ts.map +1 -1
- package/dist/types/const/abis/UniswapPool.d.ts +36 -0
- package/dist/types/const/abis/UniswapPool.d.ts.map +1 -0
- package/dist/types/const/api.d.ts +17 -0
- package/dist/types/const/api.d.ts.map +1 -0
- package/dist/types/index.d.ts +67 -0
- package/dist/types/index.d.ts.map +1 -1
- package/dist/types/types.d.ts +2 -1
- package/dist/types/types.d.ts.map +1 -1
- package/package.json +23 -3
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
import { Campaign, createClient } from '@steerprotocol/api-sdk';
|
|
2
|
+
import type { Address, Hash, PublicClient, WalletClient } from 'viem';
|
|
3
|
+
import { SteerResponse } from '../types';
|
|
4
|
+
/**
|
|
5
|
+
* Represents a node in the claim proof data structure
|
|
6
|
+
* @property chainId - The ID of the chain where the claim exists
|
|
7
|
+
* @property lastBlockUpdatedTo - The last block number this claim was updated to
|
|
8
|
+
* @property user - The address of the user who can claim
|
|
9
|
+
* @property campaignId - The ID of the campaign this claim belongs to
|
|
10
|
+
* @property amount - The claimable amount as a string (may include decimals)
|
|
11
|
+
* @property proof - The merkle proof array required for claiming
|
|
12
|
+
*/
|
|
13
|
+
export interface ClaimProofNode {
|
|
14
|
+
chainId: number;
|
|
15
|
+
lastBlockUpdatedTo: number;
|
|
16
|
+
user: string;
|
|
17
|
+
campaignId: number;
|
|
18
|
+
amount: string;
|
|
19
|
+
proof: readonly string[];
|
|
20
|
+
}
|
|
21
|
+
export interface ClaimProofEdge {
|
|
22
|
+
node: ClaimProofNode;
|
|
23
|
+
cursor: string;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Represents a historical claim reward record
|
|
27
|
+
* @property id - Unique identifier for the claim
|
|
28
|
+
* @property user - Address of the user who claimed
|
|
29
|
+
* @property amount - Amount that was claimed (may include decimals)
|
|
30
|
+
* @property campaign - Campaign identifier
|
|
31
|
+
* @property chainId - Chain ID where the claim occurred
|
|
32
|
+
* @property timestamp - Unix timestamp of when the claim occurred
|
|
33
|
+
*/
|
|
34
|
+
export interface ClaimRewardNode {
|
|
35
|
+
id: string;
|
|
36
|
+
user: string;
|
|
37
|
+
amount: string;
|
|
38
|
+
campaign: string;
|
|
39
|
+
chainId: number;
|
|
40
|
+
timestamp: number;
|
|
41
|
+
}
|
|
42
|
+
export interface ClaimRewardEdge {
|
|
43
|
+
cursor: string;
|
|
44
|
+
node: ClaimRewardNode;
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Pagination information for paginated queries
|
|
48
|
+
* @property hasNextPage - Whether there are more results available
|
|
49
|
+
* @property endCursor - Cursor to use for fetching next page, if available
|
|
50
|
+
*/
|
|
51
|
+
export interface PageInfo {
|
|
52
|
+
hasNextPage: boolean;
|
|
53
|
+
endCursor: string | null | undefined;
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Connection type for claim rewards, following the Relay specification
|
|
57
|
+
* @property edges - Array of claim reward records with cursors
|
|
58
|
+
* @property pageInfo - Pagination information
|
|
59
|
+
* @property totalCount - Total number of records available
|
|
60
|
+
*/
|
|
61
|
+
export interface ClaimRewardsConnection {
|
|
62
|
+
edges: readonly ClaimRewardEdge[];
|
|
63
|
+
pageInfo: PageInfo;
|
|
64
|
+
totalCount: number;
|
|
65
|
+
}
|
|
66
|
+
export interface ClaimProofsPageInfo {
|
|
67
|
+
hasNextPage: boolean;
|
|
68
|
+
endCursor?: string;
|
|
69
|
+
}
|
|
70
|
+
export interface ClaimProofsResponse {
|
|
71
|
+
totalCount: number;
|
|
72
|
+
edges: readonly ClaimProofEdge[];
|
|
73
|
+
pageInfo: ClaimProofsPageInfo;
|
|
74
|
+
}
|
|
75
|
+
export interface SmartRewarderContract {
|
|
76
|
+
chainId: number;
|
|
77
|
+
address: string;
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Parameters required for claiming rewards
|
|
81
|
+
* @property users - Array of user addresses who are claiming
|
|
82
|
+
* @property campaignIds - Array of campaign IDs corresponding to each claim
|
|
83
|
+
* @property amounts - Array of amounts to claim
|
|
84
|
+
* @property proofs - Array of merkle proofs for verification
|
|
85
|
+
* @property rewarderAddress - Address of the smart rewarder contract
|
|
86
|
+
*/
|
|
87
|
+
export interface ClaimRewardParams {
|
|
88
|
+
users: readonly Address[];
|
|
89
|
+
campaignIds: readonly bigint[];
|
|
90
|
+
amounts: readonly bigint[];
|
|
91
|
+
proofs: readonly (readonly `0x${string}`[])[];
|
|
92
|
+
rewarderAddress: Address;
|
|
93
|
+
}
|
|
94
|
+
/**
|
|
95
|
+
* Represents a reward balance with both native and formatted values
|
|
96
|
+
* @property formatted - Human-readable string format with proper decimals
|
|
97
|
+
* @property native - Raw bigint value
|
|
98
|
+
*/
|
|
99
|
+
export interface RewardBalance {
|
|
100
|
+
formatted: string;
|
|
101
|
+
native: bigint;
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Comprehensive summary of a user's reward status
|
|
105
|
+
* @property totalEarned - Total rewards earned (claimed + claimable)
|
|
106
|
+
* @property totalClaimed - Total rewards already claimed
|
|
107
|
+
* @property claimable - Rewards available to claim
|
|
108
|
+
*/
|
|
109
|
+
export interface RewardSummary {
|
|
110
|
+
totalEarned: RewardBalance;
|
|
111
|
+
totalClaimed: RewardBalance;
|
|
112
|
+
claimable: RewardBalance;
|
|
113
|
+
}
|
|
114
|
+
export declare abstract class SmartRewards {
|
|
115
|
+
protected readonly client: ReturnType<typeof createClient>;
|
|
116
|
+
protected readonly publicClient: PublicClient;
|
|
117
|
+
protected readonly walletClient: WalletClient;
|
|
118
|
+
constructor(client: ReturnType<typeof createClient>, publicClient: PublicClient, walletClient: WalletClient);
|
|
119
|
+
getCampaigns(chainId: number): Promise<SteerResponse<Campaign[]>>;
|
|
120
|
+
/**
|
|
121
|
+
* Retrieves campaigns associated with a specific pool address
|
|
122
|
+
* @param poolAddress - The address of the pool to get campaigns for
|
|
123
|
+
* @param chainId - Chain ID where the pool exists
|
|
124
|
+
* @returns Promise resolving to an array of campaigns associated with the pool
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```typescript
|
|
128
|
+
* // Get campaigns for a pool on a specific chain
|
|
129
|
+
* const campaigns = await smartRewards.campaignsByPool('0x...', 1);
|
|
130
|
+
* ```
|
|
131
|
+
*/
|
|
132
|
+
campaignsByPool(poolAddress: string, chainId: number): Promise<SteerResponse<Campaign[]>>;
|
|
133
|
+
/**
|
|
134
|
+
* Retrieves claim proofs for a user that can be used to claim rewards
|
|
135
|
+
* @param user - Address of the user to get proofs for
|
|
136
|
+
* @param chainId - Chain ID where the claims exist
|
|
137
|
+
* @param campaignId - Optional campaign ID to filter claims
|
|
138
|
+
* @returns Promise resolving to claim proof data with pagination support
|
|
139
|
+
*/
|
|
140
|
+
getClaimProofs(user: Address, chainId: number, campaignId?: number): Promise<SteerResponse<ClaimProofsResponse>>;
|
|
141
|
+
/**
|
|
142
|
+
* Retrieves historical claim data for a specific pool
|
|
143
|
+
* @param chainId - Chain ID where the pool exists
|
|
144
|
+
* @param pool - Address or identifier of the pool
|
|
145
|
+
* @param user - Optional user address to filter claims
|
|
146
|
+
* @returns Promise resolving to paginated claim history data
|
|
147
|
+
*
|
|
148
|
+
* @example
|
|
149
|
+
* ```typescript
|
|
150
|
+
* // Get all claims for a pool
|
|
151
|
+
* const allClaims = await smartRewards.getClaimRewardsByPool(1, poolAddress);
|
|
152
|
+
*
|
|
153
|
+
* // Get claims for a specific user in a pool
|
|
154
|
+
* const userClaims = await smartRewards.getClaimRewardsByPool(1, poolAddress, userAddress);
|
|
155
|
+
* ```
|
|
156
|
+
*/
|
|
157
|
+
getClaimRewardsByPool(chainId: number, pool: string, user?: Address): Promise<SteerResponse<ClaimRewardsConnection>>;
|
|
158
|
+
/**
|
|
159
|
+
* Gets a comprehensive summary of a user's reward status
|
|
160
|
+
* @param user - Address of the user
|
|
161
|
+
* @param chainId - Chain ID to check rewards on
|
|
162
|
+
* @param campaignId - Optional campaign ID to filter rewards
|
|
163
|
+
* @param decimals - Number of decimals for formatting (default: 18)
|
|
164
|
+
* @returns Promise resolving to reward summary with both native and formatted values
|
|
165
|
+
*
|
|
166
|
+
* @example
|
|
167
|
+
* ```typescript
|
|
168
|
+
* const summary = await smartRewards.getRewardSummary(userAddress, chainId);
|
|
169
|
+
* console.log('Total earned:', summary.data.totalEarned.formatted);
|
|
170
|
+
* console.log('Available to claim:', summary.data.claimable.formatted);
|
|
171
|
+
* ```
|
|
172
|
+
*/
|
|
173
|
+
getRewardSummary(user: Address, chainId: number, campaignId?: number, decimals?: number): Promise<SteerResponse<RewardSummary>>;
|
|
174
|
+
getSmartRewarderContracts(): Promise<SteerResponse<readonly SmartRewarderContract[]>>;
|
|
175
|
+
/**
|
|
176
|
+
* Claims rewards from the smart rewarder contract
|
|
177
|
+
* @param params - Parameters required for claiming rewards
|
|
178
|
+
* @returns Promise resolving to transaction hash if successful
|
|
179
|
+
*
|
|
180
|
+
* @remarks
|
|
181
|
+
* This method handles the low-level interaction with the smart contract.
|
|
182
|
+
* For a higher-level interface, consider using {@link claimCampaignRewards} instead.
|
|
183
|
+
*
|
|
184
|
+
* @example
|
|
185
|
+
* ```typescript
|
|
186
|
+
* // Get claim proofs
|
|
187
|
+
* const claimProofs = await smartRewards.getClaimProofs(userAddress, chainId, campaignId);
|
|
188
|
+
*
|
|
189
|
+
* // Get smart rewarder contract
|
|
190
|
+
* const rewarders = await smartRewards.getSmartRewarderContracts();
|
|
191
|
+
* const rewarder = rewarders.data?.find(r => r.chainId === chainId);
|
|
192
|
+
*
|
|
193
|
+
* if (claimProofs.data && rewarder) {
|
|
194
|
+
* // Prepare claim data
|
|
195
|
+
* const claimData = smartRewards.prepareClaimData(claimProofs.data);
|
|
196
|
+
* claimData.rewarderAddress = rewarder.address as Address;
|
|
197
|
+
*
|
|
198
|
+
* // Claim rewards
|
|
199
|
+
* const tx = await smartRewards.claimReward(claimData);
|
|
200
|
+
* }
|
|
201
|
+
* ```
|
|
202
|
+
*
|
|
203
|
+
* @throws Will throw an error if no wallet account is found
|
|
204
|
+
* @throws Will throw an error if contract simulation fails
|
|
205
|
+
*/
|
|
206
|
+
claimReward(params: ClaimRewardParams): Promise<SteerResponse<Hash>>;
|
|
207
|
+
/**
|
|
208
|
+
* Helper function to prepare claim data from claim proofs
|
|
209
|
+
* @param proofs - The claim proofs response from getClaimProofs
|
|
210
|
+
* @returns ClaimRewardParams object ready for use with claimReward
|
|
211
|
+
*
|
|
212
|
+
* @remarks
|
|
213
|
+
* This helper function transforms the claim proofs into the format required by the smart contract.
|
|
214
|
+
* Note that the returned object's rewarderAddress is empty and must be set before using with claimReward.
|
|
215
|
+
*
|
|
216
|
+
* @example
|
|
217
|
+
* ```typescript
|
|
218
|
+
* // Get claim proofs and rewarder contract
|
|
219
|
+
* const proofs = await smartRewards.getClaimProofs(userAddress, chainId);
|
|
220
|
+
* const rewarders = await smartRewards.getSmartRewarderContracts();
|
|
221
|
+
* const rewarder = rewarders.data?.find(r => r.chainId === chainId);
|
|
222
|
+
*
|
|
223
|
+
* if (proofs.data && rewarder) {
|
|
224
|
+
* // Prepare the claim data
|
|
225
|
+
* const claimData = smartRewards.prepareClaimData(proofs.data);
|
|
226
|
+
*
|
|
227
|
+
* // Set the rewarder address (required)
|
|
228
|
+
* claimData.rewarderAddress = rewarder.address as Address;
|
|
229
|
+
*
|
|
230
|
+
* // Now the data is ready for claiming
|
|
231
|
+
* const tx = await smartRewards.claimReward(claimData);
|
|
232
|
+
* }
|
|
233
|
+
* ```
|
|
234
|
+
*/
|
|
235
|
+
prepareClaimData(proofs: ClaimProofsResponse): ClaimRewardParams;
|
|
236
|
+
/**
|
|
237
|
+
* Convenience function to handle the entire claim process
|
|
238
|
+
* @param userAddress The address of the user claiming rewards
|
|
239
|
+
* @param chainId The chain ID where the campaign exists
|
|
240
|
+
* @param campaignId Optional campaign ID to filter claims
|
|
241
|
+
* @returns Transaction hash if successful, or error details if failed
|
|
242
|
+
*/
|
|
243
|
+
claimCampaignRewards(userAddress: Address, chainId: number, campaignId?: number): Promise<SteerResponse<Hash>>;
|
|
244
|
+
/**
|
|
245
|
+
* Prepares the claim rewards campaign object with all necessary data for contract interaction
|
|
246
|
+
* @param userAddress The address of the user claiming rewards
|
|
247
|
+
* @param chainId The chain ID where the campaign exists
|
|
248
|
+
* @param campaignId Optional campaign ID to filter claims
|
|
249
|
+
* @returns Promise resolving to an object containing all necessary data for claiming rewards
|
|
250
|
+
*
|
|
251
|
+
* @example
|
|
252
|
+
* ```typescript
|
|
253
|
+
* // Get the prepared claim data
|
|
254
|
+
* const claimData = await smartRewards.prepareClaimRewardsCampaign(userAddress, chainId, campaignId);
|
|
255
|
+
*
|
|
256
|
+
* if (claimData.success) {
|
|
257
|
+
* // Use the data with your own contract interaction methods
|
|
258
|
+
* const { address, abi, functionName, args } = claimData.data;
|
|
259
|
+
* // Execute the contract call using your preferred method
|
|
260
|
+
* }
|
|
261
|
+
* ```
|
|
262
|
+
*/
|
|
263
|
+
prepareClaimRewardsCampaign(userAddress: Address, chainId: number, campaignId?: number): Promise<SteerResponse<{
|
|
264
|
+
address: Address;
|
|
265
|
+
abi: {
|
|
266
|
+
type: string;
|
|
267
|
+
inputs: {
|
|
268
|
+
name: string;
|
|
269
|
+
internalType: string;
|
|
270
|
+
type: string;
|
|
271
|
+
}[];
|
|
272
|
+
name: string;
|
|
273
|
+
outputs: never[];
|
|
274
|
+
stateMutability: string;
|
|
275
|
+
}[];
|
|
276
|
+
functionName: string;
|
|
277
|
+
args: readonly [
|
|
278
|
+
readonly Address[],
|
|
279
|
+
readonly bigint[],
|
|
280
|
+
readonly bigint[],
|
|
281
|
+
readonly (readonly `0x${string}`[])[]
|
|
282
|
+
];
|
|
283
|
+
}>>;
|
|
284
|
+
/**
|
|
285
|
+
* Checks if a chain is supported by checking if it has a subgraph URL
|
|
286
|
+
* @param chainId The chain ID to check
|
|
287
|
+
* @returns boolean indicating if the chain is supported
|
|
288
|
+
*/
|
|
289
|
+
supportsChain(chainId: number): boolean;
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=SmartRewards.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SmartRewards.d.ts","sourceRoot":"","sources":["../../../src/base/SmartRewards.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAChE,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAIzC;;;;;;;;GAQG;AACH,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,MAAM,CAAC;IAChB,kBAAkB,EAAE,MAAM,CAAC;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,SAAS,MAAM,EAAE,CAAC;CAC1B;AAED,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,cAAc,CAAC;IACrB,MAAM,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;;;GAQG;AACH,MAAM,WAAW,eAAe;IAC9B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,eAAe,CAAC;CACvB;AAED;;;;GAIG;AACH,MAAM,WAAW,QAAQ;IACvB,WAAW,EAAE,OAAO,CAAC;IACrB,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC;CACtC;AAED;;;;;GAKG;AACH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AAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IAyC/B;;;;;;;;;;;;;;;;;;OAkBG;IACU,2BAA2B,CACtC,WAAW,EAAE,OAAO,EACpB,OAAO,EAAE,MAAM,EACf,UAAU,CAAC,EAAE,MAAM,GAClB,OAAO,CAAC,aAAa,CAAC;QACvB,OAAO,EAAE,OAAO,CAAC;QACjB,GAAG,EAAE;YACH,IAAI,EAAE,MAAM,CAAC;YACb,MAAM,EAAE;gBACN,IAAI,EAAE,MAAM,CAAC;gBACb,YAAY,EAAE,MAAM,CAAC;gBACrB,IAAI,EAAE,MAAM,CAAC;aACd,EAAE,CAAC;YACJ,IAAI,EAAE,MAAM,CAAC;YACb,OAAO,EAAE,KAAK,EAAE,CAAC;YACjB,eAAe,EAAE,MAAM,CAAC;SACzB,EAAE,CAAC;QACJ,YAAY,EAAE,MAAM,CAAC;QACrB,IAAI,EAAE,SAAS;YACb,SAAS,OAAO,EAAE;YAClB,SAAS,MAAM,EAAE;YACjB,SAAS,MAAM,EAAE;YACjB,SAAS,CAAC,SAAS,KAAK,MAAM,EAAE,EAAE,CAAC,EAAE;SACtC,CAAC;KACH,CAAC,CAAC;IAiEH;;;;OAIG;IACI,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CAG/C"}
|
|
@@ -9,7 +9,7 @@ export declare abstract class SubgraphClient {
|
|
|
9
9
|
* @param variables Optional variables for the query
|
|
10
10
|
* @returns Promise with the query result
|
|
11
11
|
*/
|
|
12
|
-
protected executeSubgraphQuery<T>(query: string, variables?: Record<string,
|
|
12
|
+
protected executeSubgraphQuery<T>(query: string, variables?: Record<string, unknown>): Promise<SteerResponse<T>>;
|
|
13
13
|
/**
|
|
14
14
|
* Gets the subgraph URL for a given chain ID
|
|
15
15
|
* @param chainId The chain ID to get the subgraph URL for
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SubgraphClient.d.ts","sourceRoot":"","sources":["../../../src/base/SubgraphClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,8BAAsB,cAAc;IAClC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEtB,MAAM,EAAE,MAAM;IAI1B;;;;;OAKG;cACa,oBAAoB,CAAC,CAAC,EACpC,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"SubgraphClient.d.ts","sourceRoot":"","sources":["../../../src/base/SubgraphClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AACnC,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAGzC,8BAAsB,cAAc;IAClC,SAAS,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;gBAEtB,MAAM,EAAE,MAAM;IAI1B;;;;;OAKG;cACa,oBAAoB,CAAC,CAAC,EACpC,KAAK,EAAE,MAAM,EACb,SAAS,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAClC,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IAiD5B;;;;OAIG;IACH,SAAS,CAAC,cAAc,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAI7D;;;;OAIG;IACI,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO;CAG/C"}
|
|
@@ -42,6 +42,7 @@ export declare class VaultClient extends SubgraphClient {
|
|
|
42
42
|
* @param params The deposit parameters
|
|
43
43
|
*/
|
|
44
44
|
deposit(params: VaultDepositParams): Promise<SteerResponse<Hash>>;
|
|
45
|
+
getDepositRatio(vaultAddress: Address): Promise<SteerResponse<bigint>>;
|
|
45
46
|
/**
|
|
46
47
|
* Withdraws tokens from a vault
|
|
47
48
|
* @param params The withdrawal parameters
|
|
@@ -82,5 +83,6 @@ export declare class VaultClient extends SubgraphClient {
|
|
|
82
83
|
* @param vaultAddress The vault address
|
|
83
84
|
*/
|
|
84
85
|
name(vaultAddress: Address): Promise<SteerResponse<string>>;
|
|
86
|
+
pool(vaultAddress: Address): Promise<SteerResponse<Address>>;
|
|
85
87
|
}
|
|
86
88
|
//# sourceMappingURL=VaultClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"VaultClient.d.ts","sourceRoot":"","sources":["../../../src/base/VaultClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"VaultClient.d.ts","sourceRoot":"","sources":["../../../src/base/VaultClient.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AACtE,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAOlD,MAAM,WAAW,kBAAkB;IACjC,YAAY,EAAE,OAAO,CAAC;IACtB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,EAAE,CAAC,EAAE,OAAO,CAAC;CACd;AAED,MAAM,WAAW,mBAAmB;IAClC,YAAY,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,EAAE,CAAC,EAAE,OAAO,CAAC;CACd;AAED,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,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAuB/E;;;OAGG;IACU,QAAQ,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAuB5E;;;OAGG;IACU,MAAM,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAuB1E;;;OAGG;IACU,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,CAAC;IAuB3D,IAAI,CAAC,YAAY,EAAE,OAAO,GAAG,OAAO,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;CAsB1E"}
|
package/dist/types/client.d.ts
CHANGED
|
@@ -1,12 +1,67 @@
|
|
|
1
1
|
import { SteerConfig, SteerResponse } from './types';
|
|
2
2
|
import { SubgraphClient } from './base/SubgraphClient';
|
|
3
3
|
import { VaultClient } from './base/VaultClient';
|
|
4
|
+
import { SmartRewardsClient } from './base/SmartRewardClient';
|
|
5
|
+
/**
|
|
6
|
+
* The main client for interacting with the Steer Protocol.
|
|
7
|
+
* This client provides access to vault operations and smart rewards functionality.
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```typescript
|
|
11
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
12
|
+
* import { mainnet } from 'viem/chains';
|
|
13
|
+
* import { SteerClient } from '@steerprotocol/sdk';
|
|
14
|
+
*
|
|
15
|
+
* // Create viem clients
|
|
16
|
+
* const publicClient = createPublicClient({
|
|
17
|
+
* chain: mainnet,
|
|
18
|
+
* transport: http()
|
|
19
|
+
* });
|
|
20
|
+
*
|
|
21
|
+
* const walletClient = createWalletClient({
|
|
22
|
+
* chain: mainnet,
|
|
23
|
+
* transport: http()
|
|
24
|
+
* });
|
|
25
|
+
*
|
|
26
|
+
* // Initialize the Steer client
|
|
27
|
+
* const steerClient = new SteerClient({
|
|
28
|
+
* environment: 'production',
|
|
29
|
+
* client: publicClient,
|
|
30
|
+
* walletClient: walletClient
|
|
31
|
+
* });
|
|
32
|
+
*
|
|
33
|
+
* // Use vault operations
|
|
34
|
+
* const vaults = await steerClient.vaults.getLatestVaults();
|
|
35
|
+
*
|
|
36
|
+
* // Use rewards functionality
|
|
37
|
+
* const campaigns = await steerClient.rewards.getCampaigns(1);
|
|
38
|
+
* const summary = await steerClient.rewards.getRewardSummary(userAddress, chainId);
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @group Client
|
|
42
|
+
*/
|
|
4
43
|
export declare class SteerClient extends SubgraphClient {
|
|
44
|
+
/** The environment the client is configured for */
|
|
5
45
|
private readonly environment;
|
|
46
|
+
/** The vault client instance for interacting with Steer vaults */
|
|
6
47
|
readonly vaults: VaultClient;
|
|
48
|
+
/** The rewards client instance for interacting with Smart Rewards */
|
|
49
|
+
readonly rewards: SmartRewardsClient;
|
|
50
|
+
/**
|
|
51
|
+
* Creates a new instance of the SteerClient
|
|
52
|
+
* @param config - The configuration object for the client
|
|
53
|
+
*/
|
|
7
54
|
constructor(config: SteerConfig);
|
|
8
55
|
/**
|
|
9
56
|
* Gets the active chain ID from the client
|
|
57
|
+
* @returns A promise that resolves to the active chain ID
|
|
58
|
+
* @throws Error if no active chain is found
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```typescript
|
|
62
|
+
* const chainId = await steerClient.getActiveChain();
|
|
63
|
+
* console.log(chainId.data); // e.g., 1 for Ethereum mainnet
|
|
64
|
+
* ```
|
|
10
65
|
*/
|
|
11
66
|
getActiveChain<T>(): Promise<SteerResponse<T>>;
|
|
12
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrD,OAAO,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AACvD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAG9D;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAqCG;AACH,qBAAa,WAAY,SAAQ,cAAc;IAC7C,mDAAmD;IACnD,OAAO,CAAC,QAAQ,CAAC,WAAW,CAA+B;IAE3D,kEAAkE;IAClE,SAAgB,MAAM,EAAE,WAAW,CAAC;IAEpC,qEAAqE;IACrE,SAAgB,OAAO,EAAE,kBAAkB,CAAC;IAE5C;;;OAGG;gBACS,MAAM,EAAE,WAAW;IA+B/B;;;;;;;;;;OAUG;IACU,cAAc,CAAC,CAAC,KAAK,OAAO,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;CAa5D"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare const UniswapV3PoolABI: ({
|
|
2
|
+
inputs: never[];
|
|
3
|
+
stateMutability: string;
|
|
4
|
+
type: string;
|
|
5
|
+
anonymous?: undefined;
|
|
6
|
+
name?: undefined;
|
|
7
|
+
outputs?: undefined;
|
|
8
|
+
} | {
|
|
9
|
+
anonymous: boolean;
|
|
10
|
+
inputs: {
|
|
11
|
+
indexed: boolean;
|
|
12
|
+
internalType: string;
|
|
13
|
+
name: string;
|
|
14
|
+
type: string;
|
|
15
|
+
}[];
|
|
16
|
+
name: string;
|
|
17
|
+
type: string;
|
|
18
|
+
stateMutability?: undefined;
|
|
19
|
+
outputs?: undefined;
|
|
20
|
+
} | {
|
|
21
|
+
inputs: {
|
|
22
|
+
internalType: string;
|
|
23
|
+
name: string;
|
|
24
|
+
type: string;
|
|
25
|
+
}[];
|
|
26
|
+
name: string;
|
|
27
|
+
outputs: {
|
|
28
|
+
internalType: string;
|
|
29
|
+
name: string;
|
|
30
|
+
type: string;
|
|
31
|
+
}[];
|
|
32
|
+
stateMutability: string;
|
|
33
|
+
type: string;
|
|
34
|
+
anonymous?: undefined;
|
|
35
|
+
})[];
|
|
36
|
+
//# sourceMappingURL=UniswapPool.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UniswapPool.d.ts","sourceRoot":"","sources":["../../../../src/const/abis/UniswapPool.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,gBAAgB;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAA2qX,CAAA"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* API URLs for different environments and versions
|
|
3
|
+
*/
|
|
4
|
+
export declare const API_URLS: {
|
|
5
|
+
readonly v1: {
|
|
6
|
+
readonly production: "https://s55qpiwei1.execute-api.us-east-1.amazonaws.com";
|
|
7
|
+
readonly development: "https://s55qpiwei1.execute-api.us-east-1.amazonaws.com";
|
|
8
|
+
};
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* Get the API URL for a specific environment and version
|
|
12
|
+
* @param environment - The environment to get the URL for
|
|
13
|
+
* @param version - The API version to use (defaults to v1)
|
|
14
|
+
* @returns The API URL for the specified environment and version
|
|
15
|
+
*/
|
|
16
|
+
export declare function getApiUrl(environment: 'production' | 'development', version?: keyof typeof API_URLS): string;
|
|
17
|
+
//# sourceMappingURL=api.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.d.ts","sourceRoot":"","sources":["../../../src/const/api.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,eAAO,MAAM,QAAQ;;;;;CAUX,CAAC;AAEX;;;;;GAKG;AACH,wBAAgB,SAAS,CACvB,WAAW,EAAE,YAAY,GAAG,aAAa,EACzC,OAAO,GAAE,MAAM,OAAO,QAAe,GACpC,MAAM,CAER"}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1,4 +1,71 @@
|
|
|
1
|
+
export * from './base/SmartRewards';
|
|
1
2
|
export * from './client';
|
|
2
3
|
export * from './types';
|
|
3
4
|
export * from './const';
|
|
5
|
+
export * from './const/subgraph';
|
|
6
|
+
export * from './const/api';
|
|
7
|
+
/**
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*
|
|
10
|
+
* The Steer Protocol SDK provides a comprehensive interface for interacting with Steer Protocol's smart contracts and services.
|
|
11
|
+
*
|
|
12
|
+
* ## Key Features
|
|
13
|
+
*
|
|
14
|
+
* - Smart Rewards Management
|
|
15
|
+
* - Campaign Interactions
|
|
16
|
+
* - Claim Management
|
|
17
|
+
* - Multi-chain Support
|
|
18
|
+
*
|
|
19
|
+
* ## Quick Start
|
|
20
|
+
*
|
|
21
|
+
* ```typescript
|
|
22
|
+
* import { createPublicClient, createWalletClient, http } from 'viem';
|
|
23
|
+
* import { mainnet } from 'viem/chains';
|
|
24
|
+
* import { SteerClient } from '@steerprotocol/sdk';
|
|
25
|
+
*
|
|
26
|
+
* // Create viem clients
|
|
27
|
+
* const publicClient = createPublicClient({
|
|
28
|
+
* chain: mainnet,
|
|
29
|
+
* transport: http()
|
|
30
|
+
* });
|
|
31
|
+
*
|
|
32
|
+
* const walletClient = createWalletClient({
|
|
33
|
+
* chain: mainnet,
|
|
34
|
+
* transport: http()
|
|
35
|
+
* });
|
|
36
|
+
*
|
|
37
|
+
* // Initialize the Steer client with both public and wallet clients
|
|
38
|
+
* const steerClient = new SteerClient({
|
|
39
|
+
* environment: 'production',
|
|
40
|
+
* client: publicClient,
|
|
41
|
+
* walletClient: walletClient // Optional: Provide for write operations
|
|
42
|
+
* });
|
|
43
|
+
*
|
|
44
|
+
* // Use vault operations (read-only if no wallet client)
|
|
45
|
+
* const vaults = await steerClient.vaults.getLatestVaults();
|
|
46
|
+
*
|
|
47
|
+
* // Use rewards functionality (read-only if no wallet client)
|
|
48
|
+
* const campaigns = await steerClient.rewards.getCampaigns(1);
|
|
49
|
+
* const summary = await steerClient.rewards.getRewardSummary(userAddress, chainId);
|
|
50
|
+
*
|
|
51
|
+
* // Write operations (requires wallet client)
|
|
52
|
+
* if (steerClient.rewards) {
|
|
53
|
+
* const tx = await steerClient.rewards.claimCampaignRewards(userAddress, chainId);
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*
|
|
57
|
+
* ## Smart Rewards
|
|
58
|
+
*
|
|
59
|
+
* The Smart Rewards functionality is accessible through the SteerClient's rewards property.
|
|
60
|
+
* It provides comprehensive functionality for managing rewards:
|
|
61
|
+
*
|
|
62
|
+
* - View reward balances and claim history (read-only operations)
|
|
63
|
+
* - Claim rewards across multiple campaigns (requires wallet client)
|
|
64
|
+
* - Track historical claims
|
|
65
|
+
* - Get comprehensive reward summaries
|
|
66
|
+
*
|
|
67
|
+
* For write operations like claiming rewards, make sure to provide a wallet client when initializing the SteerClient.
|
|
68
|
+
*
|
|
69
|
+
* See {@link SmartRewards} for detailed API documentation.
|
|
70
|
+
*/
|
|
4
71
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAC;AACpC,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAE5B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+DG"}
|
package/dist/types/types.d.ts
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Client, TestClient, WalletClient } from 'viem';
|
|
2
2
|
export interface SteerConfig {
|
|
3
3
|
environment?: 'production' | 'development';
|
|
4
|
-
client: Client | TestClient
|
|
4
|
+
client: Client | TestClient;
|
|
5
|
+
walletClient?: WalletClient;
|
|
5
6
|
}
|
|
6
7
|
export interface SteerResponse<T> {
|
|
7
8
|
data: T | null;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAE7D,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;IAC3C,MAAM,EAAE,MAAM,GAAG,UAAU,
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,MAAM,CAAC;AAE7D,MAAM,WAAW,WAAW;IAC1B,WAAW,CAAC,EAAE,YAAY,GAAG,aAAa,CAAC;IAC3C,MAAM,EAAE,MAAM,GAAG,UAAU,CAAC;IAC5B,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED,MAAM,WAAW,aAAa,CAAC,CAAC;IAC9B,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@steerprotocol/sdk",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "Steer Protocol SDK",
|
|
5
5
|
"main": "dist/cjs/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -25,7 +25,13 @@
|
|
|
25
25
|
"lint": "eslint . --ext .ts",
|
|
26
26
|
"format": "prettier --write \"src/**/*.ts\"",
|
|
27
27
|
"prepare": "npm run build",
|
|
28
|
-
"prepack": "tsx src/scripts/processDeployments.ts"
|
|
28
|
+
"prepack": "tsx src/scripts/processDeployments.ts",
|
|
29
|
+
"docs": "typedoc --out docs --entryPoints src/index.ts src/client.ts src/base/SmartRewards.ts src/base/SubgraphClient.ts src/base/VaultClient.ts --name \"Steer Protocol SDK\" --readme README.md --excludePrivate --excludeProtected",
|
|
30
|
+
"docs:watch": "typedoc --out docs --entryPoints src/index.ts src/base/SmartRewards.ts src/generated/sdk.ts --name \"Steer Protocol SDK\" --readme README.md --excludePrivate --excludeProtected --plugin none --watch",
|
|
31
|
+
"docs:serve": "npx serve docs",
|
|
32
|
+
"commit": "git-cz",
|
|
33
|
+
"typecheck": "tsc --noEmit",
|
|
34
|
+
"check-all": "yarn typecheck && yarn lint"
|
|
29
35
|
},
|
|
30
36
|
"keywords": [
|
|
31
37
|
"steer",
|
|
@@ -50,13 +56,27 @@
|
|
|
50
56
|
"rimraf": "^5.0.5",
|
|
51
57
|
"ts-jest": "^29.2.5",
|
|
52
58
|
"tsx": "^4.19.2",
|
|
59
|
+
"typedoc": "^0.27.6",
|
|
53
60
|
"typescript": "^5.3.3",
|
|
54
|
-
"viem": "^2.22.0"
|
|
61
|
+
"viem": "^2.22.0",
|
|
62
|
+
"@semantic-release/changelog": "^6.0.3",
|
|
63
|
+
"@semantic-release/git": "^10.0.1",
|
|
64
|
+
"@semantic-release/github": "^9.2.3",
|
|
65
|
+
"@semantic-release/npm": "^11.0.1",
|
|
66
|
+
"semantic-release": "^22.0.8",
|
|
67
|
+
"@commitlint/cli": "^18.4.3",
|
|
68
|
+
"@commitlint/config-conventional": "^18.4.3",
|
|
69
|
+
"commitizen": "^4.3.0",
|
|
70
|
+
"cz-conventional-changelog": "^3.3.0",
|
|
71
|
+
"husky": "^8.0.3"
|
|
55
72
|
},
|
|
56
73
|
"engines": {
|
|
57
74
|
"node": ">=18.0.0"
|
|
58
75
|
},
|
|
59
76
|
"publishConfig": {
|
|
60
77
|
"access": "public"
|
|
78
|
+
},
|
|
79
|
+
"dependencies": {
|
|
80
|
+
"@steerprotocol/api-sdk": "^1.0.2"
|
|
61
81
|
}
|
|
62
82
|
}
|