@steerprotocol/sdk 1.26.0 → 1.27.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/FeeManagerClient.js +72 -0
- package/dist/cjs/const/abis/index.js +1 -0
- package/dist/cjs/const/abis/vaultFees.js +43 -0
- package/dist/esm/base/FeeManagerClient.js +72 -0
- package/dist/esm/const/abis/index.js +1 -0
- package/dist/esm/const/abis/vaultFees.js +40 -0
- package/dist/types/base/FeeManagerClient.d.ts +20 -0
- package/dist/types/base/FeeManagerClient.d.ts.map +1 -1
- package/dist/types/const/abis/index.d.ts +1 -0
- package/dist/types/const/abis/index.d.ts.map +1 -1
- package/dist/types/const/abis/vaultFees.d.ts +30 -0
- package/dist/types/const/abis/vaultFees.d.ts.map +1 -0
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.FeeManagerClient = void 0;
|
|
4
4
|
const viem_1 = require("viem");
|
|
5
5
|
const feeManager_js_1 = require("../const/abis/feeManager.js");
|
|
6
|
+
const vaultFees_js_1 = require("../const/abis/vaultFees.js");
|
|
6
7
|
const SubgraphClient_js_1 = require("./SubgraphClient.js");
|
|
7
8
|
class FeeManagerClient extends SubgraphClient_js_1.SubgraphClient {
|
|
8
9
|
constructor(feeManagerAddress, publicClient, walletClient) {
|
|
@@ -522,5 +523,76 @@ class FeeManagerClient extends SubgraphClient_js_1.SubgraphClient {
|
|
|
522
523
|
};
|
|
523
524
|
}
|
|
524
525
|
}
|
|
526
|
+
/**
|
|
527
|
+
* Gets the accrued revenue for a specific fee identifier in a vault
|
|
528
|
+
* @param vault The vault address
|
|
529
|
+
* @param feeIdentifier The fee identifier (e.g., 'STEER_FEES', 'STRATEGIST_FEES')
|
|
530
|
+
* @returns Promise resolving to the accrued amounts for token0 and token1
|
|
531
|
+
*/
|
|
532
|
+
async getAccruedRevenue(vault, feeIdentifier) {
|
|
533
|
+
try {
|
|
534
|
+
const [amount0, amount1] = await Promise.all([
|
|
535
|
+
this.publicClient.readContract({
|
|
536
|
+
address: vault,
|
|
537
|
+
abi: vaultFees_js_1.VAULT_FEES_ABI,
|
|
538
|
+
functionName: 'accruedFees0',
|
|
539
|
+
args: [feeIdentifier],
|
|
540
|
+
}),
|
|
541
|
+
this.publicClient.readContract({
|
|
542
|
+
address: vault,
|
|
543
|
+
abi: vaultFees_js_1.VAULT_FEES_ABI,
|
|
544
|
+
functionName: 'accruedFees1',
|
|
545
|
+
args: [feeIdentifier],
|
|
546
|
+
}),
|
|
547
|
+
]);
|
|
548
|
+
return {
|
|
549
|
+
data: { amount0, amount1 },
|
|
550
|
+
status: 200,
|
|
551
|
+
success: true,
|
|
552
|
+
};
|
|
553
|
+
}
|
|
554
|
+
catch (error) {
|
|
555
|
+
return {
|
|
556
|
+
data: null,
|
|
557
|
+
status: 500,
|
|
558
|
+
success: false,
|
|
559
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
/**
|
|
564
|
+
* Gets a summary of accrued revenue for all configured fee identifiers in a vault
|
|
565
|
+
* @param vault The vault address
|
|
566
|
+
* @returns Promise resolving to a list of fee identifiers and their accrued amounts
|
|
567
|
+
*/
|
|
568
|
+
async getVaultRevenueSummary(vault) {
|
|
569
|
+
try {
|
|
570
|
+
const feesResponse = await this.getFees(vault);
|
|
571
|
+
if (!feesResponse.success || !feesResponse.data) {
|
|
572
|
+
throw new Error(feesResponse.error || 'Failed to fetch vault fees configuration');
|
|
573
|
+
}
|
|
574
|
+
const summary = await Promise.all(feesResponse.data.map(async (fee) => {
|
|
575
|
+
const revenue = await this.getAccruedRevenue(vault, fee.feeIdentifier);
|
|
576
|
+
return {
|
|
577
|
+
feeIdentifier: fee.feeIdentifier,
|
|
578
|
+
amount0: revenue.data?.amount0 ?? 0n,
|
|
579
|
+
amount1: revenue.data?.amount1 ?? 0n,
|
|
580
|
+
};
|
|
581
|
+
}));
|
|
582
|
+
return {
|
|
583
|
+
data: summary,
|
|
584
|
+
status: 200,
|
|
585
|
+
success: true,
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
catch (error) {
|
|
589
|
+
return {
|
|
590
|
+
data: null,
|
|
591
|
+
status: 500,
|
|
592
|
+
success: false,
|
|
593
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
594
|
+
};
|
|
595
|
+
}
|
|
596
|
+
}
|
|
525
597
|
}
|
|
526
598
|
exports.FeeManagerClient = FeeManagerClient;
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.VAULT_FEES_ABI = void 0;
|
|
4
|
+
exports.VAULT_FEES_ABI = [
|
|
5
|
+
{
|
|
6
|
+
inputs: [
|
|
7
|
+
{
|
|
8
|
+
internalType: 'string',
|
|
9
|
+
name: 'feeIdentifier',
|
|
10
|
+
type: 'string',
|
|
11
|
+
},
|
|
12
|
+
],
|
|
13
|
+
name: 'accruedFees0',
|
|
14
|
+
outputs: [
|
|
15
|
+
{
|
|
16
|
+
internalType: 'uint256',
|
|
17
|
+
name: '',
|
|
18
|
+
type: 'uint256',
|
|
19
|
+
},
|
|
20
|
+
],
|
|
21
|
+
stateMutability: 'view',
|
|
22
|
+
type: 'function',
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
inputs: [
|
|
26
|
+
{
|
|
27
|
+
internalType: 'string',
|
|
28
|
+
name: 'feeIdentifier',
|
|
29
|
+
type: 'string',
|
|
30
|
+
},
|
|
31
|
+
],
|
|
32
|
+
name: 'accruedFees1',
|
|
33
|
+
outputs: [
|
|
34
|
+
{
|
|
35
|
+
internalType: 'uint256',
|
|
36
|
+
name: '',
|
|
37
|
+
type: 'uint256',
|
|
38
|
+
},
|
|
39
|
+
],
|
|
40
|
+
stateMutability: 'view',
|
|
41
|
+
type: 'function',
|
|
42
|
+
},
|
|
43
|
+
];
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { isAddressEqual, } from 'viem';
|
|
2
2
|
import { FEE_MANAGER_ABI } from '../const/abis/feeManager.js';
|
|
3
|
+
import { VAULT_FEES_ABI } from '../const/abis/vaultFees.js';
|
|
3
4
|
import { SubgraphClient } from './SubgraphClient.js';
|
|
4
5
|
export class FeeManagerClient extends SubgraphClient {
|
|
5
6
|
constructor(feeManagerAddress, publicClient, walletClient) {
|
|
@@ -519,4 +520,75 @@ export class FeeManagerClient extends SubgraphClient {
|
|
|
519
520
|
};
|
|
520
521
|
}
|
|
521
522
|
}
|
|
523
|
+
/**
|
|
524
|
+
* Gets the accrued revenue for a specific fee identifier in a vault
|
|
525
|
+
* @param vault The vault address
|
|
526
|
+
* @param feeIdentifier The fee identifier (e.g., 'STEER_FEES', 'STRATEGIST_FEES')
|
|
527
|
+
* @returns Promise resolving to the accrued amounts for token0 and token1
|
|
528
|
+
*/
|
|
529
|
+
async getAccruedRevenue(vault, feeIdentifier) {
|
|
530
|
+
try {
|
|
531
|
+
const [amount0, amount1] = await Promise.all([
|
|
532
|
+
this.publicClient.readContract({
|
|
533
|
+
address: vault,
|
|
534
|
+
abi: VAULT_FEES_ABI,
|
|
535
|
+
functionName: 'accruedFees0',
|
|
536
|
+
args: [feeIdentifier],
|
|
537
|
+
}),
|
|
538
|
+
this.publicClient.readContract({
|
|
539
|
+
address: vault,
|
|
540
|
+
abi: VAULT_FEES_ABI,
|
|
541
|
+
functionName: 'accruedFees1',
|
|
542
|
+
args: [feeIdentifier],
|
|
543
|
+
}),
|
|
544
|
+
]);
|
|
545
|
+
return {
|
|
546
|
+
data: { amount0, amount1 },
|
|
547
|
+
status: 200,
|
|
548
|
+
success: true,
|
|
549
|
+
};
|
|
550
|
+
}
|
|
551
|
+
catch (error) {
|
|
552
|
+
return {
|
|
553
|
+
data: null,
|
|
554
|
+
status: 500,
|
|
555
|
+
success: false,
|
|
556
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
557
|
+
};
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
/**
|
|
561
|
+
* Gets a summary of accrued revenue for all configured fee identifiers in a vault
|
|
562
|
+
* @param vault The vault address
|
|
563
|
+
* @returns Promise resolving to a list of fee identifiers and their accrued amounts
|
|
564
|
+
*/
|
|
565
|
+
async getVaultRevenueSummary(vault) {
|
|
566
|
+
try {
|
|
567
|
+
const feesResponse = await this.getFees(vault);
|
|
568
|
+
if (!feesResponse.success || !feesResponse.data) {
|
|
569
|
+
throw new Error(feesResponse.error || 'Failed to fetch vault fees configuration');
|
|
570
|
+
}
|
|
571
|
+
const summary = await Promise.all(feesResponse.data.map(async (fee) => {
|
|
572
|
+
const revenue = await this.getAccruedRevenue(vault, fee.feeIdentifier);
|
|
573
|
+
return {
|
|
574
|
+
feeIdentifier: fee.feeIdentifier,
|
|
575
|
+
amount0: revenue.data?.amount0 ?? 0n,
|
|
576
|
+
amount1: revenue.data?.amount1 ?? 0n,
|
|
577
|
+
};
|
|
578
|
+
}));
|
|
579
|
+
return {
|
|
580
|
+
data: summary,
|
|
581
|
+
status: 200,
|
|
582
|
+
success: true,
|
|
583
|
+
};
|
|
584
|
+
}
|
|
585
|
+
catch (error) {
|
|
586
|
+
return {
|
|
587
|
+
data: null,
|
|
588
|
+
status: 500,
|
|
589
|
+
success: false,
|
|
590
|
+
error: error instanceof Error ? error.message : 'Unknown error occurred',
|
|
591
|
+
};
|
|
592
|
+
}
|
|
593
|
+
}
|
|
522
594
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export const VAULT_FEES_ABI = [
|
|
2
|
+
{
|
|
3
|
+
inputs: [
|
|
4
|
+
{
|
|
5
|
+
internalType: 'string',
|
|
6
|
+
name: 'feeIdentifier',
|
|
7
|
+
type: 'string',
|
|
8
|
+
},
|
|
9
|
+
],
|
|
10
|
+
name: 'accruedFees0',
|
|
11
|
+
outputs: [
|
|
12
|
+
{
|
|
13
|
+
internalType: 'uint256',
|
|
14
|
+
name: '',
|
|
15
|
+
type: 'uint256',
|
|
16
|
+
},
|
|
17
|
+
],
|
|
18
|
+
stateMutability: 'view',
|
|
19
|
+
type: 'function',
|
|
20
|
+
},
|
|
21
|
+
{
|
|
22
|
+
inputs: [
|
|
23
|
+
{
|
|
24
|
+
internalType: 'string',
|
|
25
|
+
name: 'feeIdentifier',
|
|
26
|
+
type: 'string',
|
|
27
|
+
},
|
|
28
|
+
],
|
|
29
|
+
name: 'accruedFees1',
|
|
30
|
+
outputs: [
|
|
31
|
+
{
|
|
32
|
+
internalType: 'uint256',
|
|
33
|
+
name: '',
|
|
34
|
+
type: 'uint256',
|
|
35
|
+
},
|
|
36
|
+
],
|
|
37
|
+
stateMutability: 'view',
|
|
38
|
+
type: 'function',
|
|
39
|
+
},
|
|
40
|
+
];
|
|
@@ -19,5 +19,25 @@ export declare class FeeManagerClient extends SubgraphClient {
|
|
|
19
19
|
withdrawFee(params: FeeWithdrawalParams): Promise<SteerResponse<Hash>>;
|
|
20
20
|
withdrawMultipleFees(params: MultipleFeeWithdrawalParams): Promise<SteerResponse<Hash>>;
|
|
21
21
|
withdrawFeesFromMultipleVaults(params: MultiVaultFeeWithdrawalParams): Promise<SteerResponse<Hash>>;
|
|
22
|
+
/**
|
|
23
|
+
* Gets the accrued revenue for a specific fee identifier in a vault
|
|
24
|
+
* @param vault The vault address
|
|
25
|
+
* @param feeIdentifier The fee identifier (e.g., 'STEER_FEES', 'STRATEGIST_FEES')
|
|
26
|
+
* @returns Promise resolving to the accrued amounts for token0 and token1
|
|
27
|
+
*/
|
|
28
|
+
getAccruedRevenue(vault: Address, feeIdentifier: string): Promise<SteerResponse<{
|
|
29
|
+
amount0: bigint;
|
|
30
|
+
amount1: bigint;
|
|
31
|
+
}>>;
|
|
32
|
+
/**
|
|
33
|
+
* Gets a summary of accrued revenue for all configured fee identifiers in a vault
|
|
34
|
+
* @param vault The vault address
|
|
35
|
+
* @returns Promise resolving to a list of fee identifiers and their accrued amounts
|
|
36
|
+
*/
|
|
37
|
+
getVaultRevenueSummary(vault: Address): Promise<SteerResponse<{
|
|
38
|
+
feeIdentifier: string;
|
|
39
|
+
amount0: bigint;
|
|
40
|
+
amount1: bigint;
|
|
41
|
+
}[]>>;
|
|
22
42
|
}
|
|
23
43
|
//# sourceMappingURL=FeeManagerClient.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FeeManagerClient.d.ts","sourceRoot":"","sources":["../../../src/base/FeeManagerClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,YAAY,EAElB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,6BAA6B,EAC7B,GAAG,EACH,sBAAsB,EACtB,mBAAmB,EACnB,2BAA2B,EAC3B,6BAA6B,EAC7B,aAAa,EACd,MAAM,aAAa,CAAC;
|
|
1
|
+
{"version":3,"file":"FeeManagerClient.d.ts","sourceRoot":"","sources":["../../../src/base/FeeManagerClient.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,OAAO,EACZ,KAAK,IAAI,EACT,KAAK,YAAY,EACjB,KAAK,YAAY,EAElB,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EACV,6BAA6B,EAC7B,GAAG,EACH,sBAAsB,EACtB,mBAAmB,EACnB,2BAA2B,EAC3B,6BAA6B,EAC7B,aAAa,EACd,MAAM,aAAa,CAAC;AAGrB,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAC;AAErD,qBAAa,gBAAiB,SAAQ,cAAc;IAClD,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAC9C,SAAS,CAAC,QAAQ,CAAC,YAAY,EAAE,YAAY,CAAC;IAC9C,SAAS,CAAC,QAAQ,CAAC,iBAAiB,EAAE,OAAO,CAAC;gBAElC,iBAAiB,EAAE,OAAO,EAAE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ACpC,OAAO,CAAC,aAAa,CAAC,IAAI,CAAC,CAAC;IA4E/B;;;;;OAKG;IACU,iBAAiB,CAC5B,KAAK,EAAE,OAAO,EACd,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,aAAa,CAAC;QAAE,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;IAgC/D;;;;OAIG;IACU,sBAAsB,CACjC,KAAK,EAAE,OAAO,GACb,OAAO,CAAC,aAAa,CAAC;QAAE,aAAa,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,EAAE,CAAC,CAAC;CAgCzF"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/const/abis/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/const/abis/index.ts"],"names":[],"mappings":"AAAA,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,cAAc,CAAC;AAC7B,cAAc,yBAAyB,CAAC;AACxC,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,iBAAiB,CAAC;AAChC,cAAc,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export declare const VAULT_FEES_ABI: readonly [{
|
|
2
|
+
readonly inputs: readonly [{
|
|
3
|
+
readonly internalType: "string";
|
|
4
|
+
readonly name: "feeIdentifier";
|
|
5
|
+
readonly type: "string";
|
|
6
|
+
}];
|
|
7
|
+
readonly name: "accruedFees0";
|
|
8
|
+
readonly outputs: readonly [{
|
|
9
|
+
readonly internalType: "uint256";
|
|
10
|
+
readonly name: "";
|
|
11
|
+
readonly type: "uint256";
|
|
12
|
+
}];
|
|
13
|
+
readonly stateMutability: "view";
|
|
14
|
+
readonly type: "function";
|
|
15
|
+
}, {
|
|
16
|
+
readonly inputs: readonly [{
|
|
17
|
+
readonly internalType: "string";
|
|
18
|
+
readonly name: "feeIdentifier";
|
|
19
|
+
readonly type: "string";
|
|
20
|
+
}];
|
|
21
|
+
readonly name: "accruedFees1";
|
|
22
|
+
readonly outputs: readonly [{
|
|
23
|
+
readonly internalType: "uint256";
|
|
24
|
+
readonly name: "";
|
|
25
|
+
readonly type: "uint256";
|
|
26
|
+
}];
|
|
27
|
+
readonly stateMutability: "view";
|
|
28
|
+
readonly type: "function";
|
|
29
|
+
}];
|
|
30
|
+
//# sourceMappingURL=vaultFees.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vaultFees.d.ts","sourceRoot":"","sources":["../../../../src/const/abis/vaultFees.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,cAAc;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAuCjB,CAAC"}
|