@@ -21,6 +21,7 @@ import { Address } from '@setprotocol/set-protocol-v2/utils/types';
21
21
22
22
import ContractWrapper from './ContractWrapper' ;
23
23
import { SetDetails , StreamingFeeInfo } from '../../types' ;
24
+ import { BigNumber } from 'ethers/lib/ethers' ;
24
25
25
26
/**
26
27
* @title ProtocolViewerWrapper
@@ -46,7 +47,7 @@ export default class ProtocolViewerWrapper {
46
47
/**
47
48
* Fetches the managers of set tokens
48
49
*
49
- * @param tokenAddresses Addresses of ERC20 contracts to check balance for
50
+ * @param tokenAddresses Addresses of ERC20 contracts to check managers for
50
51
* @param callerAddress Address to use as the caller (optional)
51
52
*/
52
53
public async batchFetchManagers (
@@ -64,7 +65,7 @@ export default class ProtocolViewerWrapper {
64
65
/**
65
66
* Fetches the streaming fee info of set tokens
66
67
*
67
- * @param tokenAddresses Addresses of ERC20 contracts to check balance for
68
+ * @param tokenAddresses Addresses of ERC20 contracts to check streaming fee for
68
69
* @param callerAddress Address to use as the caller (optional)
69
70
*/
70
71
public async batchFetchStreamingFeeInfo (
@@ -82,6 +83,55 @@ export default class ProtocolViewerWrapper {
82
83
) ;
83
84
}
84
85
86
+ /**
87
+ * Fetches the balance of list of set tokens and user addresses
88
+ *
89
+ * @param tokenAddresses Addresses of ERC20 contracts to check balance for
90
+ * @param userAddresses Addresses of users to check balances for matched up with token index
91
+ * @param callerAddress Address to use as the caller (optional)
92
+ */
93
+ public async batchFetchBalancesOf (
94
+ tokenAddresses : Address [ ] ,
95
+ userAddresses : Address [ ] ,
96
+ callerAddress ?: Address ,
97
+ ) : Promise < BigNumber [ ] > {
98
+ const protocolViewerInstance = await this . contracts . loadProtocolViewerContractAsync (
99
+ this . protocolViewerAddress ,
100
+ ( this . provider as JsonRpcProvider ) . getSigner ( callerAddress )
101
+ ) ;
102
+
103
+ return await protocolViewerInstance . batchFetchBalancesOf (
104
+ tokenAddresses ,
105
+ userAddresses
106
+ ) ;
107
+ }
108
+
109
+ /**
110
+ * Fetches the allowances of list of set tokens and owner/spender addresses
111
+ *
112
+ * @param tokenAddresses Addresses of ERC20 contracts to check alloances for
113
+ * @param ownerAddresses Addresses of owners of token matched up with token index
114
+ * @param spenderAddresses Addresses of spenders of token matched up with token index
115
+ * @param callerAddress Address to use as the caller (optional)
116
+ */
117
+ public async batchFetchAllowances (
118
+ tokenAddresses : Address [ ] ,
119
+ ownerAddresses : Address [ ] ,
120
+ spenderAddresses : Address [ ] ,
121
+ callerAddress ?: Address ,
122
+ ) : Promise < BigNumber [ ] > {
123
+ const protocolViewerInstance = await this . contracts . loadProtocolViewerContractAsync (
124
+ this . protocolViewerAddress ,
125
+ ( this . provider as JsonRpcProvider ) . getSigner ( callerAddress )
126
+ ) ;
127
+
128
+ return await protocolViewerInstance . batchFetchAllowances (
129
+ tokenAddresses ,
130
+ ownerAddresses ,
131
+ spenderAddresses
132
+ ) ;
133
+ }
134
+
85
135
/**
86
136
* Fetches the details of the SetToken. Accepts an array of module addresses and returns
87
137
* the initialization statuses of each of the modules for the SetToken
0 commit comments