@gearbox-protocol/sdk 14.11.1 → 14.11.3

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.
@@ -18,7 +18,9 @@ var __copyProps = (to, from, except, desc) => {
18
18
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
19
  var abi_exports = {};
20
20
  __export(abi_exports, {
21
+ faucetAbi: () => faucetAbi,
21
22
  iDegenNftv2Abi: () => iDegenNftv2Abi,
23
+ iOnchainExecutionIdAbi: () => iOnchainExecutionIdAbi,
22
24
  iOwnableAbi: () => iOwnableAbi,
23
25
  iaclTraitAbi: () => iaclTraitAbi
24
26
  });
@@ -34,9 +36,214 @@ const iDegenNftv2Abi = (0, import_viem.parseAbi)([
34
36
  "function minter() external view returns (address)",
35
37
  "function mint(address to, uint256 amount) external"
36
38
  ]);
39
+ const faucetAbi = [
40
+ {
41
+ type: "function",
42
+ name: "assets",
43
+ inputs: [
44
+ {
45
+ name: "",
46
+ type: "uint256",
47
+ internalType: "uint256"
48
+ }
49
+ ],
50
+ outputs: [
51
+ {
52
+ name: "",
53
+ type: "address",
54
+ internalType: "address"
55
+ }
56
+ ],
57
+ stateMutability: "view"
58
+ },
59
+ {
60
+ type: "function",
61
+ name: "claim",
62
+ inputs: [
63
+ {
64
+ name: "amountUSD",
65
+ type: "uint256",
66
+ internalType: "uint256"
67
+ }
68
+ ],
69
+ outputs: [],
70
+ stateMutability: "nonpayable"
71
+ },
72
+ {
73
+ type: "function",
74
+ name: "claim",
75
+ inputs: [],
76
+ outputs: [],
77
+ stateMutability: "nonpayable"
78
+ },
79
+ {
80
+ type: "function",
81
+ name: "claim",
82
+ inputs: [
83
+ {
84
+ name: "claims",
85
+ type: "tuple[]",
86
+ internalType: "struct TokenClaim[]",
87
+ components: [
88
+ {
89
+ name: "token",
90
+ type: "address",
91
+ internalType: "address"
92
+ },
93
+ {
94
+ name: "amount",
95
+ type: "uint256",
96
+ internalType: "uint256"
97
+ }
98
+ ]
99
+ }
100
+ ],
101
+ outputs: [],
102
+ stateMutability: "nonpayable"
103
+ },
104
+ {
105
+ type: "function",
106
+ name: "getAssets",
107
+ inputs: [],
108
+ outputs: [
109
+ {
110
+ name: "",
111
+ type: "address[]",
112
+ internalType: "address[]"
113
+ }
114
+ ],
115
+ stateMutability: "view"
116
+ },
117
+ {
118
+ type: "function",
119
+ name: "hasClaimed",
120
+ inputs: [
121
+ {
122
+ name: "user",
123
+ type: "address",
124
+ internalType: "address"
125
+ }
126
+ ],
127
+ outputs: [
128
+ {
129
+ name: "",
130
+ type: "bool",
131
+ internalType: "bool"
132
+ }
133
+ ],
134
+ stateMutability: "view"
135
+ },
136
+ {
137
+ type: "function",
138
+ name: "minAmountUSD",
139
+ inputs: [],
140
+ outputs: [
141
+ {
142
+ name: "",
143
+ type: "uint256",
144
+ internalType: "uint256"
145
+ }
146
+ ],
147
+ stateMutability: "view"
148
+ },
149
+ {
150
+ type: "function",
151
+ name: "owner",
152
+ inputs: [],
153
+ outputs: [
154
+ {
155
+ name: "",
156
+ type: "address",
157
+ internalType: "address"
158
+ }
159
+ ],
160
+ stateMutability: "view"
161
+ },
162
+ {
163
+ type: "function",
164
+ name: "prices",
165
+ inputs: [
166
+ {
167
+ name: "",
168
+ type: "address",
169
+ internalType: "address"
170
+ }
171
+ ],
172
+ outputs: [
173
+ {
174
+ name: "",
175
+ type: "uint256",
176
+ internalType: "uint256"
177
+ }
178
+ ],
179
+ stateMutability: "view"
180
+ },
181
+ {
182
+ type: "function",
183
+ name: "scales",
184
+ inputs: [
185
+ {
186
+ name: "",
187
+ type: "address",
188
+ internalType: "address"
189
+ }
190
+ ],
191
+ outputs: [
192
+ {
193
+ name: "",
194
+ type: "uint256",
195
+ internalType: "uint256"
196
+ }
197
+ ],
198
+ stateMutability: "view"
199
+ }
200
+ ];
201
+ const iOnchainExecutionIdAbi = [
202
+ {
203
+ type: "function",
204
+ name: "deployer",
205
+ inputs: [],
206
+ outputs: [{ name: "", type: "string", internalType: "string" }],
207
+ stateMutability: "view"
208
+ },
209
+ {
210
+ type: "function",
211
+ name: "executionId",
212
+ inputs: [],
213
+ outputs: [{ name: "", type: "string", internalType: "string" }],
214
+ stateMutability: "view"
215
+ },
216
+ {
217
+ type: "function",
218
+ name: "forkAlias",
219
+ inputs: [],
220
+ outputs: [{ name: "", type: "string", internalType: "string" }],
221
+ stateMutability: "view"
222
+ },
223
+ {
224
+ type: "function",
225
+ name: "info",
226
+ inputs: [],
227
+ outputs: [
228
+ {
229
+ name: "",
230
+ type: "tuple",
231
+ internalType: "struct ExecutionId.Info",
232
+ components: [
233
+ { name: "deployer", type: "string", internalType: "string" },
234
+ { name: "executionId", type: "string", internalType: "string" },
235
+ { name: "forkAlias", type: "string", internalType: "string" }
236
+ ]
237
+ }
238
+ ],
239
+ stateMutability: "view"
240
+ }
241
+ ];
37
242
  // Annotate the CommonJS export names for ESM import in node:
38
243
  0 && (module.exports = {
244
+ faucetAbi,
39
245
  iDegenNftv2Abi,
246
+ iOnchainExecutionIdAbi,
40
247
  iOwnableAbi,
41
248
  iaclTraitAbi
42
249
  });
@@ -21,15 +21,9 @@ __export(claimFromFaucet_exports, {
21
21
  claimFromFaucet: () => claimFromFaucet
22
22
  });
23
23
  module.exports = __toCommonJS(claimFromFaucet_exports);
24
- var import_viem = require("viem");
25
24
  var import_actions = require("viem/actions");
26
25
  var import_sdk = require("../sdk/index.js");
27
- const faucetAbi = (0, import_viem.parseAbi)([
28
- "function minAmountUSD() external view returns (uint256)",
29
- "function claim() external",
30
- "function claim(uint256 amountUSD) external",
31
- "function claim((address token, uint256 amount)[] claims) external"
32
- ]);
26
+ var import_abi = require("./abi.js");
33
27
  async function claimFromFaucet(opts) {
34
28
  const {
35
29
  sdk,
@@ -60,7 +54,7 @@ async function claimFromFaucet(opts) {
60
54
  } else if (typeof amount === "function") {
61
55
  const minAmountUSD = await (0, import_actions.readContract)(publicClient, {
62
56
  address: faucet,
63
- abi: faucetAbi,
57
+ abi: import_abi.faucetAbi,
64
58
  functionName: "minAmountUSD"
65
59
  });
66
60
  logger?.debug(`faucet min amount USD: ${minAmountUSD}`);
@@ -78,7 +72,7 @@ async function claimFromFaucet(opts) {
78
72
  const gas = await publicClient.estimateContractGas({
79
73
  account: claimer,
80
74
  address: faucet,
81
- abi: faucetAbi,
75
+ abi: import_abi.faucetAbi,
82
76
  functionName: "claim",
83
77
  args
84
78
  });
@@ -86,7 +80,7 @@ async function claimFromFaucet(opts) {
86
80
  const { request } = await publicClient.simulateContract({
87
81
  account: claimer,
88
82
  address: faucet,
89
- abi: faucetAbi,
83
+ abi: import_abi.faucetAbi,
90
84
  functionName: "claim",
91
85
  args,
92
86
  chain: wallet.chain,
@@ -24,6 +24,7 @@ __export(dev_exports, {
24
24
  });
25
25
  module.exports = __toCommonJS(dev_exports);
26
26
  __reExport(dev_exports, require("./AccountOpener.js"), module.exports);
27
+ __reExport(dev_exports, require("./abi.js"), module.exports);
27
28
  __reExport(dev_exports, require("./calcLiquidatableLTs.js"), module.exports);
28
29
  __reExport(dev_exports, require("./claimDSToken.js"), module.exports);
29
30
  __reExport(dev_exports, require("./claimFromFaucet.js"), module.exports);
@@ -49,6 +50,7 @@ __reExport(dev_exports, require("./types.js"), module.exports);
49
50
  isRangeError,
50
51
  logSplitterTransport,
51
52
  ...require("./AccountOpener.js"),
53
+ ...require("./abi.js"),
52
54
  ...require("./calcLiquidatableLTs.js"),
53
55
  ...require("./claimDSToken.js"),
54
56
  ...require("./claimFromFaucet.js"),
@@ -9,8 +9,213 @@ const iDegenNftv2Abi = parseAbi([
9
9
  "function minter() external view returns (address)",
10
10
  "function mint(address to, uint256 amount) external"
11
11
  ]);
12
+ const faucetAbi = [
13
+ {
14
+ type: "function",
15
+ name: "assets",
16
+ inputs: [
17
+ {
18
+ name: "",
19
+ type: "uint256",
20
+ internalType: "uint256"
21
+ }
22
+ ],
23
+ outputs: [
24
+ {
25
+ name: "",
26
+ type: "address",
27
+ internalType: "address"
28
+ }
29
+ ],
30
+ stateMutability: "view"
31
+ },
32
+ {
33
+ type: "function",
34
+ name: "claim",
35
+ inputs: [
36
+ {
37
+ name: "amountUSD",
38
+ type: "uint256",
39
+ internalType: "uint256"
40
+ }
41
+ ],
42
+ outputs: [],
43
+ stateMutability: "nonpayable"
44
+ },
45
+ {
46
+ type: "function",
47
+ name: "claim",
48
+ inputs: [],
49
+ outputs: [],
50
+ stateMutability: "nonpayable"
51
+ },
52
+ {
53
+ type: "function",
54
+ name: "claim",
55
+ inputs: [
56
+ {
57
+ name: "claims",
58
+ type: "tuple[]",
59
+ internalType: "struct TokenClaim[]",
60
+ components: [
61
+ {
62
+ name: "token",
63
+ type: "address",
64
+ internalType: "address"
65
+ },
66
+ {
67
+ name: "amount",
68
+ type: "uint256",
69
+ internalType: "uint256"
70
+ }
71
+ ]
72
+ }
73
+ ],
74
+ outputs: [],
75
+ stateMutability: "nonpayable"
76
+ },
77
+ {
78
+ type: "function",
79
+ name: "getAssets",
80
+ inputs: [],
81
+ outputs: [
82
+ {
83
+ name: "",
84
+ type: "address[]",
85
+ internalType: "address[]"
86
+ }
87
+ ],
88
+ stateMutability: "view"
89
+ },
90
+ {
91
+ type: "function",
92
+ name: "hasClaimed",
93
+ inputs: [
94
+ {
95
+ name: "user",
96
+ type: "address",
97
+ internalType: "address"
98
+ }
99
+ ],
100
+ outputs: [
101
+ {
102
+ name: "",
103
+ type: "bool",
104
+ internalType: "bool"
105
+ }
106
+ ],
107
+ stateMutability: "view"
108
+ },
109
+ {
110
+ type: "function",
111
+ name: "minAmountUSD",
112
+ inputs: [],
113
+ outputs: [
114
+ {
115
+ name: "",
116
+ type: "uint256",
117
+ internalType: "uint256"
118
+ }
119
+ ],
120
+ stateMutability: "view"
121
+ },
122
+ {
123
+ type: "function",
124
+ name: "owner",
125
+ inputs: [],
126
+ outputs: [
127
+ {
128
+ name: "",
129
+ type: "address",
130
+ internalType: "address"
131
+ }
132
+ ],
133
+ stateMutability: "view"
134
+ },
135
+ {
136
+ type: "function",
137
+ name: "prices",
138
+ inputs: [
139
+ {
140
+ name: "",
141
+ type: "address",
142
+ internalType: "address"
143
+ }
144
+ ],
145
+ outputs: [
146
+ {
147
+ name: "",
148
+ type: "uint256",
149
+ internalType: "uint256"
150
+ }
151
+ ],
152
+ stateMutability: "view"
153
+ },
154
+ {
155
+ type: "function",
156
+ name: "scales",
157
+ inputs: [
158
+ {
159
+ name: "",
160
+ type: "address",
161
+ internalType: "address"
162
+ }
163
+ ],
164
+ outputs: [
165
+ {
166
+ name: "",
167
+ type: "uint256",
168
+ internalType: "uint256"
169
+ }
170
+ ],
171
+ stateMutability: "view"
172
+ }
173
+ ];
174
+ const iOnchainExecutionIdAbi = [
175
+ {
176
+ type: "function",
177
+ name: "deployer",
178
+ inputs: [],
179
+ outputs: [{ name: "", type: "string", internalType: "string" }],
180
+ stateMutability: "view"
181
+ },
182
+ {
183
+ type: "function",
184
+ name: "executionId",
185
+ inputs: [],
186
+ outputs: [{ name: "", type: "string", internalType: "string" }],
187
+ stateMutability: "view"
188
+ },
189
+ {
190
+ type: "function",
191
+ name: "forkAlias",
192
+ inputs: [],
193
+ outputs: [{ name: "", type: "string", internalType: "string" }],
194
+ stateMutability: "view"
195
+ },
196
+ {
197
+ type: "function",
198
+ name: "info",
199
+ inputs: [],
200
+ outputs: [
201
+ {
202
+ name: "",
203
+ type: "tuple",
204
+ internalType: "struct ExecutionId.Info",
205
+ components: [
206
+ { name: "deployer", type: "string", internalType: "string" },
207
+ { name: "executionId", type: "string", internalType: "string" },
208
+ { name: "forkAlias", type: "string", internalType: "string" }
209
+ ]
210
+ }
211
+ ],
212
+ stateMutability: "view"
213
+ }
214
+ ];
12
215
  export {
216
+ faucetAbi,
13
217
  iDegenNftv2Abi,
218
+ iOnchainExecutionIdAbi,
14
219
  iOwnableAbi,
15
220
  iaclTraitAbi
16
221
  };
@@ -1,14 +1,6 @@
1
- import {
2
- parseAbi
3
- } from "viem";
4
1
  import { readContract } from "viem/actions";
5
2
  import { formatBN } from "../sdk/index.js";
6
- const faucetAbi = parseAbi([
7
- "function minAmountUSD() external view returns (uint256)",
8
- "function claim() external",
9
- "function claim(uint256 amountUSD) external",
10
- "function claim((address token, uint256 amount)[] claims) external"
11
- ]);
3
+ import { faucetAbi } from "./abi.js";
12
4
  async function claimFromFaucet(opts) {
13
5
  const {
14
6
  sdk,
@@ -1,4 +1,5 @@
1
1
  export * from "./AccountOpener.js";
2
+ export * from "./abi.js";
2
3
  export * from "./calcLiquidatableLTs.js";
3
4
  export * from "./claimDSToken.js";
4
5
  export * from "./claimFromFaucet.js";
@@ -37,3 +37,182 @@ export declare const iDegenNftv2Abi: readonly [{
37
37
  }];
38
38
  readonly outputs: readonly [];
39
39
  }];
40
+ export declare const faucetAbi: readonly [{
41
+ readonly type: "function";
42
+ readonly name: "assets";
43
+ readonly inputs: readonly [{
44
+ readonly name: "";
45
+ readonly type: "uint256";
46
+ readonly internalType: "uint256";
47
+ }];
48
+ readonly outputs: readonly [{
49
+ readonly name: "";
50
+ readonly type: "address";
51
+ readonly internalType: "address";
52
+ }];
53
+ readonly stateMutability: "view";
54
+ }, {
55
+ readonly type: "function";
56
+ readonly name: "claim";
57
+ readonly inputs: readonly [{
58
+ readonly name: "amountUSD";
59
+ readonly type: "uint256";
60
+ readonly internalType: "uint256";
61
+ }];
62
+ readonly outputs: readonly [];
63
+ readonly stateMutability: "nonpayable";
64
+ }, {
65
+ readonly type: "function";
66
+ readonly name: "claim";
67
+ readonly inputs: readonly [];
68
+ readonly outputs: readonly [];
69
+ readonly stateMutability: "nonpayable";
70
+ }, {
71
+ readonly type: "function";
72
+ readonly name: "claim";
73
+ readonly inputs: readonly [{
74
+ readonly name: "claims";
75
+ readonly type: "tuple[]";
76
+ readonly internalType: "struct TokenClaim[]";
77
+ readonly components: readonly [{
78
+ readonly name: "token";
79
+ readonly type: "address";
80
+ readonly internalType: "address";
81
+ }, {
82
+ readonly name: "amount";
83
+ readonly type: "uint256";
84
+ readonly internalType: "uint256";
85
+ }];
86
+ }];
87
+ readonly outputs: readonly [];
88
+ readonly stateMutability: "nonpayable";
89
+ }, {
90
+ readonly type: "function";
91
+ readonly name: "getAssets";
92
+ readonly inputs: readonly [];
93
+ readonly outputs: readonly [{
94
+ readonly name: "";
95
+ readonly type: "address[]";
96
+ readonly internalType: "address[]";
97
+ }];
98
+ readonly stateMutability: "view";
99
+ }, {
100
+ readonly type: "function";
101
+ readonly name: "hasClaimed";
102
+ readonly inputs: readonly [{
103
+ readonly name: "user";
104
+ readonly type: "address";
105
+ readonly internalType: "address";
106
+ }];
107
+ readonly outputs: readonly [{
108
+ readonly name: "";
109
+ readonly type: "bool";
110
+ readonly internalType: "bool";
111
+ }];
112
+ readonly stateMutability: "view";
113
+ }, {
114
+ readonly type: "function";
115
+ readonly name: "minAmountUSD";
116
+ readonly inputs: readonly [];
117
+ readonly outputs: readonly [{
118
+ readonly name: "";
119
+ readonly type: "uint256";
120
+ readonly internalType: "uint256";
121
+ }];
122
+ readonly stateMutability: "view";
123
+ }, {
124
+ readonly type: "function";
125
+ readonly name: "owner";
126
+ readonly inputs: readonly [];
127
+ readonly outputs: readonly [{
128
+ readonly name: "";
129
+ readonly type: "address";
130
+ readonly internalType: "address";
131
+ }];
132
+ readonly stateMutability: "view";
133
+ }, {
134
+ readonly type: "function";
135
+ readonly name: "prices";
136
+ readonly inputs: readonly [{
137
+ readonly name: "";
138
+ readonly type: "address";
139
+ readonly internalType: "address";
140
+ }];
141
+ readonly outputs: readonly [{
142
+ readonly name: "";
143
+ readonly type: "uint256";
144
+ readonly internalType: "uint256";
145
+ }];
146
+ readonly stateMutability: "view";
147
+ }, {
148
+ readonly type: "function";
149
+ readonly name: "scales";
150
+ readonly inputs: readonly [{
151
+ readonly name: "";
152
+ readonly type: "address";
153
+ readonly internalType: "address";
154
+ }];
155
+ readonly outputs: readonly [{
156
+ readonly name: "";
157
+ readonly type: "uint256";
158
+ readonly internalType: "uint256";
159
+ }];
160
+ readonly stateMutability: "view";
161
+ }];
162
+ /**
163
+ * This contract is deployed on testnets and contains testnet executionId and forkAlias
164
+ */
165
+ export declare const iOnchainExecutionIdAbi: readonly [{
166
+ readonly type: "function";
167
+ readonly name: "deployer";
168
+ readonly inputs: readonly [];
169
+ readonly outputs: readonly [{
170
+ readonly name: "";
171
+ readonly type: "string";
172
+ readonly internalType: "string";
173
+ }];
174
+ readonly stateMutability: "view";
175
+ }, {
176
+ readonly type: "function";
177
+ readonly name: "executionId";
178
+ readonly inputs: readonly [];
179
+ readonly outputs: readonly [{
180
+ readonly name: "";
181
+ readonly type: "string";
182
+ readonly internalType: "string";
183
+ }];
184
+ readonly stateMutability: "view";
185
+ }, {
186
+ readonly type: "function";
187
+ readonly name: "forkAlias";
188
+ readonly inputs: readonly [];
189
+ readonly outputs: readonly [{
190
+ readonly name: "";
191
+ readonly type: "string";
192
+ readonly internalType: "string";
193
+ }];
194
+ readonly stateMutability: "view";
195
+ }, {
196
+ readonly type: "function";
197
+ readonly name: "info";
198
+ readonly inputs: readonly [];
199
+ readonly outputs: readonly [{
200
+ readonly name: "";
201
+ readonly type: "tuple";
202
+ readonly internalType: "struct ExecutionId.Info";
203
+ readonly components: readonly [{
204
+ readonly name: "deployer";
205
+ readonly type: "string";
206
+ readonly internalType: "string";
207
+ }, {
208
+ readonly name: "executionId";
209
+ readonly type: "string";
210
+ readonly internalType: "string";
211
+ }, {
212
+ readonly name: "forkAlias";
213
+ readonly type: "string";
214
+ readonly internalType: "string";
215
+ }];
216
+ }];
217
+ readonly stateMutability: "view";
218
+ }];
@@ -1,4 +1,4 @@
1
- import { type Account, type Address, type PublicClient, type WalletClient } from "viem";
1
+ import type { Account, Address, PublicClient, WalletClient } from "viem";
2
2
  import { type ILogger, type OnchainSDK } from "../sdk/index.js";
3
3
  interface TokenClaim {
4
4
  token: Address;
@@ -1,4 +1,5 @@
1
1
  export * from "./AccountOpener.js";
2
+ export * from "./abi.js";
2
3
  export * from "./calcLiquidatableLTs.js";
3
4
  export * from "./claimDSToken.js";
4
5
  export * from "./claimFromFaucet.js";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gearbox-protocol/sdk",
3
- "version": "14.11.1",
3
+ "version": "14.11.3",
4
4
  "description": "Gearbox SDK",
5
5
  "license": "MIT",
6
6
  "repository": {