@aztec/bot 0.86.0-starknet.1 → 0.87.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dest/base_bot.d.ts.map +1 -1
- package/dest/factory.js +3 -3
- package/dest/runner.js +4 -4
- package/package.json +14 -14
- package/src/base_bot.ts +5 -1
- package/src/factory.ts +3 -3
- package/src/runner.ts +4 -4
package/dest/base_bot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base_bot.d.ts","sourceRoot":"","sources":["../src/base_bot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,KAAK,iBAAiB,EACtB,MAAM,EACN,MAAM,EACN,SAAS,EACT,KAAK,MAAM,EAGZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,8BAAsB,OAAO;
|
|
1
|
+
{"version":3,"file":"base_bot.d.ts","sourceRoot":"","sources":["../src/base_bot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,WAAW,EAEX,KAAK,iBAAiB,EACtB,MAAM,EACN,MAAM,EACN,SAAS,EACT,KAAK,MAAM,EAGZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAE3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,8BAAsB,OAAO;aAOT,GAAG,EAAE,GAAG;aACR,MAAM,EAAE,MAAM;IACvB,MAAM,EAAE,SAAS;IAR1B,SAAS,CAAC,GAAG,mCAAuB;IAEpC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAK;IAC/B,SAAS,CAAC,SAAS,EAAE,MAAM,CAAK;IAEhC,SAAS,aACS,GAAG,EAAE,GAAG,EACR,MAAM,EAAE,MAAM,EACvB,MAAM,EAAE,SAAS;IAGb,GAAG,IAAI,OAAO,CAAC,SAAS,GAAG,MAAM,CAAC;IAoC/C,SAAS,CAAC,QAAQ,CAAC,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IAEnE,SAAS,CAAC,SAAS,CAAC,QAAQ,EAAE,SAAS,EAAE,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAKxE,SAAS,CAAC,iBAAiB,CAAC,GAAG,aAAa,EAAE,WAAW,EAAE,GAAG,iBAAiB;CAiBhF"}
|
package/dest/factory.js
CHANGED
|
@@ -206,9 +206,9 @@ export class BotFactory {
|
|
|
206
206
|
}
|
|
207
207
|
async fundAmm(wallet, amm, token0, token1, lpToken) {
|
|
208
208
|
const getPrivateBalances = ()=>Promise.all([
|
|
209
|
-
token0.methods.balance_of_private(wallet.getAddress()),
|
|
210
|
-
token1.methods.balance_of_private(wallet.getAddress()),
|
|
211
|
-
lpToken.methods.balance_of_private(wallet.getAddress())
|
|
209
|
+
token0.methods.balance_of_private(wallet.getAddress()).simulate(),
|
|
210
|
+
token1.methods.balance_of_private(wallet.getAddress()).simulate(),
|
|
211
|
+
lpToken.methods.balance_of_private(wallet.getAddress()).simulate()
|
|
212
212
|
]);
|
|
213
213
|
const nonce = Fr.random();
|
|
214
214
|
// keep some tokens for swapping
|
package/dest/runner.js
CHANGED
|
@@ -154,15 +154,15 @@ export class BotRunner {
|
|
|
154
154
|
}
|
|
155
155
|
async #work() {
|
|
156
156
|
if (this.config.maxPendingTxs > 0) {
|
|
157
|
-
const
|
|
158
|
-
if (
|
|
159
|
-
this.log.verbose(`Not sending bot tx since node has ${
|
|
157
|
+
const pendingTxCount = await this.node.getPendingTxCount();
|
|
158
|
+
if (pendingTxCount >= this.config.maxPendingTxs) {
|
|
159
|
+
this.log.verbose(`Not sending bot tx since node has ${pendingTxCount} pending txs`);
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
163
|
try {
|
|
164
164
|
await this.run();
|
|
165
|
-
} catch
|
|
165
|
+
} catch {
|
|
166
166
|
// Already logged in run()
|
|
167
167
|
if (this.config.maxConsecutiveErrors > 0 && this.consecutiveErrors >= this.config.maxConsecutiveErrors) {
|
|
168
168
|
this.log.error(`Too many errors bot is unhealthy`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/bot",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.87.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -50,16 +50,16 @@
|
|
|
50
50
|
]
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@aztec/accounts": "0.
|
|
54
|
-
"@aztec/aztec.js": "0.
|
|
55
|
-
"@aztec/entrypoints": "0.
|
|
56
|
-
"@aztec/ethereum": "0.
|
|
57
|
-
"@aztec/foundation": "0.
|
|
58
|
-
"@aztec/noir-contracts.js": "0.
|
|
59
|
-
"@aztec/noir-protocol-circuits-types": "0.
|
|
60
|
-
"@aztec/protocol-contracts": "0.
|
|
61
|
-
"@aztec/stdlib": "0.
|
|
62
|
-
"@aztec/telemetry-client": "0.
|
|
53
|
+
"@aztec/accounts": "0.87.0",
|
|
54
|
+
"@aztec/aztec.js": "0.87.0",
|
|
55
|
+
"@aztec/entrypoints": "0.87.0",
|
|
56
|
+
"@aztec/ethereum": "0.87.0",
|
|
57
|
+
"@aztec/foundation": "0.87.0",
|
|
58
|
+
"@aztec/noir-contracts.js": "0.87.0",
|
|
59
|
+
"@aztec/noir-protocol-circuits-types": "0.87.0",
|
|
60
|
+
"@aztec/protocol-contracts": "0.87.0",
|
|
61
|
+
"@aztec/stdlib": "0.87.0",
|
|
62
|
+
"@aztec/telemetry-client": "0.87.0",
|
|
63
63
|
"source-map-support": "^0.5.21",
|
|
64
64
|
"tslib": "^2.4.0",
|
|
65
65
|
"zod": "^3.23.8"
|
|
@@ -67,12 +67,12 @@
|
|
|
67
67
|
"devDependencies": {
|
|
68
68
|
"@jest/globals": "^29.5.0",
|
|
69
69
|
"@types/jest": "^29.5.0",
|
|
70
|
-
"@types/node": "^
|
|
70
|
+
"@types/node": "^22.15.17",
|
|
71
71
|
"@types/source-map-support": "^0.5.10",
|
|
72
72
|
"jest": "^29.5.0",
|
|
73
73
|
"jest-mock-extended": "^3.0.3",
|
|
74
74
|
"ts-node": "^10.9.1",
|
|
75
|
-
"typescript": "^5.
|
|
75
|
+
"typescript": "^5.3.3"
|
|
76
76
|
},
|
|
77
77
|
"files": [
|
|
78
78
|
"dest",
|
|
@@ -81,6 +81,6 @@
|
|
|
81
81
|
],
|
|
82
82
|
"types": "./dest/index.d.ts",
|
|
83
83
|
"engines": {
|
|
84
|
-
"node": ">=
|
|
84
|
+
"node": ">=20.10"
|
|
85
85
|
}
|
|
86
86
|
}
|
package/src/base_bot.ts
CHANGED
|
@@ -20,7 +20,11 @@ export abstract class BaseBot {
|
|
|
20
20
|
protected attempts: number = 0;
|
|
21
21
|
protected successes: number = 0;
|
|
22
22
|
|
|
23
|
-
protected constructor(
|
|
23
|
+
protected constructor(
|
|
24
|
+
public readonly pxe: PXE,
|
|
25
|
+
public readonly wallet: Wallet,
|
|
26
|
+
public config: BotConfig,
|
|
27
|
+
) {}
|
|
24
28
|
|
|
25
29
|
public async run(): Promise<TxReceipt | TxHash> {
|
|
26
30
|
this.attempts++;
|
package/src/factory.ts
CHANGED
|
@@ -238,9 +238,9 @@ export class BotFactory {
|
|
|
238
238
|
): Promise<void> {
|
|
239
239
|
const getPrivateBalances = () =>
|
|
240
240
|
Promise.all([
|
|
241
|
-
token0.methods.balance_of_private(wallet.getAddress()),
|
|
242
|
-
token1.methods.balance_of_private(wallet.getAddress()),
|
|
243
|
-
lpToken.methods.balance_of_private(wallet.getAddress()),
|
|
241
|
+
token0.methods.balance_of_private(wallet.getAddress()).simulate(),
|
|
242
|
+
token1.methods.balance_of_private(wallet.getAddress()).simulate(),
|
|
243
|
+
lpToken.methods.balance_of_private(wallet.getAddress()).simulate(),
|
|
244
244
|
]);
|
|
245
245
|
|
|
246
246
|
const nonce = Fr.random();
|
package/src/runner.ts
CHANGED
|
@@ -163,16 +163,16 @@ export class BotRunner implements BotRunnerApi, Traceable {
|
|
|
163
163
|
@trackSpan('Bot.work')
|
|
164
164
|
async #work() {
|
|
165
165
|
if (this.config.maxPendingTxs > 0) {
|
|
166
|
-
const
|
|
167
|
-
if (
|
|
168
|
-
this.log.verbose(`Not sending bot tx since node has ${
|
|
166
|
+
const pendingTxCount = await this.node.getPendingTxCount();
|
|
167
|
+
if (pendingTxCount >= this.config.maxPendingTxs) {
|
|
168
|
+
this.log.verbose(`Not sending bot tx since node has ${pendingTxCount} pending txs`);
|
|
169
169
|
return;
|
|
170
170
|
}
|
|
171
171
|
}
|
|
172
172
|
|
|
173
173
|
try {
|
|
174
174
|
await this.run();
|
|
175
|
-
} catch
|
|
175
|
+
} catch {
|
|
176
176
|
// Already logged in run()
|
|
177
177
|
if (this.config.maxConsecutiveErrors > 0 && this.consecutiveErrors >= this.config.maxConsecutiveErrors) {
|
|
178
178
|
this.log.error(`Too many errors bot is unhealthy`);
|