@aztec/bot 3.0.0-nightly.20251001 → 3.0.0-nightly.20251002
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/amm_bot.d.ts +2 -2
- package/dest/amm_bot.d.ts.map +1 -1
- package/dest/base_bot.d.ts +4 -3
- package/dest/base_bot.d.ts.map +1 -1
- package/dest/base_bot.js +3 -5
- package/dest/bot.d.ts +2 -2
- package/dest/bot.d.ts.map +1 -1
- package/dest/config.d.ts +7 -0
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +6 -0
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +17 -10
- package/package.json +13 -13
- package/src/amm_bot.ts +2 -2
- package/src/base_bot.ts +7 -7
- package/src/bot.ts +2 -2
- package/src/config.ts +8 -0
- package/src/factory.ts +12 -9
package/dest/amm_bot.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AztecAddress, SentTx, TxReceipt
|
|
1
|
+
import { AztecAddress, SentTx, TxReceipt } from '@aztec/aztec.js';
|
|
2
2
|
import type { AMMContract } from '@aztec/noir-contracts.js/AMM';
|
|
3
3
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
4
4
|
import type { AztecNode, AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
@@ -14,7 +14,7 @@ export declare class AmmBot extends BaseBot {
|
|
|
14
14
|
readonly amm: AMMContract;
|
|
15
15
|
readonly token0: TokenContract;
|
|
16
16
|
readonly token1: TokenContract;
|
|
17
|
-
protected constructor(node: AztecNode, wallet:
|
|
17
|
+
protected constructor(node: AztecNode, wallet: TestWallet, defaultAccountAddress: AztecAddress, amm: AMMContract, token0: TokenContract, token1: TokenContract, config: BotConfig);
|
|
18
18
|
static create(config: BotConfig, wallet: TestWallet, aztecNode: AztecNode, aztecNodeAdmin: AztecNodeAdmin | undefined, store: BotStore): Promise<AmmBot>;
|
|
19
19
|
protected createAndSendTx(logCtx: object): Promise<SentTx>;
|
|
20
20
|
protected onTxMined(receipt: TxReceipt, logCtx: object): Promise<void>;
|
package/dest/amm_bot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"amm_bot.d.ts","sourceRoot":"","sources":["../src/amm_bot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,EAAE,SAAS,EAAE,
|
|
1
|
+
{"version":3,"file":"amm_bot.d.ts","sourceRoot":"","sources":["../src/amm_bot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAM,MAAM,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AAEtE,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAChE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKjD,KAAK,QAAQ,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEnD,qBAAa,MAAO,SAAQ,OAAO;aAKf,GAAG,EAAE,WAAW;aAChB,MAAM,EAAE,aAAa;aACrB,MAAM,EAAE,aAAa;IANvC,SAAS,aACP,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,UAAU,EAClB,qBAAqB,EAAE,YAAY,EACnB,GAAG,EAAE,WAAW,EAChB,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,aAAa,EACrC,MAAM,EAAE,SAAS;WAKN,MAAM,CACjB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,GAAG,SAAS,EAC1C,KAAK,EAAE,QAAQ,GACd,OAAO,CAAC,MAAM,CAAC;cAWF,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;cA+CvC,SAAS,CAAC,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC;IAK9E,cAAc,IAAI,OAAO,CAAC,QAAQ,CAAC;IAI7B,WAAW,IAAI,OAAO,CAAC;QAAE,YAAY,EAAE,QAAQ,CAAC;QAAC,aAAa,EAAE,QAAQ,CAAC;QAAC,GAAG,EAAE,QAAQ,CAAA;KAAE,CAAC;YAQzF,mBAAmB;YAMnB,oBAAoB;CAMnC"}
|
package/dest/base_bot.d.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { AztecAddress, BatchCall, ContractFunctionInteraction, type SendMethodOptions, SentTx, TxHash, TxReceipt
|
|
1
|
+
import { AztecAddress, BatchCall, ContractFunctionInteraction, type SendMethodOptions, SentTx, TxHash, TxReceipt } from '@aztec/aztec.js';
|
|
2
2
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
3
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
3
4
|
import type { BotConfig } from './config.js';
|
|
4
5
|
export declare abstract class BaseBot {
|
|
5
6
|
readonly node: AztecNode;
|
|
6
|
-
readonly wallet:
|
|
7
|
+
readonly wallet: TestWallet;
|
|
7
8
|
readonly defaultAccountAddress: AztecAddress;
|
|
8
9
|
config: BotConfig;
|
|
9
10
|
protected log: import("@aztec/aztec.js").Logger;
|
|
10
11
|
protected attempts: number;
|
|
11
12
|
protected successes: number;
|
|
12
|
-
protected constructor(node: AztecNode, wallet:
|
|
13
|
+
protected constructor(node: AztecNode, wallet: TestWallet, defaultAccountAddress: AztecAddress, config: BotConfig);
|
|
13
14
|
run(): Promise<TxReceipt | TxHash>;
|
|
14
15
|
protected abstract createAndSendTx(logCtx: object): Promise<SentTx>;
|
|
15
16
|
protected onTxMined(_receipt: TxReceipt, _logCtx: object): Promise<void>;
|
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,YAAY,EACZ,SAAS,EACT,2BAA2B,
|
|
1
|
+
{"version":3,"file":"base_bot.d.ts","sourceRoot":"","sources":["../src/base_bot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,SAAS,EACT,2BAA2B,EAC3B,KAAK,iBAAiB,EACtB,MAAM,EACN,MAAM,EACN,SAAS,EAGV,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iCAAiC,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,8BAAsB,OAAO;aAOT,IAAI,EAAE,SAAS;aACf,MAAM,EAAE,UAAU;aAClB,qBAAqB,EAAE,YAAY;IAC5C,MAAM,EAAE,SAAS;IAT1B,SAAS,CAAC,GAAG,mCAAuB;IAEpC,SAAS,CAAC,QAAQ,EAAE,MAAM,CAAK;IAC/B,SAAS,CAAC,SAAS,EAAE,MAAM,CAAK;IAEhC,SAAS,aACS,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,UAAU,EAClB,qBAAqB,EAAE,YAAY,EAC5C,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;cAKxD,iBAAiB,CAAC,WAAW,EAAE,2BAA2B,GAAG,SAAS,GAAG,OAAO,CAAC,iBAAiB,CAAC;CAqBpH"}
|
package/dest/base_bot.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { createLogger, waitForProven } from '@aztec/aztec.js';
|
|
2
2
|
import { Gas } from '@aztec/stdlib/gas';
|
|
3
3
|
export class BaseBot {
|
|
4
4
|
node;
|
|
@@ -49,8 +49,8 @@ export class BaseBot {
|
|
|
49
49
|
return Promise.resolve();
|
|
50
50
|
}
|
|
51
51
|
async getSendMethodOpts(interaction) {
|
|
52
|
-
const { l2GasLimit, daGasLimit } = this.config;
|
|
53
|
-
|
|
52
|
+
const { l2GasLimit, daGasLimit, baseFeePadding } = this.config;
|
|
53
|
+
this.wallet.setBaseFeePadding(baseFeePadding);
|
|
54
54
|
let gasSettings;
|
|
55
55
|
if (l2GasLimit !== undefined && l2GasLimit > 0 && daGasLimit !== undefined && daGasLimit > 0) {
|
|
56
56
|
gasSettings = {
|
|
@@ -64,7 +64,6 @@ export class BaseBot {
|
|
|
64
64
|
this.log.verbose(`Estimating gas for transaction`);
|
|
65
65
|
({ estimatedGas: gasSettings } = await interaction.simulate({
|
|
66
66
|
fee: {
|
|
67
|
-
paymentMethod,
|
|
68
67
|
estimateGas: true
|
|
69
68
|
},
|
|
70
69
|
from: this.defaultAccountAddress
|
|
@@ -73,7 +72,6 @@ export class BaseBot {
|
|
|
73
72
|
return {
|
|
74
73
|
from: this.defaultAccountAddress,
|
|
75
74
|
fee: {
|
|
76
|
-
paymentMethod,
|
|
77
75
|
gasSettings
|
|
78
76
|
}
|
|
79
77
|
};
|
package/dest/bot.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AztecAddress, SentTx
|
|
1
|
+
import { type AztecAddress, SentTx } from '@aztec/aztec.js';
|
|
2
2
|
import type { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
|
|
3
3
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
4
4
|
import type { AztecNode, AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
@@ -9,7 +9,7 @@ import type { BotStore } from './store/index.js';
|
|
|
9
9
|
export declare class Bot extends BaseBot {
|
|
10
10
|
readonly token: TokenContract | PrivateTokenContract;
|
|
11
11
|
readonly recipient: AztecAddress;
|
|
12
|
-
protected constructor(node: AztecNode, wallet:
|
|
12
|
+
protected constructor(node: AztecNode, wallet: TestWallet, defaultAccountAddress: AztecAddress, token: TokenContract | PrivateTokenContract, recipient: AztecAddress, config: BotConfig);
|
|
13
13
|
static create(config: BotConfig, wallet: TestWallet, aztecNode: AztecNode, aztecNodeAdmin: AztecNodeAdmin | undefined, store: BotStore): Promise<Bot>;
|
|
14
14
|
updateConfig(config: Partial<BotConfig>): void;
|
|
15
15
|
protected createAndSendTx(logCtx: object): Promise<SentTx>;
|
package/dest/bot.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../src/bot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAa,MAAM,EAAE,
|
|
1
|
+
{"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../src/bot.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,YAAY,EAAa,MAAM,EAAE,MAAM,iBAAiB,CAAC;AAEvE,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAClF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AACpE,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AACjF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAErD,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAKjD,qBAAa,GAAI,SAAQ,OAAO;aAKZ,KAAK,EAAE,aAAa,GAAG,oBAAoB;aAC3C,SAAS,EAAE,YAAY;IALzC,SAAS,aACP,IAAI,EAAE,SAAS,EACf,MAAM,EAAE,UAAU,EAClB,qBAAqB,EAAE,YAAY,EACnB,KAAK,EAAE,aAAa,GAAG,oBAAoB,EAC3C,SAAS,EAAE,YAAY,EACvC,MAAM,EAAE,SAAS;WAKN,MAAM,CACjB,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,EAClB,SAAS,EAAE,SAAS,EACpB,cAAc,EAAE,cAAc,GAAG,SAAS,EAC1C,KAAK,EAAE,QAAQ,GACd,OAAO,CAAC,GAAG,CAAC;IAWR,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC;cAK9B,eAAe,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC;IA+BnD,WAAW;;;;;;;;;;CAmBzB"}
|
package/dest/config.d.ts
CHANGED
|
@@ -37,6 +37,8 @@ export type BotConfig = {
|
|
|
37
37
|
publicTransfersPerTx: number;
|
|
38
38
|
/** How to handle fee payments. */
|
|
39
39
|
feePaymentMethod: 'fee_juice';
|
|
40
|
+
/** 'How much is the bot willing to overpay vs. the current base fee' */
|
|
41
|
+
baseFeePadding: number;
|
|
40
42
|
/** True to not automatically setup or start the bot on initialization. */
|
|
41
43
|
noStart: boolean;
|
|
42
44
|
/** How long to wait for a tx to be mined before reporting an error. */
|
|
@@ -74,6 +76,7 @@ export declare const BotConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
74
76
|
privateTransfersPerTx: z.ZodNumber;
|
|
75
77
|
publicTransfersPerTx: z.ZodNumber;
|
|
76
78
|
feePaymentMethod: z.ZodLiteral<"fee_juice">;
|
|
79
|
+
baseFeePadding: z.ZodNumber;
|
|
77
80
|
noStart: z.ZodBoolean;
|
|
78
81
|
txMinedWaitSeconds: z.ZodNumber;
|
|
79
82
|
followChain: z.ZodEnum<["NONE", "PENDING", "PROVEN"]>;
|
|
@@ -94,6 +97,7 @@ export declare const BotConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
94
97
|
privateTransfersPerTx: number;
|
|
95
98
|
publicTransfersPerTx: number;
|
|
96
99
|
feePaymentMethod: "fee_juice";
|
|
100
|
+
baseFeePadding: number;
|
|
97
101
|
noStart: boolean;
|
|
98
102
|
txMinedWaitSeconds: number;
|
|
99
103
|
followChain: "NONE" | "PENDING" | "PROVEN";
|
|
@@ -120,6 +124,7 @@ export declare const BotConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
120
124
|
privateTransfersPerTx: number;
|
|
121
125
|
publicTransfersPerTx: number;
|
|
122
126
|
feePaymentMethod: "fee_juice";
|
|
127
|
+
baseFeePadding: number;
|
|
123
128
|
noStart: boolean;
|
|
124
129
|
txMinedWaitSeconds: number;
|
|
125
130
|
followChain: "NONE" | "PENDING" | "PROVEN";
|
|
@@ -148,6 +153,7 @@ export declare const BotConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
148
153
|
privateTransfersPerTx: number;
|
|
149
154
|
publicTransfersPerTx: number;
|
|
150
155
|
feePaymentMethod: "fee_juice";
|
|
156
|
+
baseFeePadding: number;
|
|
151
157
|
noStart: boolean;
|
|
152
158
|
txMinedWaitSeconds: number;
|
|
153
159
|
followChain: "NONE" | "PENDING" | "PROVEN";
|
|
@@ -174,6 +180,7 @@ export declare const BotConfigSchema: z.ZodEffects<z.ZodObject<{
|
|
|
174
180
|
privateTransfersPerTx: number;
|
|
175
181
|
publicTransfersPerTx: number;
|
|
176
182
|
feePaymentMethod: "fee_juice";
|
|
183
|
+
baseFeePadding: number;
|
|
177
184
|
noStart: boolean;
|
|
178
185
|
txMinedWaitSeconds: number;
|
|
179
186
|
followChain: "NONE" | "PENDING" | "PROVEN";
|
package/dest/config.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,kBAAkB,EACvB,WAAW,EASZ,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,EAAE,EAAE,MAAM,0BAA0B,CAAC;AAC9C,OAAO,EAAE,KAAK,eAAe,EAAsB,MAAM,wBAAwB,CAAC;AAGlF,OAAO,EAAE,KAAK,MAAM,EAAW,MAAM,uBAAuB,CAAC;AAC7D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AAEnE,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,QAAA,MAAM,cAAc,wCAAyC,CAAC;AAC9D,KAAK,cAAc,GAAG,CAAC,OAAO,cAAc,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,oBAAY,uBAAuB;IACjC,aAAa,kBAAkB;IAC/B,oBAAoB,yBAAyB;CAC9C;AAED,MAAM,MAAM,SAAS,GAAG;IACtB,6DAA6D;IAC7D,OAAO,EAAE,MAAM,GAAG,SAAS,CAAC;IAC5B,4EAA4E;IAC5E,YAAY,EAAE,MAAM,GAAG,SAAS,CAAC;IACjC,gCAAgC;IAChC,SAAS,EAAE,MAAM,EAAE,GAAG,SAAS,CAAC;IAChC,gEAAgE;IAChE,UAAU,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC5C,mEAAmE;IACnE,YAAY,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,SAAS,CAAC;IAC9C,uEAAuE;IACvE,2BAA2B,EAAE,MAAM,CAAC;IACpC,kDAAkD;IAClD,gBAAgB,EAAE,WAAW,CAAC,EAAE,CAAC,GAAG,SAAS,CAAC;IAC9C,6DAA6D;IAC7D,UAAU,EAAE,EAAE,GAAG,SAAS,CAAC;IAC3B,iDAAiD;IACjD,SAAS,EAAE,EAAE,CAAC;IACd,sDAAsD;IACtD,iBAAiB,EAAE,MAAM,CAAC;IAC1B,4DAA4D;IAC5D,qBAAqB,EAAE,MAAM,CAAC;IAC9B,2DAA2D;IAC3D,oBAAoB,EAAE,MAAM,CAAC;IAC7B,kCAAkC;IAClC,gBAAgB,EAAE,WAAW,CAAC;IAC9B,0EAA0E;IAC1E,OAAO,EAAE,OAAO,CAAC;IACjB,uEAAuE;IACvE,kBAAkB,EAAE,MAAM,CAAC;IAC3B,4EAA4E;IAC5E,WAAW,EAAE,cAAc,CAAC;IAC5B,gFAAgF;IAChF,aAAa,EAAE,MAAM,CAAC;IACtB,8DAA8D;IAC9D,sBAAsB,EAAE,OAAO,CAAC;IAChC,+EAA+E;IAC/E,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,+EAA+E;IAC/E,UAAU,EAAE,MAAM,GAAG,SAAS,CAAC;IAC/B,4BAA4B;IAC5B,QAAQ,EAAE,uBAAuB,CAAC;IAClC,yEAAyE;IACzE,oBAAoB,EAAE,MAAM,CAAC;IAC7B,iDAAiD;IACjD,iBAAiB,EAAE,OAAO,CAAC;IAC3B,+DAA+D;IAC/D,MAAM,EAAE,OAAO,CAAC;CACjB,GAAG,IAAI,CAAC,eAAe,EAAE,eAAe,GAAG,oBAAoB,CAAC,CAAC;AAElE,eAAO,MAAM,eAAe
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"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"}
|
package/dest/config.js
CHANGED
|
@@ -29,6 +29,7 @@ export const BotConfigSchema = z.object({
|
|
|
29
29
|
privateTransfersPerTx: z.number().int().nonnegative(),
|
|
30
30
|
publicTransfersPerTx: z.number().int().nonnegative(),
|
|
31
31
|
feePaymentMethod: z.literal('fee_juice'),
|
|
32
|
+
baseFeePadding: z.number().int().nonnegative(),
|
|
32
33
|
noStart: z.boolean(),
|
|
33
34
|
txMinedWaitSeconds: z.number(),
|
|
34
35
|
followChain: z.enum(BotFollowChain),
|
|
@@ -122,6 +123,11 @@ export const botConfigMappings = {
|
|
|
122
123
|
parseEnv: (val)=>val || undefined,
|
|
123
124
|
defaultValue: 'fee_juice'
|
|
124
125
|
},
|
|
126
|
+
baseFeePadding: {
|
|
127
|
+
env: 'BOT_BASE_FEE_PADDING',
|
|
128
|
+
description: 'How much is the bot willing to overpay vs. the current base fee',
|
|
129
|
+
...numberConfigHelper(3)
|
|
130
|
+
},
|
|
125
131
|
noStart: {
|
|
126
132
|
env: 'BOT_NO_START',
|
|
127
133
|
description: 'True to not automatically setup or start the bot on initialization.',
|
package/dest/factory.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EAWb,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;
|
|
1
|
+
{"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,YAAY,EAWb,MAAM,iBAAiB,CAAC;AAIzB,OAAO,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAC3D,OAAO,EAAE,oBAAoB,EAAE,MAAM,uCAAuC,CAAC;AAC7E,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAE/D,OAAO,KAAK,EAAE,SAAS,EAAE,cAAc,EAAE,MAAM,iCAAiC,CAAC;AAEjF,OAAO,EAAE,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAEhD,OAAO,EAAE,KAAK,SAAS,EAA2B,MAAM,aAAa,CAAC;AACtE,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AAMjD,qBAAa,UAAU;IAInB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,MAAM;IACvB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,SAAS;IAC1B,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAC;IAPlC,OAAO,CAAC,GAAG,CAAuB;gBAGf,MAAM,EAAE,SAAS,EACjB,MAAM,EAAE,UAAU,EAClB,KAAK,EAAE,QAAQ,EACf,SAAS,EAAE,SAAS,EACpB,cAAc,CAAC,EAAE,cAAc,YAAA;IAGlD;;;OAGG;IACU,KAAK;;;;;;;IAQL,QAAQ;;;;;;;;IAwBrB;;;OAGG;YACW,YAAY;YAWZ,0BAA0B;YAwC1B,gBAAgB;IAW9B;;;;OAIG;YACW,UAAU;IA+BxB;;;;OAIG;IACH,OAAO,CAAC,kBAAkB;YAYZ,gBAAgB;YAoBhB,OAAO;YA8EP,wBAAwB;IAkBtC;;;OAGG;YACW,UAAU;IAmCxB;;;;OAIG;YACW,sBAAsB;YA4BtB,gBAAgB;YAgChB,oBAAoB;CAenC"}
|
package/dest/factory.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { SchnorrAccountContract } from '@aztec/accounts/schnorr';
|
|
2
2
|
import { getInitialTestAccountsData } from '@aztec/accounts/testing';
|
|
3
|
-
import { BatchCall, FeeJuicePaymentMethodWithClaim, L1FeeJuicePortalManager, createLogger, waitForL1ToL2MessageReady } from '@aztec/aztec.js';
|
|
3
|
+
import { AztecAddress, BatchCall, FeeJuicePaymentMethodWithClaim, L1FeeJuicePortalManager, createLogger, waitForL1ToL2MessageReady } from '@aztec/aztec.js';
|
|
4
4
|
import { createEthereumChain, createExtendedL1Client } from '@aztec/ethereum';
|
|
5
5
|
import { Fr } from '@aztec/foundation/fields';
|
|
6
6
|
import { Timer } from '@aztec/foundation/timer';
|
|
7
7
|
import { AMMContract } from '@aztec/noir-contracts.js/AMM';
|
|
8
8
|
import { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
|
|
9
9
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
10
|
+
import { GasSettings } from '@aztec/stdlib/gas';
|
|
10
11
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
11
12
|
import { SupportedTokenContracts } from './config.js';
|
|
12
13
|
import { getBalances, getPrivateBalance, isStandardTokenContract } from './utils.js';
|
|
@@ -82,22 +83,28 @@ export class BotFactory {
|
|
|
82
83
|
contract: new SchnorrAccountContract(signingKey)
|
|
83
84
|
};
|
|
84
85
|
const accountManager = await this.wallet.createAccount(accountData);
|
|
85
|
-
const isInit = (await this.wallet.getContractMetadata(accountManager.
|
|
86
|
+
const isInit = (await this.wallet.getContractMetadata(accountManager.address)).isContractInitialized;
|
|
86
87
|
if (isInit) {
|
|
87
|
-
this.log.info(`Account at ${accountManager.
|
|
88
|
+
this.log.info(`Account at ${accountManager.address.toString()} already initialized`);
|
|
88
89
|
const timer = new Timer();
|
|
89
|
-
|
|
90
|
-
const address = accountManager.getAddress();
|
|
90
|
+
const address = accountManager.address;
|
|
91
91
|
this.log.info(`Account at ${address} registered. duration=${timer.ms()}`);
|
|
92
92
|
await this.store.deleteBridgeClaim(address);
|
|
93
93
|
return address;
|
|
94
94
|
} else {
|
|
95
|
-
const address = accountManager.
|
|
95
|
+
const address = accountManager.address;
|
|
96
96
|
this.log.info(`Deploying account at ${address}`);
|
|
97
97
|
const claim = await this.getOrCreateBridgeClaim(address);
|
|
98
|
-
const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.
|
|
99
|
-
const
|
|
98
|
+
const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.address, claim);
|
|
99
|
+
const deployMethod = await accountManager.getDeployMethod();
|
|
100
|
+
const maxFeesPerGas = (await this.aztecNode.getCurrentBaseFees()).mul(1 + this.config.baseFeePadding);
|
|
101
|
+
const gasSettings = GasSettings.default({
|
|
102
|
+
maxFeesPerGas
|
|
103
|
+
});
|
|
104
|
+
const sentTx = deployMethod.send({
|
|
105
|
+
from: AztecAddress.ZERO,
|
|
100
106
|
fee: {
|
|
107
|
+
gasSettings,
|
|
101
108
|
paymentMethod
|
|
102
109
|
}
|
|
103
110
|
});
|
|
@@ -109,7 +116,7 @@ export class BotFactory {
|
|
|
109
116
|
this.log.info(`Account deployed at ${address}`);
|
|
110
117
|
// Clean up the consumed bridge claim
|
|
111
118
|
await this.store.deleteBridgeClaim(address);
|
|
112
|
-
return accountManager.
|
|
119
|
+
return accountManager.address;
|
|
113
120
|
}
|
|
114
121
|
}
|
|
115
122
|
async setupTestAccount() {
|
|
@@ -120,7 +127,7 @@ export class BotFactory {
|
|
|
120
127
|
contract: new SchnorrAccountContract(initialAccountData.signingKey)
|
|
121
128
|
};
|
|
122
129
|
const accountManager = await this.wallet.createAccount(accountData);
|
|
123
|
-
return accountManager.
|
|
130
|
+
return accountManager.address;
|
|
124
131
|
}
|
|
125
132
|
/**
|
|
126
133
|
* Checks if the token contract is deployed and deploys it if necessary.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@aztec/bot",
|
|
3
|
-
"version": "3.0.0-nightly.
|
|
3
|
+
"version": "3.0.0-nightly.20251002",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"exports": {
|
|
6
6
|
".": "./dest/index.js",
|
|
@@ -54,18 +54,18 @@
|
|
|
54
54
|
]
|
|
55
55
|
},
|
|
56
56
|
"dependencies": {
|
|
57
|
-
"@aztec/accounts": "3.0.0-nightly.
|
|
58
|
-
"@aztec/aztec.js": "3.0.0-nightly.
|
|
59
|
-
"@aztec/entrypoints": "3.0.0-nightly.
|
|
60
|
-
"@aztec/ethereum": "3.0.0-nightly.
|
|
61
|
-
"@aztec/foundation": "3.0.0-nightly.
|
|
62
|
-
"@aztec/kv-store": "3.0.0-nightly.
|
|
63
|
-
"@aztec/noir-contracts.js": "3.0.0-nightly.
|
|
64
|
-
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.
|
|
65
|
-
"@aztec/protocol-contracts": "3.0.0-nightly.
|
|
66
|
-
"@aztec/stdlib": "3.0.0-nightly.
|
|
67
|
-
"@aztec/telemetry-client": "3.0.0-nightly.
|
|
68
|
-
"@aztec/test-wallet": "3.0.0-nightly.
|
|
57
|
+
"@aztec/accounts": "3.0.0-nightly.20251002",
|
|
58
|
+
"@aztec/aztec.js": "3.0.0-nightly.20251002",
|
|
59
|
+
"@aztec/entrypoints": "3.0.0-nightly.20251002",
|
|
60
|
+
"@aztec/ethereum": "3.0.0-nightly.20251002",
|
|
61
|
+
"@aztec/foundation": "3.0.0-nightly.20251002",
|
|
62
|
+
"@aztec/kv-store": "3.0.0-nightly.20251002",
|
|
63
|
+
"@aztec/noir-contracts.js": "3.0.0-nightly.20251002",
|
|
64
|
+
"@aztec/noir-protocol-circuits-types": "3.0.0-nightly.20251002",
|
|
65
|
+
"@aztec/protocol-contracts": "3.0.0-nightly.20251002",
|
|
66
|
+
"@aztec/stdlib": "3.0.0-nightly.20251002",
|
|
67
|
+
"@aztec/telemetry-client": "3.0.0-nightly.20251002",
|
|
68
|
+
"@aztec/test-wallet": "3.0.0-nightly.20251002",
|
|
69
69
|
"source-map-support": "^0.5.21",
|
|
70
70
|
"tslib": "^2.4.0",
|
|
71
71
|
"zod": "^3.23.8"
|
package/src/amm_bot.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AztecAddress, Fr, SentTx, TxReceipt
|
|
1
|
+
import { AztecAddress, Fr, SentTx, TxReceipt } from '@aztec/aztec.js';
|
|
2
2
|
import { jsonStringify } from '@aztec/foundation/json-rpc';
|
|
3
3
|
import type { AMMContract } from '@aztec/noir-contracts.js/AMM';
|
|
4
4
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
@@ -18,7 +18,7 @@ type Balances = { token0: bigint; token1: bigint };
|
|
|
18
18
|
export class AmmBot extends BaseBot {
|
|
19
19
|
protected constructor(
|
|
20
20
|
node: AztecNode,
|
|
21
|
-
wallet:
|
|
21
|
+
wallet: TestWallet,
|
|
22
22
|
defaultAccountAddress: AztecAddress,
|
|
23
23
|
public readonly amm: AMMContract,
|
|
24
24
|
public readonly token0: TokenContract,
|
package/src/base_bot.ts
CHANGED
|
@@ -2,17 +2,16 @@ import {
|
|
|
2
2
|
AztecAddress,
|
|
3
3
|
BatchCall,
|
|
4
4
|
ContractFunctionInteraction,
|
|
5
|
-
FeeJuicePaymentMethod,
|
|
6
5
|
type SendMethodOptions,
|
|
7
6
|
SentTx,
|
|
8
7
|
TxHash,
|
|
9
8
|
TxReceipt,
|
|
10
|
-
type Wallet,
|
|
11
9
|
createLogger,
|
|
12
10
|
waitForProven,
|
|
13
11
|
} from '@aztec/aztec.js';
|
|
14
12
|
import { Gas } from '@aztec/stdlib/gas';
|
|
15
13
|
import type { AztecNode } from '@aztec/stdlib/interfaces/client';
|
|
14
|
+
import type { TestWallet } from '@aztec/test-wallet';
|
|
16
15
|
|
|
17
16
|
import type { BotConfig } from './config.js';
|
|
18
17
|
|
|
@@ -24,7 +23,7 @@ export abstract class BaseBot {
|
|
|
24
23
|
|
|
25
24
|
protected constructor(
|
|
26
25
|
public readonly node: AztecNode,
|
|
27
|
-
public readonly wallet:
|
|
26
|
+
public readonly wallet: TestWallet,
|
|
28
27
|
public readonly defaultAccountAddress: AztecAddress,
|
|
29
28
|
public config: BotConfig,
|
|
30
29
|
) {}
|
|
@@ -73,8 +72,9 @@ export abstract class BaseBot {
|
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
protected async getSendMethodOpts(interaction: ContractFunctionInteraction | BatchCall): Promise<SendMethodOptions> {
|
|
76
|
-
const { l2GasLimit, daGasLimit } = this.config;
|
|
77
|
-
|
|
75
|
+
const { l2GasLimit, daGasLimit, baseFeePadding } = this.config;
|
|
76
|
+
|
|
77
|
+
this.wallet.setBaseFeePadding(baseFeePadding);
|
|
78
78
|
|
|
79
79
|
let gasSettings;
|
|
80
80
|
if (l2GasLimit !== undefined && l2GasLimit > 0 && daGasLimit !== undefined && daGasLimit > 0) {
|
|
@@ -83,13 +83,13 @@ export abstract class BaseBot {
|
|
|
83
83
|
} else {
|
|
84
84
|
this.log.verbose(`Estimating gas for transaction`);
|
|
85
85
|
({ estimatedGas: gasSettings } = await interaction.simulate({
|
|
86
|
-
fee: {
|
|
86
|
+
fee: { estimateGas: true },
|
|
87
87
|
from: this.defaultAccountAddress,
|
|
88
88
|
}));
|
|
89
89
|
}
|
|
90
90
|
return {
|
|
91
91
|
from: this.defaultAccountAddress,
|
|
92
|
-
fee: {
|
|
92
|
+
fee: { gasSettings },
|
|
93
93
|
};
|
|
94
94
|
}
|
|
95
95
|
}
|
package/src/bot.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type AztecAddress, BatchCall, SentTx
|
|
1
|
+
import { type AztecAddress, BatchCall, SentTx } from '@aztec/aztec.js';
|
|
2
2
|
import { times } from '@aztec/foundation/collection';
|
|
3
3
|
import type { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
|
|
4
4
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
@@ -16,7 +16,7 @@ const TRANSFER_AMOUNT = 1;
|
|
|
16
16
|
export class Bot extends BaseBot {
|
|
17
17
|
protected constructor(
|
|
18
18
|
node: AztecNode,
|
|
19
|
-
wallet:
|
|
19
|
+
wallet: TestWallet,
|
|
20
20
|
defaultAccountAddress: AztecAddress,
|
|
21
21
|
public readonly token: TokenContract | PrivateTokenContract,
|
|
22
22
|
public readonly recipient: AztecAddress,
|
package/src/config.ts
CHANGED
|
@@ -54,6 +54,8 @@ export type BotConfig = {
|
|
|
54
54
|
publicTransfersPerTx: number;
|
|
55
55
|
/** How to handle fee payments. */
|
|
56
56
|
feePaymentMethod: 'fee_juice';
|
|
57
|
+
/** 'How much is the bot willing to overpay vs. the current base fee' */
|
|
58
|
+
baseFeePadding: number;
|
|
57
59
|
/** True to not automatically setup or start the bot on initialization. */
|
|
58
60
|
noStart: boolean;
|
|
59
61
|
/** How long to wait for a tx to be mined before reporting an error. */
|
|
@@ -93,6 +95,7 @@ export const BotConfigSchema = z
|
|
|
93
95
|
privateTransfersPerTx: z.number().int().nonnegative(),
|
|
94
96
|
publicTransfersPerTx: z.number().int().nonnegative(),
|
|
95
97
|
feePaymentMethod: z.literal('fee_juice'),
|
|
98
|
+
baseFeePadding: z.number().int().nonnegative(),
|
|
96
99
|
noStart: z.boolean(),
|
|
97
100
|
txMinedWaitSeconds: z.number(),
|
|
98
101
|
followChain: z.enum(BotFollowChain),
|
|
@@ -188,6 +191,11 @@ export const botConfigMappings: ConfigMappingsType<BotConfig> = {
|
|
|
188
191
|
parseEnv: val => (val as 'fee_juice') || undefined,
|
|
189
192
|
defaultValue: 'fee_juice',
|
|
190
193
|
},
|
|
194
|
+
baseFeePadding: {
|
|
195
|
+
env: 'BOT_BASE_FEE_PADDING',
|
|
196
|
+
description: 'How much is the bot willing to overpay vs. the current base fee',
|
|
197
|
+
...numberConfigHelper(3),
|
|
198
|
+
},
|
|
191
199
|
noStart: {
|
|
192
200
|
env: 'BOT_NO_START',
|
|
193
201
|
description: 'True to not automatically setup or start the bot on initialization.',
|
package/src/factory.ts
CHANGED
|
@@ -19,6 +19,7 @@ import { Timer } from '@aztec/foundation/timer';
|
|
|
19
19
|
import { AMMContract } from '@aztec/noir-contracts.js/AMM';
|
|
20
20
|
import { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
|
|
21
21
|
import { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
22
|
+
import { GasSettings } from '@aztec/stdlib/gas';
|
|
22
23
|
import type { AztecNode, AztecNodeAdmin } from '@aztec/stdlib/interfaces/client';
|
|
23
24
|
import { deriveSigningKey } from '@aztec/stdlib/keys';
|
|
24
25
|
import { TestWallet } from '@aztec/test-wallet';
|
|
@@ -101,23 +102,25 @@ export class BotFactory {
|
|
|
101
102
|
contract: new SchnorrAccountContract(signingKey!),
|
|
102
103
|
};
|
|
103
104
|
const accountManager = await this.wallet.createAccount(accountData);
|
|
104
|
-
const isInit = (await this.wallet.getContractMetadata(accountManager.
|
|
105
|
+
const isInit = (await this.wallet.getContractMetadata(accountManager.address)).isContractInitialized;
|
|
105
106
|
if (isInit) {
|
|
106
|
-
this.log.info(`Account at ${accountManager.
|
|
107
|
+
this.log.info(`Account at ${accountManager.address.toString()} already initialized`);
|
|
107
108
|
const timer = new Timer();
|
|
108
|
-
|
|
109
|
-
const address = accountManager.getAddress();
|
|
109
|
+
const address = accountManager.address;
|
|
110
110
|
this.log.info(`Account at ${address} registered. duration=${timer.ms()}`);
|
|
111
111
|
await this.store.deleteBridgeClaim(address);
|
|
112
112
|
return address;
|
|
113
113
|
} else {
|
|
114
|
-
const address = accountManager.
|
|
114
|
+
const address = accountManager.address;
|
|
115
115
|
this.log.info(`Deploying account at ${address}`);
|
|
116
116
|
|
|
117
117
|
const claim = await this.getOrCreateBridgeClaim(address);
|
|
118
118
|
|
|
119
|
-
const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.
|
|
120
|
-
const
|
|
119
|
+
const paymentMethod = new FeeJuicePaymentMethodWithClaim(accountManager.address, claim);
|
|
120
|
+
const deployMethod = await accountManager.getDeployMethod();
|
|
121
|
+
const maxFeesPerGas = (await this.aztecNode.getCurrentBaseFees()).mul(1 + this.config.baseFeePadding);
|
|
122
|
+
const gasSettings = GasSettings.default({ maxFeesPerGas });
|
|
123
|
+
const sentTx = deployMethod.send({ from: AztecAddress.ZERO, fee: { gasSettings, paymentMethod } });
|
|
121
124
|
const txHash = await sentTx.getTxHash();
|
|
122
125
|
this.log.info(`Sent tx for account deployment with hash ${txHash.toString()}`);
|
|
123
126
|
await this.withNoMinTxsPerBlock(() => sentTx.wait({ timeout: this.config.txMinedWaitSeconds }));
|
|
@@ -126,7 +129,7 @@ export class BotFactory {
|
|
|
126
129
|
// Clean up the consumed bridge claim
|
|
127
130
|
await this.store.deleteBridgeClaim(address);
|
|
128
131
|
|
|
129
|
-
return accountManager.
|
|
132
|
+
return accountManager.address;
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
135
|
|
|
@@ -138,7 +141,7 @@ export class BotFactory {
|
|
|
138
141
|
contract: new SchnorrAccountContract(initialAccountData.signingKey),
|
|
139
142
|
};
|
|
140
143
|
const accountManager = await this.wallet.createAccount(accountData);
|
|
141
|
-
return accountManager.
|
|
144
|
+
return accountManager.address;
|
|
142
145
|
}
|
|
143
146
|
|
|
144
147
|
/**
|