@pufferfinance/puffer-sdk 1.10.2 → 1.11.1
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/api/puffer-client.cjs +1 -1
- package/dist/api/puffer-client.cjs.map +1 -1
- package/dist/api/puffer-client.d.ts +3 -0
- package/dist/api/puffer-client.js +50 -43
- package/dist/api/puffer-client.js.map +1 -1
- package/dist/contracts/abis/mainnet/mtwCARROT.cjs +2 -0
- package/dist/contracts/abis/mainnet/mtwCARROT.cjs.map +1 -0
- package/dist/contracts/abis/mainnet/mtwCARROT.d.ts +608 -0
- package/dist/contracts/abis/mainnet/mtwCARROT.js +477 -0
- package/dist/contracts/abis/mainnet/mtwCARROT.js.map +1 -0
- package/dist/contracts/addresses.cjs +1 -1
- package/dist/contracts/addresses.cjs.map +1 -1
- package/dist/contracts/addresses.d.ts +0 -23
- package/dist/contracts/addresses.js +2 -26
- package/dist/contracts/addresses.js.map +1 -1
- package/dist/contracts/handlers/mtw-carrot-handler.cjs +2 -0
- package/dist/contracts/handlers/mtw-carrot-handler.cjs.map +1 -0
- package/dist/contracts/handlers/mtw-carrot-handler.d.ts +15293 -0
- package/dist/contracts/handlers/mtw-carrot-handler.js +229 -0
- package/dist/contracts/handlers/mtw-carrot-handler.js.map +1 -0
- package/dist/contracts/handlers/nucleus-accountant-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-accountant-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-accountant-handler.js +3 -3
- package/dist/contracts/handlers/nucleus-accountant-handler.js.map +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-boring-vault-handler.js +3 -3
- package/dist/contracts/handlers/nucleus-boring-vault-handler.js.map +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.cjs +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.cjs.map +1 -1
- package/dist/contracts/handlers/nucleus-teller-handler.js +9 -9
- package/dist/contracts/handlers/nucleus-teller-handler.js.map +1 -1
- package/dist/contracts/tokens.cjs +1 -1
- package/dist/contracts/tokens.cjs.map +1 -1
- package/dist/contracts/tokens.d.ts +6 -3
- package/dist/contracts/tokens.js +27 -8
- package/dist/contracts/tokens.js.map +1 -1
- package/dist/contracts/vaults-addresses.cjs +2 -0
- package/dist/contracts/vaults-addresses.cjs.map +1 -0
- package/dist/contracts/vaults-addresses.d.ts +30 -0
- package/dist/contracts/vaults-addresses.js +36 -0
- package/dist/contracts/vaults-addresses.js.map +1 -0
- package/dist/main.cjs +1 -1
- package/dist/main.js +22 -23
- package/dist/utils/version.cjs +1 -1
- package/dist/utils/version.js +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
var c = Object.defineProperty;
|
|
2
|
+
var s = (i, t, e) => t in i ? c(i, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : i[t] = e;
|
|
3
|
+
var a = (i, t, e) => s(i, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
+
import { V as o } from "../../constants-BjRNQpT2.js";
|
|
5
|
+
import { TOKENS_ADDRESSES as h, Token as l } from "../tokens.js";
|
|
6
|
+
import { mtwCARROT as C } from "../abis/mainnet/mtwCARROT.js";
|
|
7
|
+
import { g } from "../../getContract-CezEyDf-.js";
|
|
8
|
+
class p {
|
|
9
|
+
/**
|
|
10
|
+
* Create the handler for the `mtwCARROT` token contract exposing
|
|
11
|
+
* methods to interact with the contract.
|
|
12
|
+
*
|
|
13
|
+
* @param chain Chain to use for the client.
|
|
14
|
+
* @param walletClient The wallet client to use for wallet
|
|
15
|
+
* interactions.
|
|
16
|
+
* @param publicClient The public client to use for public
|
|
17
|
+
* interactions.
|
|
18
|
+
*/
|
|
19
|
+
constructor(t, e, r) {
|
|
20
|
+
a(this, "viemChain");
|
|
21
|
+
this.chain = t, this.walletClient = e, this.publicClient = r, this.viemChain = o[t];
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Get the contract. This is a method because the typings are complex
|
|
25
|
+
* and lost when trying to make it a member.
|
|
26
|
+
*
|
|
27
|
+
* @returns The viem contract.
|
|
28
|
+
*/
|
|
29
|
+
getContract() {
|
|
30
|
+
const t = h[l.mtwCARROT][this.chain], e = C, r = { public: this.publicClient, wallet: this.walletClient };
|
|
31
|
+
return g({ address: t, abi: e, client: r });
|
|
32
|
+
}
|
|
33
|
+
/**
|
|
34
|
+
* Retrieve the balance of a given address.
|
|
35
|
+
*
|
|
36
|
+
* @param address The address to query the balance for.
|
|
37
|
+
* @returns The balance of the specified address.
|
|
38
|
+
*/
|
|
39
|
+
balanceOf(t) {
|
|
40
|
+
return this.getContract().read.balanceOf([t]);
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Retrieve the allowance a spender has from an owner.
|
|
44
|
+
*
|
|
45
|
+
* @param owner The address of the token owner.
|
|
46
|
+
* @param spender The address of the spender.
|
|
47
|
+
* @returns The amount the spender is allowed to use on behalf of the owner.
|
|
48
|
+
*/
|
|
49
|
+
allowance(t, e) {
|
|
50
|
+
return this.getContract().read.allowance([t, e]);
|
|
51
|
+
}
|
|
52
|
+
// TODO: Not able to test overloads using `eth-testing`.
|
|
53
|
+
/* istanbul ignore next */
|
|
54
|
+
/**
|
|
55
|
+
* Retrieve the claimable amount for a user, optionally at a specific index.
|
|
56
|
+
*
|
|
57
|
+
* @param user The user's address.
|
|
58
|
+
* @param maxClaimIn, '0x123'dex The maximum index to check for claimable amount (optional).
|
|
59
|
+
* @returns The claimable amount for the user.
|
|
60
|
+
*/
|
|
61
|
+
claimable(t, e) {
|
|
62
|
+
return e !== void 0 ? this.getContract().read.claimable([t, e]) : this.getContract().read.claimable([t]);
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Retrieve the cliff duration of the vesting schedule.
|
|
66
|
+
*
|
|
67
|
+
* @returns The cliff duration in seconds.
|
|
68
|
+
*/
|
|
69
|
+
cliffDuration() {
|
|
70
|
+
return this.getContract().read.cliffDuration();
|
|
71
|
+
}
|
|
72
|
+
/**
|
|
73
|
+
* Retrieve all vesting schedules associated with a user.
|
|
74
|
+
*
|
|
75
|
+
* @param user The address of the user.
|
|
76
|
+
* @returns An array of vesting schedules.
|
|
77
|
+
*/
|
|
78
|
+
async getUserVestings(t) {
|
|
79
|
+
const [e, r] = await this.getContract().read.getUserVestings([t]);
|
|
80
|
+
return {
|
|
81
|
+
allVestings: e,
|
|
82
|
+
nextClaimIndex: r
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Check if the contract is a token wrapper.
|
|
87
|
+
*
|
|
88
|
+
* @returns True if the contract is a token wrapper, false otherwise.
|
|
89
|
+
*/
|
|
90
|
+
isTokenWrapper() {
|
|
91
|
+
return this.getContract().read.isTokenWrapper();
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Retrieve the symbol of the token.
|
|
95
|
+
*
|
|
96
|
+
* @returns The token symbol.
|
|
97
|
+
*/
|
|
98
|
+
symbol() {
|
|
99
|
+
return this.getContract().read.symbol();
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Retrieve the token address this contract wraps or represents.
|
|
103
|
+
*
|
|
104
|
+
* @returns The address of the token.
|
|
105
|
+
*/
|
|
106
|
+
token() {
|
|
107
|
+
return this.getContract().read.token();
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Retrieve the underlying asset for the token.
|
|
111
|
+
*
|
|
112
|
+
* @returns The address of the underlying asset.
|
|
113
|
+
*/
|
|
114
|
+
underlying() {
|
|
115
|
+
return this.getContract().read.underlying();
|
|
116
|
+
}
|
|
117
|
+
/**
|
|
118
|
+
* Retrieve vesting data for a given address.
|
|
119
|
+
*
|
|
120
|
+
* @param address The address to query vesting data for.
|
|
121
|
+
* @returns Next claim index.
|
|
122
|
+
*/
|
|
123
|
+
vestingData(t) {
|
|
124
|
+
return this.getContract().read.vestingData([t]);
|
|
125
|
+
}
|
|
126
|
+
/**
|
|
127
|
+
* Approve a spender to use a specific amount of the owner's tokens.
|
|
128
|
+
*
|
|
129
|
+
* @param ownerAddress Address of the caller of the transaction.
|
|
130
|
+
* @param spenderAddress Address of the spender.
|
|
131
|
+
* @param amount Value to approve for the spender.
|
|
132
|
+
* @returns A promise that resolves to the transaction hash.
|
|
133
|
+
*/
|
|
134
|
+
approve(t, e, r) {
|
|
135
|
+
return this.getContract().write.approve([e, r], {
|
|
136
|
+
account: t,
|
|
137
|
+
chain: this.viemChain
|
|
138
|
+
});
|
|
139
|
+
}
|
|
140
|
+
// TODO: Not able to test overloads using `eth-testing`.
|
|
141
|
+
/* istanbul ignore next */
|
|
142
|
+
/**
|
|
143
|
+
* Claim tokens for a user.
|
|
144
|
+
*
|
|
145
|
+
* @param account Address of the caller of the transaction.
|
|
146
|
+
* @param user The user's address.
|
|
147
|
+
* @param maxClaimIndex The maximum index to check for claimable amount (optional).
|
|
148
|
+
* @returns A promise that resolves to the transaction hash.
|
|
149
|
+
*/
|
|
150
|
+
claim(t, e, r) {
|
|
151
|
+
return r !== void 0 ? this.getContract().write.claim([e, r], {
|
|
152
|
+
account: t,
|
|
153
|
+
chain: this.viemChain
|
|
154
|
+
}) : this.getContract().write.claim([e], {
|
|
155
|
+
account: t,
|
|
156
|
+
chain: this.viemChain
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Decrease the allowance for a spender.
|
|
161
|
+
*
|
|
162
|
+
* @param ownerAddress Address of the caller of the transaction.
|
|
163
|
+
* @param spenderAddress Address of the spender.
|
|
164
|
+
* @param subtractedValue The amount by which the allowance is to be decreased.
|
|
165
|
+
* @returns A promise that resolves to the transaction hash.
|
|
166
|
+
*/
|
|
167
|
+
decreaseAllowance(t, e, r) {
|
|
168
|
+
return this.getContract().write.decreaseAllowance(
|
|
169
|
+
[e, r],
|
|
170
|
+
{
|
|
171
|
+
account: t,
|
|
172
|
+
chain: this.viemChain
|
|
173
|
+
}
|
|
174
|
+
);
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Increase the allowance for a spender.
|
|
178
|
+
*
|
|
179
|
+
* @param ownerAddress Address of the caller of the transaction.
|
|
180
|
+
* @param spenderAddress Address of the spender.
|
|
181
|
+
* @param addedValue The amount by which the allowance is to be increased.
|
|
182
|
+
* @returns A promise that resolves to the transaction hash.
|
|
183
|
+
*/
|
|
184
|
+
increaseAllowance(t, e, r) {
|
|
185
|
+
return this.getContract().write.increaseAllowance(
|
|
186
|
+
[e, r],
|
|
187
|
+
{
|
|
188
|
+
account: t,
|
|
189
|
+
chain: this.viemChain
|
|
190
|
+
}
|
|
191
|
+
);
|
|
192
|
+
}
|
|
193
|
+
/**
|
|
194
|
+
* Recover ERC20 tokens sent to this contract.
|
|
195
|
+
*
|
|
196
|
+
* @param account Address of the caller of the transaction.
|
|
197
|
+
* @param tokenAddress The address of the token to recover.
|
|
198
|
+
* @param to The address to which the tokens should be sent.
|
|
199
|
+
* @param amountToRecover The amount of tokens to recover.
|
|
200
|
+
* @returns A promise that resolves to the transaction hash.
|
|
201
|
+
*/
|
|
202
|
+
recoverERC20(t, e, r, n) {
|
|
203
|
+
return this.getContract().write.recoverERC20(
|
|
204
|
+
[e, r, n],
|
|
205
|
+
{
|
|
206
|
+
account: t,
|
|
207
|
+
chain: this.viemChain
|
|
208
|
+
}
|
|
209
|
+
);
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Transfer tokens to another address.
|
|
213
|
+
*
|
|
214
|
+
* @param ownerAddress Address of the caller of the transaction.
|
|
215
|
+
* @param to The address to transfer tokens to.
|
|
216
|
+
* @param amount The amount of tokens to transfer.
|
|
217
|
+
* @returns A promise that resolves to the transaction hash.
|
|
218
|
+
*/
|
|
219
|
+
transfer(t, e, r) {
|
|
220
|
+
return this.getContract().write.transfer([e, r], {
|
|
221
|
+
account: t,
|
|
222
|
+
chain: this.viemChain
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
export {
|
|
227
|
+
p as MtwCarrotHandler
|
|
228
|
+
};
|
|
229
|
+
//# sourceMappingURL=mtw-carrot-handler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mtw-carrot-handler.js","sources":["../../../lib/contracts/handlers/mtw-carrot-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { TOKENS_ADDRESSES, Token } from '../tokens';\nimport { mtwCARROT } from '../abis/mainnet/mtwCARROT';\n\n/**\n * Handler for the `mtwCARROT` token contract.\n */\nexport class MtwCarrotHandler {\n private viemChain: ViemChain;\n\n /**\n * Create the handler for the `mtwCARROT` token contract exposing\n * methods to interact with the contract.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = TOKENS_ADDRESSES[Token.mtwCARROT][this.chain];\n const abi = mtwCARROT;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Retrieve the balance of a given address.\n *\n * @param address The address to query the balance for.\n * @returns The balance of the specified address.\n */\n public balanceOf(address: Address) {\n return this.getContract().read.balanceOf([address]);\n }\n\n /**\n * Retrieve the allowance a spender has from an owner.\n *\n * @param owner The address of the token owner.\n * @param spender The address of the spender.\n * @returns The amount the spender is allowed to use on behalf of the owner.\n */\n public allowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n // TODO: Not able to test overloads using `eth-testing`.\n /* istanbul ignore next */\n /**\n * Retrieve the claimable amount for a user, optionally at a specific index.\n *\n * @param user The user's address.\n * @param maxClaimIn, '0x123'dex The maximum index to check for claimable amount (optional).\n * @returns The claimable amount for the user.\n */\n public claimable(user: Address, maxClaimIndex?: bigint): Promise<bigint> {\n if (maxClaimIndex !== undefined) {\n return this.getContract().read.claimable([user, maxClaimIndex]);\n }\n\n return this.getContract().read.claimable([user]);\n }\n\n /**\n * Retrieve the cliff duration of the vesting schedule.\n *\n * @returns The cliff duration in seconds.\n */\n public cliffDuration() {\n return this.getContract().read.cliffDuration();\n }\n\n /**\n * Retrieve all vesting schedules associated with a user.\n *\n * @param user The address of the user.\n * @returns An array of vesting schedules.\n */\n public async getUserVestings(user: Address) {\n const [allVestings, nextClaimIndex] =\n await this.getContract().read.getUserVestings([user]);\n\n return {\n allVestings,\n nextClaimIndex,\n };\n }\n\n /**\n * Check if the contract is a token wrapper.\n *\n * @returns True if the contract is a token wrapper, false otherwise.\n */\n public isTokenWrapper() {\n return this.getContract().read.isTokenWrapper();\n }\n\n /**\n * Retrieve the symbol of the token.\n *\n * @returns The token symbol.\n */\n public symbol() {\n return this.getContract().read.symbol();\n }\n\n /**\n * Retrieve the token address this contract wraps or represents.\n *\n * @returns The address of the token.\n */\n public token() {\n return this.getContract().read.token();\n }\n\n /**\n * Retrieve the underlying asset for the token.\n *\n * @returns The address of the underlying asset.\n */\n public underlying() {\n return this.getContract().read.underlying();\n }\n\n /**\n * Retrieve vesting data for a given address.\n *\n * @param address The address to query vesting data for.\n * @returns Next claim index.\n */\n public vestingData(address: Address) {\n return this.getContract().read.vestingData([address]);\n }\n\n /**\n * Approve a spender to use a specific amount of the owner's tokens.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param amount Value to approve for the spender.\n * @returns A promise that resolves to the transaction hash.\n */\n public approve(\n ownerAddress: Address,\n spenderAddress: Address,\n amount: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, amount], {\n account: ownerAddress,\n chain: this.viemChain,\n });\n }\n\n // TODO: Not able to test overloads using `eth-testing`.\n /* istanbul ignore next */\n /**\n * Claim tokens for a user.\n *\n * @param account Address of the caller of the transaction.\n * @param user The user's address.\n * @param maxClaimIndex The maximum index to check for claimable amount (optional).\n * @returns A promise that resolves to the transaction hash.\n */\n public claim(account: Address, user: Address, maxClaimIndex?: bigint) {\n if (maxClaimIndex !== undefined) {\n return this.getContract().write.claim([user, maxClaimIndex], {\n account,\n chain: this.viemChain,\n });\n }\n\n return this.getContract().write.claim([user], {\n account,\n chain: this.viemChain,\n });\n }\n\n /**\n * Decrease the allowance for a spender.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param subtractedValue The amount by which the allowance is to be decreased.\n * @returns A promise that resolves to the transaction hash.\n */\n public decreaseAllowance(\n ownerAddress: Address,\n spenderAddress: Address,\n subtractedValue: bigint,\n ) {\n return this.getContract().write.decreaseAllowance(\n [spenderAddress, subtractedValue],\n {\n account: ownerAddress,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Increase the allowance for a spender.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param addedValue The amount by which the allowance is to be increased.\n * @returns A promise that resolves to the transaction hash.\n */\n public increaseAllowance(\n ownerAddress: Address,\n spenderAddress: Address,\n addedValue: bigint,\n ) {\n return this.getContract().write.increaseAllowance(\n [spenderAddress, addedValue],\n {\n account: ownerAddress,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Recover ERC20 tokens sent to this contract.\n *\n * @param account Address of the caller of the transaction.\n * @param tokenAddress The address of the token to recover.\n * @param to The address to which the tokens should be sent.\n * @param amountToRecover The amount of tokens to recover.\n * @returns A promise that resolves to the transaction hash.\n */\n public recoverERC20(\n account: Address,\n tokenAddress: Address,\n to: Address,\n amountToRecover: bigint,\n ) {\n return this.getContract().write.recoverERC20(\n [tokenAddress, to, amountToRecover],\n {\n account,\n chain: this.viemChain,\n },\n );\n }\n\n /**\n * Transfer tokens to another address.\n *\n * @param ownerAddress Address of the caller of the transaction.\n * @param to The address to transfer tokens to.\n * @param amount The amount of tokens to transfer.\n * @returns A promise that resolves to the transaction hash.\n */\n public transfer(ownerAddress: Address, to: Address, amount: bigint) {\n return this.getContract().write.transfer([to, amount], {\n account: ownerAddress,\n chain: this.viemChain,\n });\n }\n}\n"],"names":["MtwCarrotHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","address","TOKENS_ADDRESSES","Token","abi","mtwCARROT","client","getContract","owner","spender","user","maxClaimIndex","allVestings","nextClaimIndex","ownerAddress","spenderAddress","amount","account","subtractedValue","addedValue","tokenAddress","to","amountToRecover"],"mappings":";;;;;;;AAcO,MAAMA,EAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa5B,YACUC,GACAC,GACAC,GACR;AAhBM,IAAAC,EAAA;AAaE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAEH,KAAA,YAAYE,EAAYJ,CAAK;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAS7B,cAAc;AACnB,UAAMK,IAAUC,EAAiBC,EAAM,SAAS,EAAE,KAAK,KAAK,GACtDC,IAAMC,GACNC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK,aAAa;AAEtE,WAAOC,EAAY,EAAE,SAAAN,GAAS,KAAAG,GAAK,QAAAE,GAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAatC,UAAUL,GAAkB;AACjC,WAAO,KAAK,YAAY,EAAE,KAAK,UAAU,CAACA,CAAO,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAU7C,UAAUO,GAAgBC,GAAkB;AA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B;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAWK,SAASH,GAAuBO,GAAaL,GAAgB;AAC3D,WAAA,KAAK,cAAc,MAAM,SAAS,CAACK,GAAIL,CAAM,GAAG;AAAA,MACrD,SAASF;AAAA,MACT,OAAO,KAAK;AAAA,IAAA,CACb;AAAA,EAAA;AAEL;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var c=Object.defineProperty;var
|
|
1
|
+
"use strict";var c=Object.defineProperty;var s=(n,t,e)=>t in n?c(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var r=(n,t,e)=>s(n,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("../vaults-addresses.cjs"),o=require("../abis/nucleus-accountant-abis.cjs"),u=require("../tokens.cjs"),l=require("../../getContract-3QbyfZBF.cjs");class g{constructor(t,e,a){r(this,"token");this.chain=t,this.walletClient=e,this.publicClient=a,this.token=u.UnifiToken.unifiETH}withToken(t){return this.token=t,this}getContract(){const t=i.VAULTS_ADDRESSES[this.token][this.chain].NucleusAccountant,e=o.NUCLEUS_ACCOUNTANT_ABIS[this.chain].Accountant,a={public:this.publicClient,wallet:this.walletClient};return l.getContract({address:t,abi:e,client:a})}async rateProviderData(t){const[e,a]=await this.getContract().read.rateProviderData([t]);return{isPeggedToBase:e,rateProvider:a}}vault(){return this.getContract().read.vault()}getRate(){return this.getContract().read.getRate()}getRateSafe(){return this.getContract().read.getRateSafe()}getRateInQuote(t){return this.getContract().read.getRateInQuote([t])}getRateInQuoteSafe(t){return this.getContract().read.getRateInQuoteSafe([t])}}exports.NucleusAccountantHandler=g;
|
|
2
2
|
//# sourceMappingURL=nucleus-accountant-handler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nucleus-accountant-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-accountant-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain } from '../../chains/constants';\nimport {
|
|
1
|
+
{"version":3,"file":"nucleus-accountant-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-accountant-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain } from '../../chains/constants';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\nimport { NUCLEUS_ACCOUNTANT_ABIS } from '../abis/nucleus-accountant-abis';\nimport { UnifiToken } from '../tokens';\n\n/**\n * Handler for the `Accountant` contract from nucleus.\n */\nexport class NucleusAccountantHandler {\n private token: UnifiToken;\n\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.token = UnifiToken.unifiETH;\n }\n\n /**\n * Set the UniFi token to use for executing transactions on the\n * contract.\n *\n * @param token UniFi token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: UnifiToken) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = VAULTS_ADDRESSES[this.token][this.chain]\n .NucleusAccountant as Address;\n const abi = NUCLEUS_ACCOUNTANT_ABIS[this.chain].Accountant;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the rate provider data for the given token address.\n *\n * @param tokenAddress Address of the token.\n * @returns Rate provider data for the given token address.\n */\n public async rateProviderData(tokenAddress: Address) {\n const [isPeggedToBase, rateProvider] =\n await this.getContract().read.rateProviderData([tokenAddress]);\n\n return { isPeggedToBase, rateProvider };\n }\n\n /**\n * Get the vault for the given token address.\n *\n * @returns Vault for the given token address.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the rate for the given token address.\n *\n * @returns Rate for the given token address.\n */\n public getRate() {\n return this.getContract().read.getRate();\n }\n\n /**\n * Get the rate for the given token address for safe.\n *\n * @returns Rate for the given token address for safe.\n */\n public getRateSafe() {\n return this.getContract().read.getRateSafe();\n }\n\n /**\n * Get the rate from the given quote address.\n *\n * @returns Rate for the given quote address.\n */\n public getRateInQuote(quoteAddress: Address) {\n return this.getContract().read.getRateInQuote([quoteAddress]);\n }\n\n /**\n * Get the rate from the given quote address for safe.\n *\n * @returns Rate for the given quote address for safe.\n */\n public getRateInQuoteSafe(quoteAddress: Address) {\n return this.getContract().read.getRateInQuoteSafe([quoteAddress]);\n }\n}\n"],"names":["NucleusAccountantHandler","chain","walletClient","publicClient","__publicField","UnifiToken","token","address","VAULTS_ADDRESSES","abi","NUCLEUS_ACCOUNTANT_ABIS","client","getContract","tokenAddress","isPeggedToBase","rateProvider","quoteAddress"],"mappings":"uZAiBO,MAAMA,CAAyB,CAYpC,YACUC,EACAC,EACAC,EACR,CAfMC,EAAA,cAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAER,KAAK,MAAQE,EAAAA,WAAW,QAAA,CAUnB,UAAUC,EAAmB,CAClC,YAAK,MAAQA,EACN,IAAA,CASF,aAAc,CACnB,MAAMC,EAAUC,EAAAA,iBAAiB,KAAK,KAAK,EAAE,KAAK,KAAK,EACpD,kBACGC,EAAMC,EAAA,wBAAwB,KAAK,KAAK,EAAE,WAC1CC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE,QAAAL,EAAS,IAAAE,EAAK,OAAAE,EAAQ,CAAA,CAa7C,MAAa,iBAAiBE,EAAuB,CACnD,KAAM,CAACC,EAAgBC,CAAY,EACjC,MAAM,KAAK,YAAY,EAAE,KAAK,iBAAiB,CAACF,CAAY,CAAC,EAExD,MAAA,CAAE,eAAAC,EAAgB,aAAAC,CAAa,CAAA,CAQjC,OAAQ,CACb,OAAO,KAAK,cAAc,KAAK,MAAM,CAAA,CAQhC,SAAU,CACf,OAAO,KAAK,cAAc,KAAK,QAAQ,CAAA,CAQlC,aAAc,CACnB,OAAO,KAAK,cAAc,KAAK,YAAY,CAAA,CAQtC,eAAeC,EAAuB,CAC3C,OAAO,KAAK,YAAY,EAAE,KAAK,eAAe,CAACA,CAAY,CAAC,CAAA,CAQvD,mBAAmBA,EAAuB,CAC/C,OAAO,KAAK,YAAY,EAAE,KAAK,mBAAmB,CAACA,CAAY,CAAC,CAAA,CAEpE"}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
var i = Object.defineProperty;
|
|
2
2
|
var o = (a, t, e) => t in a ? i(a, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : a[t] = e;
|
|
3
3
|
var n = (a, t, e) => o(a, typeof t != "symbol" ? t + "" : t, e);
|
|
4
|
-
import {
|
|
4
|
+
import { VAULTS_ADDRESSES as s } from "../vaults-addresses.js";
|
|
5
5
|
import { NUCLEUS_ACCOUNTANT_ABIS as c } from "../abis/nucleus-accountant-abis.js";
|
|
6
6
|
import { UnifiToken as u } from "../tokens.js";
|
|
7
7
|
import { g as h } from "../../getContract-CezEyDf-.js";
|
|
8
|
-
class
|
|
8
|
+
class S {
|
|
9
9
|
/**
|
|
10
10
|
* Create the handler for processing tokens.
|
|
11
11
|
*
|
|
@@ -91,6 +91,6 @@ class R {
|
|
|
91
91
|
}
|
|
92
92
|
}
|
|
93
93
|
export {
|
|
94
|
-
|
|
94
|
+
S as NucleusAccountantHandler
|
|
95
95
|
};
|
|
96
96
|
//# sourceMappingURL=nucleus-accountant-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nucleus-accountant-handler.js","sources":["../../../lib/contracts/handlers/nucleus-accountant-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain } from '../../chains/constants';\nimport {
|
|
1
|
+
{"version":3,"file":"nucleus-accountant-handler.js","sources":["../../../lib/contracts/handlers/nucleus-accountant-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain } from '../../chains/constants';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\nimport { NUCLEUS_ACCOUNTANT_ABIS } from '../abis/nucleus-accountant-abis';\nimport { UnifiToken } from '../tokens';\n\n/**\n * Handler for the `Accountant` contract from nucleus.\n */\nexport class NucleusAccountantHandler {\n private token: UnifiToken;\n\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.token = UnifiToken.unifiETH;\n }\n\n /**\n * Set the UniFi token to use for executing transactions on the\n * contract.\n *\n * @param token UniFi token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: UnifiToken) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = VAULTS_ADDRESSES[this.token][this.chain]\n .NucleusAccountant as Address;\n const abi = NUCLEUS_ACCOUNTANT_ABIS[this.chain].Accountant;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the rate provider data for the given token address.\n *\n * @param tokenAddress Address of the token.\n * @returns Rate provider data for the given token address.\n */\n public async rateProviderData(tokenAddress: Address) {\n const [isPeggedToBase, rateProvider] =\n await this.getContract().read.rateProviderData([tokenAddress]);\n\n return { isPeggedToBase, rateProvider };\n }\n\n /**\n * Get the vault for the given token address.\n *\n * @returns Vault for the given token address.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the rate for the given token address.\n *\n * @returns Rate for the given token address.\n */\n public getRate() {\n return this.getContract().read.getRate();\n }\n\n /**\n * Get the rate for the given token address for safe.\n *\n * @returns Rate for the given token address for safe.\n */\n public getRateSafe() {\n return this.getContract().read.getRateSafe();\n }\n\n /**\n * Get the rate from the given quote address.\n *\n * @returns Rate for the given quote address.\n */\n public getRateInQuote(quoteAddress: Address) {\n return this.getContract().read.getRateInQuote([quoteAddress]);\n }\n\n /**\n * Get the rate from the given quote address for safe.\n *\n * @returns Rate for the given quote address for safe.\n */\n public getRateInQuoteSafe(quoteAddress: Address) {\n return this.getContract().read.getRateInQuoteSafe([quoteAddress]);\n }\n}\n"],"names":["NucleusAccountantHandler","chain","walletClient","publicClient","__publicField","UnifiToken","token","address","VAULTS_ADDRESSES","abi","NUCLEUS_ACCOUNTANT_ABIS","client","getContract","tokenAddress","isPeggedToBase","rateProvider","quoteAddress"],"mappings":";;;;;;;AAiBO,MAAMA,EAAyB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAYpC,YACUC,GACAC,GACAC,GACR;AAfM,IAAAC,EAAA;AAYE,SAAA,QAAAH,GACA,KAAA,eAAAC,GACA,KAAA,eAAAC,GAER,KAAK,QAAQE,EAAW;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAUnB,UAAUC,GAAmB;AAClC,gBAAK,QAAQA,GACN;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EASF,cAAc;AACnB,UAAMC,IAAUC,EAAiB,KAAK,KAAK,EAAE,KAAK,KAAK,EACpD,mBACGC,IAAMC,EAAwB,KAAK,KAAK,EAAE,YAC1CC,IAAS,EAAE,QAAQ,KAAK,cAAc,QAAQ,KAAK,aAAa;AAEtE,WAAOC,EAAY,EAAE,SAAAL,GAAS,KAAAE,GAAK,QAAAE,GAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAa7C,MAAa,iBAAiBE,GAAuB;AACnD,UAAM,CAACC,GAAgBC,CAAY,IACjC,MAAM,KAAK,YAAY,EAAE,KAAK,iBAAiB,CAACF,CAAY,CAAC;AAExD,WAAA,EAAE,gBAAAC,GAAgB,cAAAC,EAAa;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQjC,QAAQ;AACb,WAAO,KAAK,cAAc,KAAK,MAAM;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQhC,UAAU;AACf,WAAO,KAAK,cAAc,KAAK,QAAQ;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQlC,cAAc;AACnB,WAAO,KAAK,cAAc,KAAK,YAAY;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQtC,eAAeC,GAAuB;AAC3C,WAAO,KAAK,YAAY,EAAE,KAAK,eAAe,CAACA,CAAY,CAAC;AAAA,EAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAQvD,mBAAmBA,GAAuB;AAC/C,WAAO,KAAK,YAAY,EAAE,KAAK,mBAAmB,CAACA,CAAY,CAAC;AAAA,EAAA;AAEpE;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var l=Object.defineProperty;var C=(a,t,e)=>t in a?l(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var c=(a,t,e)=>C(a,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../../constants-DA2xUb9r.cjs"),m=require("../abis/nucleus-boring-vault-abis.cjs"),p=require("../addresses.cjs"),S=require("../tokens.cjs"),
|
|
1
|
+
"use strict";var l=Object.defineProperty;var C=(a,t,e)=>t in a?l(a,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):a[t]=e;var c=(a,t,e)=>C(a,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const g=require("../../constants-DA2xUb9r.cjs"),m=require("../abis/nucleus-boring-vault-abis.cjs"),p=require("../vaults-addresses.cjs"),S=require("../tokens.cjs"),b=require("../../getContract-3QbyfZBF.cjs");class f{constructor(t,e,n){c(this,"viemChain");c(this,"token");this.chain=t,this.walletClient=e,this.publicClient=n,this.viemChain=g.VIEM_CHAINS[t],this.token=S.UnifiToken.unifiETH}withToken(t){return this.token=t,this}getContract(){const t=p.VAULTS_ADDRESSES[this.token][this.chain].NucleusBoringVault,e=m.NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault,n={public:this.publicClient,wallet:this.walletClient};return b.getContract({address:t,abi:e,client:n})}getAllowance(t,e){return this.getContract().read.allowance([t,e])}balanceOf(t){return this.getContract().read.balanceOf([t])}totalSupply(){return this.getContract().read.totalSupply()}approve(t,e,n){return this.getContract().write.approve([e,n],{account:t,chain:this.viemChain})}transfer(t,e,n){return{transact:()=>this.getContract().write.transfer([e,n],{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.transfer([e,n],{account:t})}}transferFrom(t,e,n,i){return{transact:()=>this.getContract().write.transferFrom([e,n,i],{account:t,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.transferFrom([e,n,i],{account:t})}}permit(t){const{account:e,owner:n,spender:i,value:r,deadline:s,v:o,r:u,s:h}=t;return{transact:()=>this.getContract().write.permit([n,i,r,s,o,u,h],{account:e,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.permit([n,i,r,s,o,u,h],{account:e})}}}exports.NucleusBoringVaultHandler=f;
|
|
2
2
|
//# sourceMappingURL=nucleus-boring-vault-handler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nucleus-boring-vault-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-boring-vault-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';\nimport {
|
|
1
|
+
{"version":3,"file":"nucleus-boring-vault-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-boring-vault-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\nimport { UnifiToken } from '../tokens';\n\nexport type PermitParams = {\n account: Address;\n owner: Address;\n spender: Address;\n value: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `BoringVault` contract for a given token exposing\n * methods to interact with the contract.\n */\nexport class NucleusBoringVaultHandler {\n private viemChain: ViemChain;\n private token: UnifiToken;\n\n /**\n * Create the handler for processing UniFi tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n this.token = UnifiToken.unifiETH;\n }\n\n /**\n * Set the UniFi token to use for executing transactions on the\n * contract.\n *\n * @param token UniFi token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: UnifiToken) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = VAULTS_ADDRESSES[this.token][this.chain]\n .NucleusBoringVault as Address;\n const abi = NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param owner Address of the owner.\n * @param spender Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Check the token balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns Token balance in wei.\n */\n public balanceOf(walletAddress: Address) {\n return this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n walletAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer tokens from the owner's wallet to the given address.\n *\n * @param walletAddress Address of the owner's wallet.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transfer(walletAddress: Address, toAddress: Address, value: bigint) {\n const transact = () =>\n this.getContract().write.transfer([toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transfer([toAddress, value], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Transfer tokens from the given address to another address.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param fromAddress Address to transfer the tokens from.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transferFrom(\n walletAddress: Address,\n fromAddress: Address,\n toAddress: Address,\n value: bigint,\n ) {\n const transact = () =>\n this.getContract().write.transferFrom([fromAddress, toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transferFrom(\n [fromAddress, toAddress, value],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Get permit to be able to use the token.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.owner Address of the owner.\n * @param params.spender Address of the spender.\n * @param params.value Value to approve for the spender.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public permit(params: PermitParams) {\n const { account, owner, spender, value, deadline, v, r, s } = params;\n const transact = () =>\n this.getContract().write.permit(\n [owner, spender, value, deadline, v, r, s],\n { account, chain: this.viemChain },\n );\n const estimate = () =>\n this.getContract().estimateGas.permit(\n [owner, spender, value, deadline, v, r, s],\n { account },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusBoringVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","UnifiToken","token","address","VAULTS_ADDRESSES","abi","NUCLEUS_BORING_VAULT_ABIS","client","getContract","owner","spender","walletAddress","spenderAddress","value","toAddress","fromAddress","params","account","deadline","v","r","s"],"mappings":"mcA6BO,MAAMA,CAA0B,CAarC,YACUC,EACAC,EACAC,EACR,CAhBMC,EAAA,kBACAA,EAAA,cAYE,KAAA,MAAAH,EACA,KAAA,aAA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,SANF,IACf,KAAK,cAAc,YAAY,aAC7B,CAACI,EAAaD,EAAWD,CAAK,EAC9B,CAAE,QAASF,CAAc,CAC3B,CAE0B,CAAA,CAqBvB,OAAOK,EAAsB,CAC5B,KAAA,CAAE,QAAAC,EAAS,MAAAR,EAAO,QAAAC,EAAS,MAAAG,EAAO,SAAAK,EAAU,EAAAC,EAAG,EAAAC,EAAG,EAAAC,CAAA,EAAML,EAYvD,MAAA,CAAE,SAXQ,IACf,KAAK,cAAc,MAAM,OACvB,CAACP,EAAOC,EAASG,EAAOK,EAAUC,EAAGC,EAAGC,CAAC,EACzC,CAAE,QAAAJ,EAAS,MAAO,KAAK,SAAU,CACnC,EAOiB,SANF,IACf,KAAK,cAAc,YAAY,OAC7B,CAACR,EAAOC,EAASG,EAAOK,EAAUC,EAAGC,EAAGC,CAAC,EACzC,CAAE,QAAAJ,CAAQ,CACZ,CAE0B,CAAA,CAEhC"}
|
|
@@ -3,10 +3,10 @@ var l = (e, t, n) => t in e ? u(e, t, { enumerable: !0, configurable: !0, writab
|
|
|
3
3
|
var c = (e, t, n) => l(e, typeof t != "symbol" ? t + "" : t, n);
|
|
4
4
|
import { V as C } from "../../constants-BjRNQpT2.js";
|
|
5
5
|
import { NUCLEUS_BORING_VAULT_ABIS as p } from "../abis/nucleus-boring-vault-abis.js";
|
|
6
|
-
import {
|
|
6
|
+
import { VAULTS_ADDRESSES as g } from "../vaults-addresses.js";
|
|
7
7
|
import { UnifiToken as f } from "../tokens.js";
|
|
8
8
|
import { g as w } from "../../getContract-CezEyDf-.js";
|
|
9
|
-
class
|
|
9
|
+
class T {
|
|
10
10
|
/**
|
|
11
11
|
* Create the handler for processing UniFi tokens.
|
|
12
12
|
*
|
|
@@ -154,6 +154,6 @@ class V {
|
|
|
154
154
|
}
|
|
155
155
|
}
|
|
156
156
|
export {
|
|
157
|
-
|
|
157
|
+
T as NucleusBoringVaultHandler
|
|
158
158
|
};
|
|
159
159
|
//# sourceMappingURL=nucleus-boring-vault-handler.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nucleus-boring-vault-handler.js","sources":["../../../lib/contracts/handlers/nucleus-boring-vault-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';\nimport {
|
|
1
|
+
{"version":3,"file":"nucleus-boring-vault-handler.js","sources":["../../../lib/contracts/handlers/nucleus-boring-vault-handler.ts"],"sourcesContent":["/* istanbul ignore file */\n\nimport {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { NUCLEUS_BORING_VAULT_ABIS } from '../abis/nucleus-boring-vault-abis';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\nimport { UnifiToken } from '../tokens';\n\nexport type PermitParams = {\n account: Address;\n owner: Address;\n spender: Address;\n value: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `BoringVault` contract for a given token exposing\n * methods to interact with the contract.\n */\nexport class NucleusBoringVaultHandler {\n private viemChain: ViemChain;\n private token: UnifiToken;\n\n /**\n * Create the handler for processing UniFi tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n this.token = UnifiToken.unifiETH;\n }\n\n /**\n * Set the UniFi token to use for executing transactions on the\n * contract.\n *\n * @param token UniFi token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: UnifiToken) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = VAULTS_ADDRESSES[this.token][this.chain]\n .NucleusBoringVault as Address;\n const abi = NUCLEUS_BORING_VAULT_ABIS[this.chain].BoringVault;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the allowance for the given owner and spender.\n *\n * @param owner Address of the owner.\n * @param spender Address of the spender.\n * @returns Allowance for the given owner and spender.\n */\n public getAllowance(owner: Address, spender: Address) {\n return this.getContract().read.allowance([owner, spender]);\n }\n\n /**\n * Check the token balance of the wallet.\n *\n * @param walletAddress Wallet address to check the balance of.\n * @returns Token balance in wei.\n */\n public balanceOf(walletAddress: Address) {\n return this.getContract().read.balanceOf([walletAddress]);\n }\n\n /**\n * Get the total supply of the token.\n *\n * @returns Total supply of the token.\n */\n public totalSupply() {\n return this.getContract().read.totalSupply();\n }\n\n /**\n * Approve transaction for the spender to spend the owner's tokens.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param spenderAddress Address of the spender.\n * @param value Value to approve for the spender.\n * @returns Hash of the transaction.\n */\n public approve(\n walletAddress: Address,\n spenderAddress: Address,\n value: bigint,\n ) {\n return this.getContract().write.approve([spenderAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n }\n\n /**\n * Transfer tokens from the owner's wallet to the given address.\n *\n * @param walletAddress Address of the owner's wallet.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transfer(walletAddress: Address, toAddress: Address, value: bigint) {\n const transact = () =>\n this.getContract().write.transfer([toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transfer([toAddress, value], {\n account: walletAddress,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Transfer tokens from the given address to another address.\n *\n * @param walletAddress Address of the caller of the transaction.\n * @param fromAddress Address to transfer the tokens from.\n * @param toAddress Address to transfer the tokens to.\n * @param value Value to transfer.\n * @returns `transact: () => Promise<Address>` - Used to\n * make the transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public transferFrom(\n walletAddress: Address,\n fromAddress: Address,\n toAddress: Address,\n value: bigint,\n ) {\n const transact = () =>\n this.getContract().write.transferFrom([fromAddress, toAddress, value], {\n account: walletAddress,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.transferFrom(\n [fromAddress, toAddress, value],\n { account: walletAddress },\n );\n\n return { transact, estimate };\n }\n\n /**\n * Get permit to be able to use the token.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.owner Address of the owner.\n * @param params.spender Address of the spender.\n * @param params.value Value to approve for the spender.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public permit(params: PermitParams) {\n const { account, owner, spender, value, deadline, v, r, s } = params;\n const transact = () =>\n this.getContract().write.permit(\n [owner, spender, value, deadline, v, r, s],\n { account, chain: this.viemChain },\n );\n const estimate = () =>\n this.getContract().estimateGas.permit(\n [owner, spender, value, deadline, v, r, s],\n { account },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusBoringVaultHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","UnifiToken","token","address","VAULTS_ADDRESSES","abi","NUCLEUS_BORING_VAULT_ABIS","client","getContract","owner","spender","walletAddress","spenderAddress","value","toAddress","fromAddress","params","account","deadline","v","r","s"],"mappings":";;;;;;;;AA6BO,MAAMA,EAA0B;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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ACf,KAAK,cAAc,YAAY;AAAA,MAC7B,CAACR,GAAOC,GAASG,GAAOK,GAAUC,GAAGC,GAAGC,CAAC;AAAA,MACzC,EAAE,SAAAJ,EAAQ;AAAA,IACZ,EAE0B;AAAA,EAAA;AAEhC;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var S=Object.defineProperty;var
|
|
1
|
+
"use strict";var S=Object.defineProperty;var P=(r,t,e)=>t in r?S(r,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):r[t]=e;var u=(r,t,e)=>P(r,typeof t!="symbol"?t+"":t,e);Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const T=require("../../constants-DA2xUb9r.cjs"),p=require("../vaults-addresses.cjs"),k=require("../abis/nucleus-teller-abis.cjs"),l=require("../tokens.cjs"),E=require("./erc20-permit-handler.cjs"),_=require("../../getContract-3QbyfZBF.cjs");class v{constructor(t,e,i){u(this,"viemChain");u(this,"erc20PermitHandler");u(this,"token");this.chain=t,this.walletClient=e,this.publicClient=i,this.viemChain=T.VIEM_CHAINS[t],this.erc20PermitHandler=new E.ERC20PermitHandler(t,e,i),this.token=l.UnifiToken.unifiETH}withToken(t){return this.token=t,this}getContract(){const t=p.VAULTS_ADDRESSES[this.token][this.chain].NucleusTeller,e=k.NUCLEUS_TELLER_ABIS[this.chain].Teller,i={public:this.publicClient,wallet:this.walletClient};return _.getContract({address:t,abi:e,client:i})}accountant(){return this.getContract().read.accountant()}vault(){return this.getContract().read.vault()}shareLockPeriod(){return this.getContract().read.shareLockPeriod()}shareUnlockTime(t){return this.getContract().read.shareUnlockTime([t])}isPaused(){return this.getContract().read.isPaused()}async deposit(t){const{token:e,unifiToken:i,account:s,amount:n,minimumMint:a,isPreapproved:o=!1}=t,c=l.TOKENS_ADDRESSES[e][this.chain];if(o)return{transact:()=>this.getContract().write.deposit([c,n,a],{account:s,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.deposit([c,n,a],{account:s})};const{r:h,s:d,v:m,deadline:g}=await this.erc20PermitHandler.withToken(e).getPermitSignature(s,l.TOKENS_ADDRESSES[i][this.chain],n),C=[c,n,a,g,Number(m),h,d];return{transact:()=>this.getContract().write.depositWithPermit(C,{account:s,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.depositWithPermit(C,{account:s})}}depositWithPermit(t){const{account:e,depositAsset:i,depositAmount:s,minimumMint:n,deadline:a,v:o,r:c,s:h}=t;return{transact:()=>this.getContract().write.depositWithPermit([i,s,n,a,o,c,h],{account:e,chain:this.viemChain}),estimate:()=>this.getContract().estimateGas.depositWithPermit([i,s,n,a,o,c,h],{account:e})}}}exports.NucleusTellerHandler=v;
|
|
2
2
|
//# sourceMappingURL=nucleus-teller-handler.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"nucleus-teller-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-teller-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport {
|
|
1
|
+
{"version":3,"file":"nucleus-teller-handler.cjs","sources":["../../../lib/contracts/handlers/nucleus-teller-handler.ts"],"sourcesContent":["import {\n WalletClient,\n PublicClient,\n getContract,\n Address,\n GetContractReturnType,\n} from 'viem';\nimport { Chain, VIEM_CHAINS, ViemChain } from '../../chains/constants';\nimport { VAULTS_ADDRESSES } from '../vaults-addresses';\nimport { NUCLEUS_TELLER_ABIS } from '../abis/nucleus-teller-abis';\nimport { Token, TOKENS_ADDRESSES, UnifiToken } from '../tokens';\nimport { ERC20PermitHandler } from './erc20-permit-handler';\n\nexport type DepositParams = {\n account: Address;\n token: Token;\n unifiToken: UnifiToken;\n amount: bigint;\n minimumMint: bigint;\n isPreapproved?: boolean;\n};\n\nexport type DepositWithPermitParams = {\n account: Address;\n depositAsset: Address;\n depositAmount: bigint;\n minimumMint: bigint;\n deadline: bigint;\n v: number;\n r: Address;\n s: Address;\n};\n\n/**\n * Handler for the `Teller` contract from nucleus.\n */\nexport class NucleusTellerHandler {\n private viemChain: ViemChain;\n private erc20PermitHandler: ERC20PermitHandler;\n private token: UnifiToken;\n\n /**\n * Create the handler for processing tokens.\n *\n * @param chain Chain to use for the client.\n * @param walletClient The wallet client to use for wallet\n * interactions.\n * @param publicClient The public client to use for public\n * interactions.\n */\n constructor(\n private chain: Chain,\n private walletClient: WalletClient,\n private publicClient: PublicClient,\n ) {\n this.viemChain = VIEM_CHAINS[chain];\n this.erc20PermitHandler = new ERC20PermitHandler(\n chain,\n walletClient,\n publicClient,\n );\n this.token = UnifiToken.unifiETH;\n }\n\n /**\n * Set the UniFi token to use for executing transactions on the\n * contract.\n *\n * @param token UniFi token to use for the handler.\n * @returns The handler.\n */\n public withToken(token: UnifiToken) {\n this.token = token;\n return this;\n }\n\n /**\n * Get the contract. This is a method because the typings are complex\n * and lost when trying to make it a member.\n *\n * @returns The viem contract.\n */\n public getContract() {\n const address = VAULTS_ADDRESSES[this.token][this.chain]\n .NucleusTeller as Address;\n const abi = NUCLEUS_TELLER_ABIS[this.chain].Teller;\n const client = { public: this.publicClient, wallet: this.walletClient };\n\n return getContract({ address, abi, client }) as GetContractReturnType<\n typeof abi,\n typeof client,\n Address\n >;\n }\n\n /**\n * Get the address of the `Accountant` contract.\n *\n * @returns The address of the `Accountant` contract.\n */\n public accountant() {\n return this.getContract().read.accountant();\n }\n\n /**\n * Get the address of the `BoringVault` contract.\n *\n * @returns The address of the `BoringVault` contract.\n */\n public vault() {\n return this.getContract().read.vault();\n }\n\n /**\n * Get the share lock period.\n *\n * @returns The share lock period.\n */\n public shareLockPeriod() {\n return this.getContract().read.shareLockPeriod();\n }\n\n /**\n * Get the share unlock time for the given wallet address.\n *\n * @param walletAddress Address of the wallet.\n * @returns The share unlock time.\n */\n public shareUnlockTime(walletAddress: Address) {\n return this.getContract().read.shareUnlockTime([walletAddress]);\n }\n\n /**\n * Get the paused state of the contract.\n *\n * @returns The paused state of the contract.\n */\n public isPaused() {\n return this.getContract().read.isPaused();\n }\n\n /**\n * Deposit the given token for staking. This doesn't make the\n * transaction but returns two methods namely `transact` and\n * `estimate`.\n *\n * @param params Deposit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.token Token to deposit.\n * @param params.unifiToken UniFi token to get in return of the deposit.\n * @param params.amount Amount of the token to deposit.\n * @param params.minimumMint Minimum amount of shares to mint.\n * @param params.isPreapproved Whether the token is preapproved.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public async deposit(params: DepositParams) {\n const {\n token,\n unifiToken,\n account,\n amount,\n minimumMint,\n isPreapproved = false,\n } = params;\n const tokenAddress = TOKENS_ADDRESSES[token][this.chain];\n\n if (isPreapproved) {\n return {\n transact: () =>\n this.getContract().write.deposit(\n [tokenAddress, amount, minimumMint],\n {\n account,\n chain: this.viemChain,\n },\n ),\n estimate: () =>\n this.getContract().estimateGas.deposit(\n [tokenAddress, amount, minimumMint],\n { account },\n ),\n };\n }\n\n const { r, s, v, deadline } = await this.erc20PermitHandler\n .withToken(token)\n .getPermitSignature(\n account,\n // The UniFi token contract is the spender.\n TOKENS_ADDRESSES[unifiToken][this.chain],\n amount,\n );\n\n const depositArgs = <const>[\n tokenAddress,\n amount,\n minimumMint,\n deadline,\n Number(v),\n r,\n s,\n ];\n\n const transact = () =>\n this.getContract().write.depositWithPermit(depositArgs, {\n account,\n chain: this.viemChain,\n });\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(depositArgs, {\n account,\n });\n\n return { transact, estimate };\n }\n\n /**\n * Deposit an asset/token for staking with a permit.\n *\n * @param params Permit parameters.\n * @param params.account Address of the caller of the transaction.\n * @param params.depositAsset Address of the asset/token to deposit.\n * @param params.depositAmount Amount of the asset/token to deposit.\n * @param params.minimumMint Minimum amount of shares to mint.\n * @param params.deadline Deadline for the permit.\n * @param params.v v value of the permit.\n * @param params.r r value of the permit.\n * @param params.s s value of the permit.\n * @returns `transact: () => Promise<Address>` - Used to make the\n * transaction with the given value.\n *\n * `estimate: () => Promise<bigint>` - Gas estimate of the\n * transaction.\n */\n public depositWithPermit(params: DepositWithPermitParams) {\n const {\n account,\n depositAsset,\n depositAmount,\n minimumMint,\n deadline,\n v,\n r,\n s,\n } = params;\n\n const transact = () =>\n this.getContract().write.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n chain: this.viemChain,\n },\n );\n const estimate = () =>\n this.getContract().estimateGas.depositWithPermit(\n [depositAsset, depositAmount, minimumMint, deadline, v, r, s],\n {\n account,\n },\n );\n\n return { transact, estimate };\n }\n}\n"],"names":["NucleusTellerHandler","chain","walletClient","publicClient","__publicField","VIEM_CHAINS","ERC20PermitHandler","UnifiToken","token","address","VAULTS_ADDRESSES","abi","NUCLEUS_TELLER_ABIS","client","getContract","walletAddress","params","unifiToken","account","amount","minimumMint","isPreapproved","tokenAddress","TOKENS_ADDRESSES","r","s","v","deadline","depositArgs","depositAsset","depositAmount"],"mappings":"qeAoCO,MAAMA,CAAqB,CAchC,YACUC,EACAC,EACAC,EACR,CAjBMC,EAAA,kBACAA,EAAA,2BACAA,EAAA,cAYE,KAAA,MAAAH,EACA,KAAA,aAAAC,EACA,KAAA,aAAAC,EAEH,KAAA,UAAYE,cAAYJ,CAAK,EAClC,KAAK,mBAAqB,IAAIK,EAAA,mBAC5BL,EACAC,EACAC,CACF,EACA,KAAK,MAAQI,EAAAA,WAAW,QAAA,CAUnB,UAAUC,EAAmB,CAClC,YAAK,MAAQA,EACN,IAAA,CASF,aAAc,CACnB,MAAMC,EAAUC,EAAAA,iBAAiB,KAAK,KAAK,EAAE,KAAK,KAAK,EACpD,cACGC,EAAMC,EAAA,oBAAoB,KAAK,KAAK,EAAE,OACtCC,EAAS,CAAE,OAAQ,KAAK,aAAc,OAAQ,KAAK,YAAa,EAEtE,OAAOC,EAAY,YAAA,CAAE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,QAAAV,CAAA,CACD,CAEyB,CAAA,CAqBvB,kBAAkBF,EAAiC,CAClD,KAAA,CACJ,QAAAE,EACA,aAAAW,EACA,cAAAC,EACA,YAAAV,EACA,SAAAO,EACA,EAAAD,EACA,EAAAF,EACA,EAAAC,CAAA,EACET,EAkBG,MAAA,CAAE,SAhBQ,IACf,KAAK,cAAc,MAAM,kBACvB,CAACa,EAAcC,EAAeV,EAAaO,EAAUD,EAAGF,EAAGC,CAAC,EAC5D,CACE,QAAAP,EACA,MAAO,KAAK,SAAA,CAEhB,EASiB,SARF,IACf,KAAK,cAAc,YAAY,kBAC7B,CAACW,EAAcC,EAAeV,EAAaO,EAAUD,EAAGF,EAAGC,CAAC,EAC5D,CACE,QAAAP,CAAA,CAEJ,CAE0B,CAAA,CAEhC"}
|
|
@@ -2,12 +2,12 @@ var g = Object.defineProperty;
|
|
|
2
2
|
var P = (n, t, e) => t in n ? g(n, t, { enumerable: !0, configurable: !0, writable: !0, value: e }) : n[t] = e;
|
|
3
3
|
var m = (n, t, e) => P(n, typeof t != "symbol" ? t + "" : t, e);
|
|
4
4
|
import { V as k } from "../../constants-BjRNQpT2.js";
|
|
5
|
-
import {
|
|
6
|
-
import { NUCLEUS_TELLER_ABIS as
|
|
7
|
-
import { UnifiToken as
|
|
8
|
-
import { ERC20PermitHandler as
|
|
5
|
+
import { VAULTS_ADDRESSES as T } from "../vaults-addresses.js";
|
|
6
|
+
import { NUCLEUS_TELLER_ABIS as S } from "../abis/nucleus-teller-abis.js";
|
|
7
|
+
import { UnifiToken as f, TOKENS_ADDRESSES as C } from "../tokens.js";
|
|
8
|
+
import { ERC20PermitHandler as E } from "./erc20-permit-handler.js";
|
|
9
9
|
import { g as v } from "../../getContract-CezEyDf-.js";
|
|
10
|
-
class
|
|
10
|
+
class D {
|
|
11
11
|
/**
|
|
12
12
|
* Create the handler for processing tokens.
|
|
13
13
|
*
|
|
@@ -21,11 +21,11 @@ class b {
|
|
|
21
21
|
m(this, "viemChain");
|
|
22
22
|
m(this, "erc20PermitHandler");
|
|
23
23
|
m(this, "token");
|
|
24
|
-
this.chain = t, this.walletClient = e, this.publicClient = i, this.viemChain = k[t], this.erc20PermitHandler = new
|
|
24
|
+
this.chain = t, this.walletClient = e, this.publicClient = i, this.viemChain = k[t], this.erc20PermitHandler = new E(
|
|
25
25
|
t,
|
|
26
26
|
e,
|
|
27
27
|
i
|
|
28
|
-
), this.token =
|
|
28
|
+
), this.token = f.unifiETH;
|
|
29
29
|
}
|
|
30
30
|
/**
|
|
31
31
|
* Set the UniFi token to use for executing transactions on the
|
|
@@ -44,7 +44,7 @@ class b {
|
|
|
44
44
|
* @returns The viem contract.
|
|
45
45
|
*/
|
|
46
46
|
getContract() {
|
|
47
|
-
const t = T[this.token][this.chain].NucleusTeller, e =
|
|
47
|
+
const t = T[this.token][this.chain].NucleusTeller, e = S[this.chain].Teller, i = { public: this.publicClient, wallet: this.walletClient };
|
|
48
48
|
return v({ address: t, abi: e, client: i });
|
|
49
49
|
}
|
|
50
50
|
/**
|
|
@@ -194,6 +194,6 @@ class b {
|
|
|
194
194
|
}
|
|
195
195
|
}
|
|
196
196
|
export {
|
|
197
|
-
|
|
197
|
+
D as NucleusTellerHandler
|
|
198
198
|
};
|
|
199
199
|
//# sourceMappingURL=nucleus-teller-handler.js.map
|