@aztec/bot 0.0.0-test.1 → 0.0.1-fake-ceab37513c
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 +33 -0
- package/dest/amm_bot.d.ts.map +1 -0
- package/dest/amm_bot.js +94 -0
- package/dest/base_bot.d.ts +18 -0
- package/dest/base_bot.d.ts.map +1 -0
- package/dest/base_bot.js +80 -0
- package/dest/bot.d.ts +10 -14
- package/dest/bot.d.ts.map +1 -1
- package/dest/bot.js +21 -82
- package/dest/config.d.ts +51 -30
- package/dest/config.d.ts.map +1 -1
- package/dest/config.js +40 -19
- package/dest/factory.d.ts +27 -6
- package/dest/factory.d.ts.map +1 -1
- package/dest/factory.js +200 -75
- package/dest/index.d.ts +2 -1
- package/dest/index.d.ts.map +1 -1
- package/dest/index.js +2 -1
- package/dest/interface.d.ts +11 -0
- package/dest/interface.d.ts.map +1 -1
- package/dest/interface.js +5 -0
- package/dest/rpc.d.ts +0 -6
- package/dest/rpc.d.ts.map +1 -1
- package/dest/rpc.js +0 -11
- package/dest/runner.d.ts +6 -1
- package/dest/runner.d.ts.map +1 -1
- package/dest/runner.js +31 -9
- package/dest/utils.d.ts +6 -3
- package/dest/utils.d.ts.map +1 -1
- package/dest/utils.js +12 -3
- package/package.json +22 -21
- package/src/amm_bot.ts +116 -0
- package/src/base_bot.ts +94 -0
- package/src/bot.ts +36 -98
- package/src/config.ts +52 -22
- package/src/factory.ts +256 -78
- package/src/index.ts +2 -1
- package/src/interface.ts +9 -0
- package/src/rpc.ts +0 -13
- package/src/runner.ts +32 -11
- package/src/utils.ts +12 -6
package/src/utils.ts
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { ContractBase } from '@aztec/aztec.js';
|
|
2
|
+
import type { AMMContract } from '@aztec/noir-contracts.js/AMM';
|
|
3
|
+
import type { PrivateTokenContract } from '@aztec/noir-contracts.js/PrivateToken';
|
|
2
4
|
import type { TokenContract } from '@aztec/noir-contracts.js/Token';
|
|
3
5
|
import type { AztecAddress } from '@aztec/stdlib/aztec-address';
|
|
4
6
|
|
|
@@ -12,16 +14,20 @@ export async function getBalances(
|
|
|
12
14
|
token: TokenContract,
|
|
13
15
|
who: AztecAddress,
|
|
14
16
|
): Promise<{ privateBalance: bigint; publicBalance: bigint }> {
|
|
15
|
-
const privateBalance = await token.methods.balance_of_private(who).simulate();
|
|
16
|
-
const publicBalance = await token.methods.balance_of_public(who).simulate();
|
|
17
|
+
const privateBalance = await token.methods.balance_of_private(who).simulate({ from: who });
|
|
18
|
+
const publicBalance = await token.methods.balance_of_public(who).simulate({ from: who });
|
|
17
19
|
return { privateBalance, publicBalance };
|
|
18
20
|
}
|
|
19
21
|
|
|
20
|
-
export async function getPrivateBalance(token:
|
|
21
|
-
const privateBalance = await token.methods.get_balance(who).simulate();
|
|
22
|
+
export async function getPrivateBalance(token: PrivateTokenContract, who: AztecAddress): Promise<bigint> {
|
|
23
|
+
const privateBalance = await token.methods.get_balance(who).simulate({ from: who });
|
|
22
24
|
return privateBalance;
|
|
23
25
|
}
|
|
24
26
|
|
|
25
|
-
export function isStandardTokenContract(token:
|
|
27
|
+
export function isStandardTokenContract(token: ContractBase): token is TokenContract {
|
|
26
28
|
return 'mint_to_public' in token.methods;
|
|
27
29
|
}
|
|
30
|
+
|
|
31
|
+
export function isAMMContract(contract: ContractBase): contract is AMMContract {
|
|
32
|
+
return 'add_liquidity' in contract.methods;
|
|
33
|
+
}
|