@aztec/bot 0.78.0 → 0.79.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/bot.d.ts.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../src/bot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAIjB,KAAK,MAAM,EAEZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAGpE,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7C,qBAAa,GAAG;aAOI,MAAM,EAAE,MAAM;aACd,KAAK,EAAE,aAAa,GAAG,wBAAwB;aAC/C,SAAS,EAAE,YAAY;IAChC,MAAM,EAAE,SAAS;IAT1B,OAAO,CAAC,GAAG,CAAuB;IAElC,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,SAAS,CAAa;IAE9B,SAAS,aACS,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,aAAa,GAAG,wBAAwB,EAC/C,SAAS,EAAE,YAAY,EAChC,MAAM,EAAE,SAAS;WAGb,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,GAAE;QAAE,GAAG,CAAC,EAAE,GAAG,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAA;KAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAKjG,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC;IAKjC,GAAG;IAoEH,WAAW;;;;;;;;;;IAoBxB,OAAO,CAAC,iBAAiB;CAkB1B"}
1
+ {"version":3,"file":"bot.d.ts","sourceRoot":"","sources":["../src/bot.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,YAAY,EAIjB,KAAK,MAAM,EAEZ,MAAM,iBAAiB,CAAC;AAEzB,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AAC1F,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAEpE,OAAO,KAAK,EAAE,SAAS,EAAE,GAAG,EAAE,MAAM,iCAAiC,CAAC;AAEtE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAM7C,qBAAa,GAAG;aAOI,MAAM,EAAE,MAAM;aACd,KAAK,EAAE,aAAa,GAAG,wBAAwB;aAC/C,SAAS,EAAE,YAAY;IAChC,MAAM,EAAE,SAAS;IAT1B,OAAO,CAAC,GAAG,CAAuB;IAElC,OAAO,CAAC,QAAQ,CAAa;IAC7B,OAAO,CAAC,SAAS,CAAa;IAE9B,SAAS,aACS,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,aAAa,GAAG,wBAAwB,EAC/C,SAAS,EAAE,YAAY,EAChC,MAAM,EAAE,SAAS;WAGb,MAAM,CAAC,MAAM,EAAE,SAAS,EAAE,YAAY,GAAE;QAAE,GAAG,CAAC,EAAE,GAAG,CAAC;QAAC,IAAI,CAAC,EAAE,SAAS,CAAA;KAAO,GAAG,OAAO,CAAC,GAAG,CAAC;IAKjG,YAAY,CAAC,MAAM,EAAE,OAAO,CAAC,SAAS,CAAC;IAKjC,GAAG;IAuDH,WAAW;;;;;;;;;;IAoBxB,OAAO,CAAC,iBAAiB;CAkB1B"}
package/dest/bot.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { BatchCall, FeeJuicePaymentMethod, createLogger } from '@aztec/aztec.js';
2
- import { timesParallel } from '@aztec/foundation/collection';
2
+ import { times } from '@aztec/foundation/collection';
3
3
  import { Gas } from '@aztec/stdlib/gas';
4
4
  import { BotFactory } from './factory.js';
5
5
  import { getBalances, getPrivateBalance, isStandardTokenContract } from './utils.js';
@@ -41,13 +41,10 @@ export class Bot {
41
41
  const { token, recipient, wallet } = this;
42
42
  const sender = wallet.getAddress();
43
43
  this.log.verbose(`Preparing tx with ${feePaymentMethod} fee with ${privateTransfersPerTx} private and ${publicTransfersPerTx} public transfers`, logCtx);
44
- const calls = [];
45
- if (isStandardTokenContract(token)) {
46
- calls.push(...await timesParallel(privateTransfersPerTx, ()=>token.methods.transfer(recipient, TRANSFER_AMOUNT).request()));
47
- calls.push(...await timesParallel(publicTransfersPerTx, ()=>token.methods.transfer_in_public(sender, recipient, TRANSFER_AMOUNT, 0).request()));
48
- } else {
49
- calls.push(...await timesParallel(privateTransfersPerTx, ()=>token.methods.transfer(TRANSFER_AMOUNT, sender, recipient).request()));
50
- }
44
+ const calls = isStandardTokenContract(token) ? [
45
+ times(privateTransfersPerTx, ()=>token.methods.transfer(recipient, TRANSFER_AMOUNT)),
46
+ times(publicTransfersPerTx, ()=>token.methods.transfer_in_public(sender, recipient, TRANSFER_AMOUNT, 0))
47
+ ].flat() : times(privateTransfersPerTx, ()=>token.methods.transfer(TRANSFER_AMOUNT, sender, recipient));
51
48
  const opts = this.getSendMethodOpts();
52
49
  const batch = new BatchCall(wallet, calls);
53
50
  this.log.verbose(`Simulating transaction with ${calls.length}`, logCtx);
@@ -1 +1 @@
1
- {"version":3,"file":"factory.d.ts","sourceRoot":"","sources":["../src/factory.ts"],"names":[],"mappings":"AAEA,OAAO,EAEL,YAAY,EACZ,KAAK,SAAS,EAMd,KAAK,GAAG,EAIT,MAAM,iBAAiB,CAAC;AAGzB,OAAO,EAAE,wBAAwB,EAAE,MAAM,2CAA2C,CAAC;AACrF,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAK/D,OAAO,EAAE,KAAK,SAAS,EAAwC,MAAM,aAAa,CAAC;AAMnF,qBAAa,UAAU;IAKT,OAAO,CAAC,QAAQ,CAAC,MAAM;IAJnC,OAAO,CAAC,GAAG,CAAM;IACjB,OAAO,CAAC,IAAI,CAAC,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11 +170,11 @@ export class BotFactory {
170
170
  if (privateBalance < MIN_BALANCE) {
171
171
  this.log.info(`Minting private tokens for ${sender.toString()}`);
172
172
  const from = sender; // we are setting from to sender here because we need a sender to calculate the tag
173
- calls.push(isStandardToken ? await token.methods.mint_to_private(from, sender, MINT_BALANCE).request() : await token.methods.mint(MINT_BALANCE, sender).request());
173
+ calls.push(isStandardToken ? token.methods.mint_to_private(from, sender, MINT_BALANCE) : token.methods.mint(MINT_BALANCE, sender));
174
174
  }
175
175
  if (isStandardToken && publicBalance < MIN_BALANCE) {
176
176
  this.log.info(`Minting public tokens for ${sender.toString()}`);
177
- calls.push(await token.methods.mint_to_public(sender, MINT_BALANCE).request());
177
+ calls.push(token.methods.mint_to_public(sender, MINT_BALANCE));
178
178
  }
179
179
  if (calls.length === 0) {
180
180
  this.log.info(`Skipping minting as ${sender.toString()} has enough tokens`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aztec/bot",
3
- "version": "0.78.0",
3
+ "version": "0.79.0",
4
4
  "type": "module",
5
5
  "exports": {
6
6
  ".": "./dest/index.js",
@@ -52,16 +52,16 @@
52
52
  ]
53
53
  },
54
54
  "dependencies": {
55
- "@aztec/accounts": "0.78.0",
56
- "@aztec/aztec.js": "0.78.0",
57
- "@aztec/entrypoints": "0.78.0",
58
- "@aztec/ethereum": "0.78.0",
59
- "@aztec/foundation": "0.78.0",
60
- "@aztec/noir-contracts.js": "0.78.0",
61
- "@aztec/noir-protocol-circuits-types": "0.78.0",
62
- "@aztec/protocol-contracts": "0.78.0",
63
- "@aztec/stdlib": "0.78.0",
64
- "@aztec/telemetry-client": "0.78.0",
55
+ "@aztec/accounts": "0.79.0",
56
+ "@aztec/aztec.js": "0.79.0",
57
+ "@aztec/entrypoints": "0.79.0",
58
+ "@aztec/ethereum": "0.79.0",
59
+ "@aztec/foundation": "0.79.0",
60
+ "@aztec/noir-contracts.js": "0.79.0",
61
+ "@aztec/noir-protocol-circuits-types": "0.79.0",
62
+ "@aztec/protocol-contracts": "0.79.0",
63
+ "@aztec/stdlib": "0.79.0",
64
+ "@aztec/telemetry-client": "0.79.0",
65
65
  "source-map-support": "^0.5.21",
66
66
  "tslib": "^2.4.0",
67
67
  "zod": "^3.23.8"
package/src/bot.ts CHANGED
@@ -6,10 +6,9 @@ import {
6
6
  type Wallet,
7
7
  createLogger,
8
8
  } from '@aztec/aztec.js';
9
- import { timesParallel } from '@aztec/foundation/collection';
9
+ import { times } from '@aztec/foundation/collection';
10
10
  import type { EasyPrivateTokenContract } from '@aztec/noir-contracts.js/EasyPrivateToken';
11
11
  import type { TokenContract } from '@aztec/noir-contracts.js/Token';
12
- import type { FunctionCall } from '@aztec/stdlib/abi';
13
12
  import { Gas } from '@aztec/stdlib/gas';
14
13
  import type { AztecNode, PXE } from '@aztec/stdlib/interfaces/client';
15
14
 
@@ -55,25 +54,12 @@ export class Bot {
55
54
  logCtx,
56
55
  );
57
56
 
58
- const calls: FunctionCall[] = [];
59
- if (isStandardTokenContract(token)) {
60
- calls.push(
61
- ...(await timesParallel(privateTransfersPerTx, () =>
62
- token.methods.transfer(recipient, TRANSFER_AMOUNT).request(),
63
- )),
64
- );
65
- calls.push(
66
- ...(await timesParallel(publicTransfersPerTx, () =>
67
- token.methods.transfer_in_public(sender, recipient, TRANSFER_AMOUNT, 0).request(),
68
- )),
69
- );
70
- } else {
71
- calls.push(
72
- ...(await timesParallel(privateTransfersPerTx, () =>
73
- token.methods.transfer(TRANSFER_AMOUNT, sender, recipient).request(),
74
- )),
75
- );
76
- }
57
+ const calls = isStandardTokenContract(token)
58
+ ? [
59
+ times(privateTransfersPerTx, () => token.methods.transfer(recipient, TRANSFER_AMOUNT)),
60
+ times(publicTransfersPerTx, () => token.methods.transfer_in_public(sender, recipient, TRANSFER_AMOUNT, 0)),
61
+ ].flat()
62
+ : times(privateTransfersPerTx, () => token.methods.transfer(TRANSFER_AMOUNT, sender, recipient));
77
63
 
78
64
  const opts = this.getSendMethodOpts();
79
65
  const batch = new BatchCall(wallet, calls);
package/src/factory.ts CHANGED
@@ -5,6 +5,7 @@ import {
5
5
  AztecAddress,
6
6
  type AztecNode,
7
7
  BatchCall,
8
+ ContractFunctionInteraction,
8
9
  type DeployMethod,
9
10
  type DeployOptions,
10
11
  FeeJuicePaymentMethodWithClaim,
@@ -18,7 +19,6 @@ import { createEthereumChain, createL1Clients } from '@aztec/ethereum';
18
19
  import { Fr } from '@aztec/foundation/fields';
19
20
  import { EasyPrivateTokenContract } from '@aztec/noir-contracts.js/EasyPrivateToken';
20
21
  import { TokenContract } from '@aztec/noir-contracts.js/Token';
21
- import type { FunctionCall } from '@aztec/stdlib/abi';
22
22
  import { deriveSigningKey } from '@aztec/stdlib/keys';
23
23
  import { makeTracedFetch } from '@aztec/telemetry-client';
24
24
 
@@ -182,20 +182,20 @@ export class BotFactory {
182
182
  privateBalance = await getPrivateBalance(token, sender);
183
183
  }
184
184
 
185
- const calls: FunctionCall[] = [];
185
+ const calls: ContractFunctionInteraction[] = [];
186
186
  if (privateBalance < MIN_BALANCE) {
187
187
  this.log.info(`Minting private tokens for ${sender.toString()}`);
188
188
 
189
189
  const from = sender; // we are setting from to sender here because we need a sender to calculate the tag
190
190
  calls.push(
191
191
  isStandardToken
192
- ? await token.methods.mint_to_private(from, sender, MINT_BALANCE).request()
193
- : await token.methods.mint(MINT_BALANCE, sender).request(),
192
+ ? token.methods.mint_to_private(from, sender, MINT_BALANCE)
193
+ : token.methods.mint(MINT_BALANCE, sender),
194
194
  );
195
195
  }
196
196
  if (isStandardToken && publicBalance < MIN_BALANCE) {
197
197
  this.log.info(`Minting public tokens for ${sender.toString()}`);
198
- calls.push(await token.methods.mint_to_public(sender, MINT_BALANCE).request());
198
+ calls.push(token.methods.mint_to_public(sender, MINT_BALANCE));
199
199
  }
200
200
  if (calls.length === 0) {
201
201
  this.log.info(`Skipping minting as ${sender.toString()} has enough tokens`);