fibx 0.3.4 → 0.3.6
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/README.md +24 -3
- package/dist/commands/config/index.d.ts +3 -0
- package/dist/commands/config/index.d.ts.map +1 -0
- package/dist/commands/config/index.js +65 -0
- package/dist/commands/config/index.js.map +1 -0
- package/dist/commands/defi/aave.d.ts.map +1 -1
- package/dist/commands/defi/aave.js +18 -61
- package/dist/commands/defi/aave.js.map +1 -1
- package/dist/commands/trade/swap.d.ts.map +1 -1
- package/dist/commands/trade/swap.js +50 -1
- package/dist/commands/trade/swap.js.map +1 -1
- package/dist/index.js +3 -3
- package/dist/index.js.map +1 -1
- package/dist/lib/errors.d.ts +1 -0
- package/dist/lib/errors.d.ts.map +1 -1
- package/dist/lib/errors.js +1 -0
- package/dist/lib/errors.js.map +1 -1
- package/dist/services/chain/client.d.ts +1 -1
- package/dist/services/chain/constants.d.ts.map +1 -1
- package/dist/services/chain/constants.js +9 -0
- package/dist/services/chain/constants.js.map +1 -1
- package/dist/services/chain/erc20.d.ts +215 -0
- package/dist/services/chain/erc20.d.ts.map +1 -1
- package/dist/services/chain/erc20.js +166 -0
- package/dist/services/chain/erc20.js.map +1 -1
- package/dist/services/config/config.d.ts +18 -0
- package/dist/services/config/config.d.ts.map +1 -0
- package/dist/services/config/config.js +67 -0
- package/dist/services/config/config.js.map +1 -0
- package/dist/services/defi/aave.d.ts +13 -0
- package/dist/services/defi/aave.d.ts.map +1 -1
- package/dist/services/defi/aave.js +159 -15
- package/dist/services/defi/aave.js.map +1 -1
- package/dist/services/privy/account.d.ts.map +1 -1
- package/dist/services/privy/account.js +14 -6
- package/dist/services/privy/account.js.map +1 -1
- package/package.json +1 -1
|
@@ -60,4 +60,219 @@ export declare const ERC20_ABI: readonly [{
|
|
|
60
60
|
export declare function getERC20Balance(client: PublicClient, tokenAddress: Address, walletAddress: Address): Promise<bigint>;
|
|
61
61
|
export declare function encodeApprove(spender: Address, amount: bigint): `0x${string}`;
|
|
62
62
|
export declare function getAllowance(client: PublicClient, tokenAddress: Address, owner: Address, spender: Address): Promise<bigint>;
|
|
63
|
+
export declare const WETH_ABI: readonly [{
|
|
64
|
+
readonly constant: true;
|
|
65
|
+
readonly inputs: readonly [];
|
|
66
|
+
readonly name: "name";
|
|
67
|
+
readonly outputs: readonly [{
|
|
68
|
+
readonly name: "";
|
|
69
|
+
readonly type: "string";
|
|
70
|
+
}];
|
|
71
|
+
readonly payable: false;
|
|
72
|
+
readonly stateMutability: "view";
|
|
73
|
+
readonly type: "function";
|
|
74
|
+
}, {
|
|
75
|
+
readonly constant: false;
|
|
76
|
+
readonly inputs: readonly [{
|
|
77
|
+
readonly name: "guy";
|
|
78
|
+
readonly type: "address";
|
|
79
|
+
}, {
|
|
80
|
+
readonly name: "wad";
|
|
81
|
+
readonly type: "uint256";
|
|
82
|
+
}];
|
|
83
|
+
readonly name: "approve";
|
|
84
|
+
readonly outputs: readonly [{
|
|
85
|
+
readonly name: "";
|
|
86
|
+
readonly type: "bool";
|
|
87
|
+
}];
|
|
88
|
+
readonly payable: false;
|
|
89
|
+
readonly stateMutability: "nonpayable";
|
|
90
|
+
readonly type: "function";
|
|
91
|
+
}, {
|
|
92
|
+
readonly constant: true;
|
|
93
|
+
readonly inputs: readonly [];
|
|
94
|
+
readonly name: "totalSupply";
|
|
95
|
+
readonly outputs: readonly [{
|
|
96
|
+
readonly name: "";
|
|
97
|
+
readonly type: "uint256";
|
|
98
|
+
}];
|
|
99
|
+
readonly payable: false;
|
|
100
|
+
readonly stateMutability: "view";
|
|
101
|
+
readonly type: "function";
|
|
102
|
+
}, {
|
|
103
|
+
readonly constant: false;
|
|
104
|
+
readonly inputs: readonly [{
|
|
105
|
+
readonly name: "src";
|
|
106
|
+
readonly type: "address";
|
|
107
|
+
}, {
|
|
108
|
+
readonly name: "dst";
|
|
109
|
+
readonly type: "address";
|
|
110
|
+
}, {
|
|
111
|
+
readonly name: "wad";
|
|
112
|
+
readonly type: "uint256";
|
|
113
|
+
}];
|
|
114
|
+
readonly name: "transferFrom";
|
|
115
|
+
readonly outputs: readonly [{
|
|
116
|
+
readonly name: "";
|
|
117
|
+
readonly type: "bool";
|
|
118
|
+
}];
|
|
119
|
+
readonly payable: false;
|
|
120
|
+
readonly stateMutability: "nonpayable";
|
|
121
|
+
readonly type: "function";
|
|
122
|
+
}, {
|
|
123
|
+
readonly constant: false;
|
|
124
|
+
readonly inputs: readonly [{
|
|
125
|
+
readonly name: "wad";
|
|
126
|
+
readonly type: "uint256";
|
|
127
|
+
}];
|
|
128
|
+
readonly name: "withdraw";
|
|
129
|
+
readonly outputs: readonly [];
|
|
130
|
+
readonly payable: false;
|
|
131
|
+
readonly stateMutability: "nonpayable";
|
|
132
|
+
readonly type: "function";
|
|
133
|
+
}, {
|
|
134
|
+
readonly constant: true;
|
|
135
|
+
readonly inputs: readonly [];
|
|
136
|
+
readonly name: "decimals";
|
|
137
|
+
readonly outputs: readonly [{
|
|
138
|
+
readonly name: "";
|
|
139
|
+
readonly type: "uint8";
|
|
140
|
+
}];
|
|
141
|
+
readonly payable: false;
|
|
142
|
+
readonly stateMutability: "view";
|
|
143
|
+
readonly type: "function";
|
|
144
|
+
}, {
|
|
145
|
+
readonly constant: true;
|
|
146
|
+
readonly inputs: readonly [{
|
|
147
|
+
readonly name: "";
|
|
148
|
+
readonly type: "address";
|
|
149
|
+
}];
|
|
150
|
+
readonly name: "balanceOf";
|
|
151
|
+
readonly outputs: readonly [{
|
|
152
|
+
readonly name: "";
|
|
153
|
+
readonly type: "uint256";
|
|
154
|
+
}];
|
|
155
|
+
readonly payable: false;
|
|
156
|
+
readonly stateMutability: "view";
|
|
157
|
+
readonly type: "function";
|
|
158
|
+
}, {
|
|
159
|
+
readonly constant: true;
|
|
160
|
+
readonly inputs: readonly [];
|
|
161
|
+
readonly name: "symbol";
|
|
162
|
+
readonly outputs: readonly [{
|
|
163
|
+
readonly name: "";
|
|
164
|
+
readonly type: "string";
|
|
165
|
+
}];
|
|
166
|
+
readonly payable: false;
|
|
167
|
+
readonly stateMutability: "view";
|
|
168
|
+
readonly type: "function";
|
|
169
|
+
}, {
|
|
170
|
+
readonly constant: false;
|
|
171
|
+
readonly inputs: readonly [{
|
|
172
|
+
readonly name: "dst";
|
|
173
|
+
readonly type: "address";
|
|
174
|
+
}, {
|
|
175
|
+
readonly name: "wad";
|
|
176
|
+
readonly type: "uint256";
|
|
177
|
+
}];
|
|
178
|
+
readonly name: "transfer";
|
|
179
|
+
readonly outputs: readonly [{
|
|
180
|
+
readonly name: "";
|
|
181
|
+
readonly type: "bool";
|
|
182
|
+
}];
|
|
183
|
+
readonly payable: false;
|
|
184
|
+
readonly stateMutability: "nonpayable";
|
|
185
|
+
readonly type: "function";
|
|
186
|
+
}, {
|
|
187
|
+
readonly constant: false;
|
|
188
|
+
readonly inputs: readonly [];
|
|
189
|
+
readonly name: "deposit";
|
|
190
|
+
readonly outputs: readonly [];
|
|
191
|
+
readonly payable: true;
|
|
192
|
+
readonly stateMutability: "payable";
|
|
193
|
+
readonly type: "function";
|
|
194
|
+
}, {
|
|
195
|
+
readonly constant: true;
|
|
196
|
+
readonly inputs: readonly [{
|
|
197
|
+
readonly name: "";
|
|
198
|
+
readonly type: "address";
|
|
199
|
+
}, {
|
|
200
|
+
readonly name: "";
|
|
201
|
+
readonly type: "address";
|
|
202
|
+
}];
|
|
203
|
+
readonly name: "allowance";
|
|
204
|
+
readonly outputs: readonly [{
|
|
205
|
+
readonly name: "";
|
|
206
|
+
readonly type: "uint256";
|
|
207
|
+
}];
|
|
208
|
+
readonly payable: false;
|
|
209
|
+
readonly stateMutability: "view";
|
|
210
|
+
readonly type: "function";
|
|
211
|
+
}, {
|
|
212
|
+
readonly payable: true;
|
|
213
|
+
readonly stateMutability: "payable";
|
|
214
|
+
readonly type: "fallback";
|
|
215
|
+
}, {
|
|
216
|
+
readonly anonymous: false;
|
|
217
|
+
readonly inputs: readonly [{
|
|
218
|
+
readonly indexed: true;
|
|
219
|
+
readonly name: "src";
|
|
220
|
+
readonly type: "address";
|
|
221
|
+
}, {
|
|
222
|
+
readonly indexed: true;
|
|
223
|
+
readonly name: "guy";
|
|
224
|
+
readonly type: "address";
|
|
225
|
+
}, {
|
|
226
|
+
readonly indexed: false;
|
|
227
|
+
readonly name: "wad";
|
|
228
|
+
readonly type: "uint256";
|
|
229
|
+
}];
|
|
230
|
+
readonly name: "Approval";
|
|
231
|
+
readonly type: "event";
|
|
232
|
+
}, {
|
|
233
|
+
readonly anonymous: false;
|
|
234
|
+
readonly inputs: readonly [{
|
|
235
|
+
readonly indexed: true;
|
|
236
|
+
readonly name: "src";
|
|
237
|
+
readonly type: "address";
|
|
238
|
+
}, {
|
|
239
|
+
readonly indexed: true;
|
|
240
|
+
readonly name: "dst";
|
|
241
|
+
readonly type: "address";
|
|
242
|
+
}, {
|
|
243
|
+
readonly indexed: false;
|
|
244
|
+
readonly name: "wad";
|
|
245
|
+
readonly type: "uint256";
|
|
246
|
+
}];
|
|
247
|
+
readonly name: "Transfer";
|
|
248
|
+
readonly type: "event";
|
|
249
|
+
}, {
|
|
250
|
+
readonly anonymous: false;
|
|
251
|
+
readonly inputs: readonly [{
|
|
252
|
+
readonly indexed: true;
|
|
253
|
+
readonly name: "dst";
|
|
254
|
+
readonly type: "address";
|
|
255
|
+
}, {
|
|
256
|
+
readonly indexed: false;
|
|
257
|
+
readonly name: "wad";
|
|
258
|
+
readonly type: "uint256";
|
|
259
|
+
}];
|
|
260
|
+
readonly name: "Deposit";
|
|
261
|
+
readonly type: "event";
|
|
262
|
+
}, {
|
|
263
|
+
readonly anonymous: false;
|
|
264
|
+
readonly inputs: readonly [{
|
|
265
|
+
readonly indexed: true;
|
|
266
|
+
readonly name: "src";
|
|
267
|
+
readonly type: "address";
|
|
268
|
+
}, {
|
|
269
|
+
readonly indexed: false;
|
|
270
|
+
readonly name: "wad";
|
|
271
|
+
readonly type: "uint256";
|
|
272
|
+
}];
|
|
273
|
+
readonly name: "Withdrawal";
|
|
274
|
+
readonly type: "event";
|
|
275
|
+
}];
|
|
276
|
+
export declare function encodeDeposit(): `0x${string}`;
|
|
277
|
+
export declare function encodeWithdraw(amount: bigint): `0x${string}`;
|
|
63
278
|
//# sourceMappingURL=erc20.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc20.d.ts","sourceRoot":"","sources":["../../../src/services/chain/erc20.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAE3E,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCZ,CAAC;AAEX,wBAAsB,eAAe,CACpC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,OAAO,EACrB,aAAa,EAAE,OAAO,GACpB,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,CAM7E;AAED,wBAAsB,YAAY,CACjC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,OAAO,EACrB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,OAAO,GACd,OAAO,CAAC,MAAM,CAAC,CAOjB"}
|
|
1
|
+
{"version":3,"file":"erc20.d.ts","sourceRoot":"","sources":["../../../src/services/chain/erc20.ts"],"names":[],"mappings":"AAAA,OAAO,EAAsB,KAAK,OAAO,EAAE,KAAK,YAAY,EAAE,MAAM,MAAM,CAAC;AAE3E,eAAO,MAAM,SAAS;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAsCZ,CAAC;AAEX,wBAAsB,eAAe,CACpC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,OAAO,EACrB,aAAa,EAAE,OAAO,GACpB,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED,wBAAgB,aAAa,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,CAM7E;AAED,wBAAsB,YAAY,CACjC,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,OAAO,EACrB,KAAK,EAAE,OAAO,EACd,OAAO,EAAE,OAAO,GACd,OAAO,CAAC,MAAM,CAAC,CAOjB;AAED,eAAO,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;EAwJX,CAAC;AAEX,wBAAgB,aAAa,IAAI,KAAK,MAAM,EAAE,CAK7C;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,GAAG,KAAK,MAAM,EAAE,CAM5D"}
|
|
@@ -61,4 +61,170 @@ export async function getAllowance(client, tokenAddress, owner, spender) {
|
|
|
61
61
|
args: [owner, spender],
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
+
export const WETH_ABI = [
|
|
65
|
+
{
|
|
66
|
+
constant: true,
|
|
67
|
+
inputs: [],
|
|
68
|
+
name: "name",
|
|
69
|
+
outputs: [{ name: "", type: "string" }],
|
|
70
|
+
payable: false,
|
|
71
|
+
stateMutability: "view",
|
|
72
|
+
type: "function",
|
|
73
|
+
},
|
|
74
|
+
{
|
|
75
|
+
constant: false,
|
|
76
|
+
inputs: [
|
|
77
|
+
{ name: "guy", type: "address" },
|
|
78
|
+
{ name: "wad", type: "uint256" },
|
|
79
|
+
],
|
|
80
|
+
name: "approve",
|
|
81
|
+
outputs: [{ name: "", type: "bool" }],
|
|
82
|
+
payable: false,
|
|
83
|
+
stateMutability: "nonpayable",
|
|
84
|
+
type: "function",
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
constant: true,
|
|
88
|
+
inputs: [],
|
|
89
|
+
name: "totalSupply",
|
|
90
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
91
|
+
payable: false,
|
|
92
|
+
stateMutability: "view",
|
|
93
|
+
type: "function",
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
constant: false,
|
|
97
|
+
inputs: [
|
|
98
|
+
{ name: "src", type: "address" },
|
|
99
|
+
{ name: "dst", type: "address" },
|
|
100
|
+
{ name: "wad", type: "uint256" },
|
|
101
|
+
],
|
|
102
|
+
name: "transferFrom",
|
|
103
|
+
outputs: [{ name: "", type: "bool" }],
|
|
104
|
+
payable: false,
|
|
105
|
+
stateMutability: "nonpayable",
|
|
106
|
+
type: "function",
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
constant: false,
|
|
110
|
+
inputs: [{ name: "wad", type: "uint256" }],
|
|
111
|
+
name: "withdraw",
|
|
112
|
+
outputs: [],
|
|
113
|
+
payable: false,
|
|
114
|
+
stateMutability: "nonpayable",
|
|
115
|
+
type: "function",
|
|
116
|
+
},
|
|
117
|
+
{
|
|
118
|
+
constant: true,
|
|
119
|
+
inputs: [],
|
|
120
|
+
name: "decimals",
|
|
121
|
+
outputs: [{ name: "", type: "uint8" }],
|
|
122
|
+
payable: false,
|
|
123
|
+
stateMutability: "view",
|
|
124
|
+
type: "function",
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
constant: true,
|
|
128
|
+
inputs: [{ name: "", type: "address" }],
|
|
129
|
+
name: "balanceOf",
|
|
130
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
131
|
+
payable: false,
|
|
132
|
+
stateMutability: "view",
|
|
133
|
+
type: "function",
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
constant: true,
|
|
137
|
+
inputs: [],
|
|
138
|
+
name: "symbol",
|
|
139
|
+
outputs: [{ name: "", type: "string" }],
|
|
140
|
+
payable: false,
|
|
141
|
+
stateMutability: "view",
|
|
142
|
+
type: "function",
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
constant: false,
|
|
146
|
+
inputs: [
|
|
147
|
+
{ name: "dst", type: "address" },
|
|
148
|
+
{ name: "wad", type: "uint256" },
|
|
149
|
+
],
|
|
150
|
+
name: "transfer",
|
|
151
|
+
outputs: [{ name: "", type: "bool" }],
|
|
152
|
+
payable: false,
|
|
153
|
+
stateMutability: "nonpayable",
|
|
154
|
+
type: "function",
|
|
155
|
+
},
|
|
156
|
+
{
|
|
157
|
+
constant: false,
|
|
158
|
+
inputs: [],
|
|
159
|
+
name: "deposit",
|
|
160
|
+
outputs: [],
|
|
161
|
+
payable: true,
|
|
162
|
+
stateMutability: "payable",
|
|
163
|
+
type: "function",
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
constant: true,
|
|
167
|
+
inputs: [
|
|
168
|
+
{ name: "", type: "address" },
|
|
169
|
+
{ name: "", type: "address" },
|
|
170
|
+
],
|
|
171
|
+
name: "allowance",
|
|
172
|
+
outputs: [{ name: "", type: "uint256" }],
|
|
173
|
+
payable: false,
|
|
174
|
+
stateMutability: "view",
|
|
175
|
+
type: "function",
|
|
176
|
+
},
|
|
177
|
+
{ payable: true, stateMutability: "payable", type: "fallback" },
|
|
178
|
+
{
|
|
179
|
+
anonymous: false,
|
|
180
|
+
inputs: [
|
|
181
|
+
{ indexed: true, name: "src", type: "address" },
|
|
182
|
+
{ indexed: true, name: "guy", type: "address" },
|
|
183
|
+
{ indexed: false, name: "wad", type: "uint256" },
|
|
184
|
+
],
|
|
185
|
+
name: "Approval",
|
|
186
|
+
type: "event",
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
anonymous: false,
|
|
190
|
+
inputs: [
|
|
191
|
+
{ indexed: true, name: "src", type: "address" },
|
|
192
|
+
{ indexed: true, name: "dst", type: "address" },
|
|
193
|
+
{ indexed: false, name: "wad", type: "uint256" },
|
|
194
|
+
],
|
|
195
|
+
name: "Transfer",
|
|
196
|
+
type: "event",
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
anonymous: false,
|
|
200
|
+
inputs: [
|
|
201
|
+
{ indexed: true, name: "dst", type: "address" },
|
|
202
|
+
{ indexed: false, name: "wad", type: "uint256" },
|
|
203
|
+
],
|
|
204
|
+
name: "Deposit",
|
|
205
|
+
type: "event",
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
anonymous: false,
|
|
209
|
+
inputs: [
|
|
210
|
+
{ indexed: true, name: "src", type: "address" },
|
|
211
|
+
{ indexed: false, name: "wad", type: "uint256" },
|
|
212
|
+
],
|
|
213
|
+
name: "Withdrawal",
|
|
214
|
+
type: "event",
|
|
215
|
+
},
|
|
216
|
+
];
|
|
217
|
+
export function encodeDeposit() {
|
|
218
|
+
return encodeFunctionData({
|
|
219
|
+
abi: WETH_ABI,
|
|
220
|
+
functionName: "deposit",
|
|
221
|
+
});
|
|
222
|
+
}
|
|
223
|
+
export function encodeWithdraw(amount) {
|
|
224
|
+
return encodeFunctionData({
|
|
225
|
+
abi: WETH_ABI,
|
|
226
|
+
functionName: "withdraw",
|
|
227
|
+
args: [amount],
|
|
228
|
+
});
|
|
229
|
+
}
|
|
64
230
|
//# sourceMappingURL=erc20.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"erc20.js","sourceRoot":"","sources":["../../../src/services/chain/erc20.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAmC,MAAM,MAAM,CAAC;AAE3E,MAAM,CAAC,MAAM,SAAS,GAAG;IACxB;QACC,IAAI,EAAE,WAAW;QACjB,IAAI,EAAE,UAAU;QAChB,eAAe,EAAE,MAAM;QACvB,MAAM,EAAE,CAAC,EAAE,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,SAAS,EAAE,CAAC;QAC9C,OAAO,EAAE,CAAC,EAAE,IAAI,EAAE,EAAE,EAAE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J,CAAC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
declare const configSchema: z.ZodObject<{
|
|
3
|
+
rpcUrls: z.ZodDefault<z.ZodRecord<z.ZodString, z.ZodString>>;
|
|
4
|
+
}, z.core.$strip>;
|
|
5
|
+
export type Config = z.infer<typeof configSchema>;
|
|
6
|
+
export declare class ConfigService {
|
|
7
|
+
private static instance;
|
|
8
|
+
private constructor();
|
|
9
|
+
static getInstance(): ConfigService;
|
|
10
|
+
load(): Config;
|
|
11
|
+
save(config: Config): void;
|
|
12
|
+
getRpcUrl(chain: string): string | undefined;
|
|
13
|
+
setRpcUrl(chain: string, url: string): void;
|
|
14
|
+
getConfig(): Config;
|
|
15
|
+
}
|
|
16
|
+
export declare const configService: ConfigService;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/services/config/config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,QAAA,MAAM,YAAY;;iBAEhB,CAAC;AAEH,MAAM,MAAM,MAAM,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AAQlD,qBAAa,aAAa;IACzB,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAgB;IAEvC,OAAO;WAEO,WAAW,IAAI,aAAa;IAOnC,IAAI,IAAI,MAAM;IAoBd,IAAI,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI;IAY1B,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS;IAK5C,SAAS,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,IAAI;IAM3C,SAAS,IAAI,MAAM;CAG1B;AAED,eAAO,MAAM,aAAa,eAA8B,CAAC"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { readFileSync, writeFileSync, mkdirSync, existsSync } from "node:fs";
|
|
2
|
+
import { join, dirname } from "node:path";
|
|
3
|
+
import { z } from "zod";
|
|
4
|
+
import { paths } from "../../lib/config.js";
|
|
5
|
+
const configSchema = z.object({
|
|
6
|
+
rpcUrls: z.record(z.string(), z.string()).default({}), // chainName -> url
|
|
7
|
+
});
|
|
8
|
+
function getConfigPath() {
|
|
9
|
+
return join(paths.config, "config.json");
|
|
10
|
+
}
|
|
11
|
+
let cachedConfig = null;
|
|
12
|
+
export class ConfigService {
|
|
13
|
+
static instance;
|
|
14
|
+
constructor() { }
|
|
15
|
+
static getInstance() {
|
|
16
|
+
if (!ConfigService.instance) {
|
|
17
|
+
ConfigService.instance = new ConfigService();
|
|
18
|
+
}
|
|
19
|
+
return ConfigService.instance;
|
|
20
|
+
}
|
|
21
|
+
load() {
|
|
22
|
+
if (cachedConfig)
|
|
23
|
+
return cachedConfig;
|
|
24
|
+
const filePath = getConfigPath();
|
|
25
|
+
try {
|
|
26
|
+
if (!existsSync(filePath)) {
|
|
27
|
+
return { rpcUrls: {} };
|
|
28
|
+
}
|
|
29
|
+
const raw = readFileSync(filePath, "utf-8");
|
|
30
|
+
const result = configSchema.safeParse(JSON.parse(raw));
|
|
31
|
+
if (result.success) {
|
|
32
|
+
cachedConfig = result.data;
|
|
33
|
+
return result.data;
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
// Ignore read errors, return default
|
|
38
|
+
}
|
|
39
|
+
return { rpcUrls: {} };
|
|
40
|
+
}
|
|
41
|
+
save(config) {
|
|
42
|
+
const filePath = getConfigPath();
|
|
43
|
+
try {
|
|
44
|
+
mkdirSync(dirname(filePath), { recursive: true });
|
|
45
|
+
configSchema.parse(config);
|
|
46
|
+
writeFileSync(filePath, JSON.stringify(config, null, 2), "utf-8");
|
|
47
|
+
cachedConfig = config;
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
console.error("Failed to save config:", error);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
getRpcUrl(chain) {
|
|
54
|
+
const config = this.load();
|
|
55
|
+
return config.rpcUrls[chain];
|
|
56
|
+
}
|
|
57
|
+
setRpcUrl(chain, url) {
|
|
58
|
+
const config = this.load();
|
|
59
|
+
config.rpcUrls[chain] = url;
|
|
60
|
+
this.save(config);
|
|
61
|
+
}
|
|
62
|
+
getConfig() {
|
|
63
|
+
return this.load();
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
export const configService = ConfigService.getInstance();
|
|
67
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../../src/services/config/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,aAAa,EAAE,SAAS,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AAC7E,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAE5C,MAAM,YAAY,GAAG,CAAC,CAAC,MAAM,CAAC;IAC7B,OAAO,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,OAAO,CAAC,EAAE,CAAC,EAAE,mBAAmB;CAC1E,CAAC,CAAC;AAIH,SAAS,aAAa;IACrB,OAAO,IAAI,CAAC,KAAK,CAAC,MAAM,EAAE,aAAa,CAAC,CAAC;AAC1C,CAAC;AAED,IAAI,YAAY,GAAkB,IAAI,CAAC;AAEvC,MAAM,OAAO,aAAa;IACjB,MAAM,CAAC,QAAQ,CAAgB;IAEvC,gBAAuB,CAAC;IAEjB,MAAM,CAAC,WAAW;QACxB,IAAI,CAAC,aAAa,CAAC,QAAQ,EAAE,CAA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CAAC,CAAC;QAChD,CAAC;IACF,CAAC;IAEM,SAAS,CAAC,KAAa;QAC7B,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC3B,OAAO,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IAC9B,CAAC;IAEM,SAAS,CAAC,KAAa,EAAE,GAAW;QAC1C,MAAM,MAAM,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;QAC3B,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,CAAC;QAC5B,IAAI,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACnB,CAAC;IAEM,SAAS;QACf,OAAO,IAAI,CAAC,IAAI,EAAE,CAAC;IACpB,CAAC;CACD;AAED,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAC,WAAW,EAAE,CAAC"}
|
|
@@ -28,6 +28,19 @@ export declare class AaveService {
|
|
|
28
28
|
repay(tokenAddress: Address, amountStr: string): Promise<Hash>;
|
|
29
29
|
private ensureWalletConnection;
|
|
30
30
|
private getTokenDecimals;
|
|
31
|
+
/**
|
|
32
|
+
* High-level method to repay debt, automatically wrapping ETH if needed.
|
|
33
|
+
*/
|
|
34
|
+
repayWithAutoWrap(tokenAddress: Address, amountStr: string, onStatus?: (status: string) => void): Promise<Hash>;
|
|
35
|
+
getAssetDebt(tokenAddress: Address): Promise<bigint>;
|
|
36
|
+
/**
|
|
37
|
+
* High-level method to supply assets, automatically wrapping ETH if needed.
|
|
38
|
+
*/
|
|
39
|
+
supplyWithAutoWrap(tokenAddress: Address, amountStr: string, onStatus?: (status: string) => void): Promise<Hash>;
|
|
40
|
+
/**
|
|
41
|
+
* High-level method to withdraw assets, optionally unwrapping WETH to ETH.
|
|
42
|
+
*/
|
|
43
|
+
withdrawWithAutoUnwrap(tokenAddress: Address, amountStr: string, unwrapToNative?: boolean, onStatus?: (status: string) => void): Promise<Hash>;
|
|
31
44
|
private waitForAllowance;
|
|
32
45
|
private getD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