@aztec/ethereum 0.81.0 → 0.82.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/contracts/fee_asset_handler.d.ts +18 -0
- package/dest/contracts/fee_asset_handler.d.ts.map +1 -0
- package/dest/contracts/fee_asset_handler.js +43 -0
- package/dest/contracts/index.d.ts +1 -0
- package/dest/contracts/index.d.ts.map +1 -1
- package/dest/contracts/index.js +1 -0
- package/dest/contracts/rollup.d.ts +30 -2
- package/dest/contracts/rollup.d.ts.map +1 -1
- package/dest/contracts/rollup.js +147 -19
- package/dest/deploy_l1_contracts.d.ts +1783 -249
- package/dest/deploy_l1_contracts.d.ts.map +1 -1
- package/dest/deploy_l1_contracts.js +49 -28
- package/dest/l1_contract_addresses.d.ts +4 -0
- package/dest/l1_contract_addresses.d.ts.map +1 -1
- package/dest/l1_contract_addresses.js +7 -1
- package/dest/l1_tx_utils.d.ts.map +1 -1
- package/dest/l1_tx_utils.js +1 -4
- package/package.json +4 -4
- package/src/contracts/fee_asset_handler.ts +45 -0
- package/src/contracts/index.ts +1 -0
- package/src/contracts/rollup.ts +144 -16
- package/src/deploy_l1_contracts.ts +58 -22
- package/src/l1_contract_addresses.ts +7 -1
- package/src/l1_tx_utils.ts +1 -2
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { type Hex } from 'viem';
|
|
3
|
+
import type { L1TxUtils } from '../l1_tx_utils.js';
|
|
4
|
+
export declare class FeeAssetHandlerContract {
|
|
5
|
+
readonly txUtils: L1TxUtils;
|
|
6
|
+
address: EthAddress;
|
|
7
|
+
constructor(address: Hex, txUtils: L1TxUtils);
|
|
8
|
+
getMintAmount(): Promise<bigint>;
|
|
9
|
+
mint(recipient: Hex): Promise<{
|
|
10
|
+
receipt: import("viem").TransactionReceipt;
|
|
11
|
+
gasPrice: import("../l1_tx_utils.js").GasPrice;
|
|
12
|
+
}>;
|
|
13
|
+
setMintAmount(amount: bigint): Promise<{
|
|
14
|
+
receipt: import("viem").TransactionReceipt;
|
|
15
|
+
gasPrice: import("../l1_tx_utils.js").GasPrice;
|
|
16
|
+
}>;
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=fee_asset_handler.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fee_asset_handler.d.ts","sourceRoot":"","sources":["../../src/contracts/fee_asset_handler.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAG3D,OAAO,EAAE,KAAK,GAAG,EAAmC,MAAM,MAAM,CAAC;AAEjE,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,mBAAmB,CAAC;AAEnD,qBAAa,uBAAuB;aAGQ,OAAO,EAAE,SAAS;IAFrD,OAAO,EAAE,UAAU,CAAC;gBAEf,OAAO,EAAE,GAAG,EAAkB,OAAO,EAAE,SAAS;IAIrD,aAAa;IASb,IAAI,CAAC,SAAS,EAAE,GAAG;;;;IAWnB,aAAa,CAAC,MAAM,EAAE,MAAM;;;;CAUpC"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
2
|
+
import { FeeAssetHandlerAbi } from '@aztec/l1-artifacts/FeeAssetHandlerAbi';
|
|
3
|
+
import { encodeFunctionData, getContract } from 'viem';
|
|
4
|
+
export class FeeAssetHandlerContract {
|
|
5
|
+
txUtils;
|
|
6
|
+
address;
|
|
7
|
+
constructor(address, txUtils){
|
|
8
|
+
this.txUtils = txUtils;
|
|
9
|
+
this.address = EthAddress.fromString(address);
|
|
10
|
+
}
|
|
11
|
+
getMintAmount() {
|
|
12
|
+
const contract = getContract({
|
|
13
|
+
abi: FeeAssetHandlerAbi,
|
|
14
|
+
address: this.address.toString(),
|
|
15
|
+
client: this.txUtils.publicClient
|
|
16
|
+
});
|
|
17
|
+
return contract.read.mintAmount();
|
|
18
|
+
}
|
|
19
|
+
mint(recipient) {
|
|
20
|
+
return this.txUtils.sendAndMonitorTransaction({
|
|
21
|
+
to: this.address.toString(),
|
|
22
|
+
data: encodeFunctionData({
|
|
23
|
+
abi: FeeAssetHandlerAbi,
|
|
24
|
+
functionName: 'mint',
|
|
25
|
+
args: [
|
|
26
|
+
recipient
|
|
27
|
+
]
|
|
28
|
+
})
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
setMintAmount(amount) {
|
|
32
|
+
return this.txUtils.sendAndMonitorTransaction({
|
|
33
|
+
to: this.address.toString(),
|
|
34
|
+
data: encodeFunctionData({
|
|
35
|
+
abi: FeeAssetHandlerAbi,
|
|
36
|
+
functionName: 'setMintAmount',
|
|
37
|
+
args: [
|
|
38
|
+
amount
|
|
39
|
+
]
|
|
40
|
+
})
|
|
41
|
+
});
|
|
42
|
+
}
|
|
43
|
+
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/contracts/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AACvC,cAAc,gBAAgB,CAAC;AAC/B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,iBAAiB,CAAC;AAChC,cAAc,0BAA0B,CAAC;AACzC,cAAc,eAAe,CAAC;AAC9B,cAAc,aAAa,CAAC;AAC5B,cAAc,wBAAwB,CAAC"}
|
package/dest/contracts/index.js
CHANGED
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
/// <reference types="node" resolution-mode="require"/>
|
|
3
3
|
import { EthAddress } from '@aztec/foundation/eth-address';
|
|
4
4
|
import type { ViemSignature } from '@aztec/foundation/eth-signature';
|
|
5
|
-
import {
|
|
5
|
+
import { RollupAbi } from '@aztec/l1-artifacts/RollupAbi';
|
|
6
|
+
import { type Account, type GetContractReturnType, type Hex } from 'viem';
|
|
6
7
|
import type { DeployL1ContractsReturnType } from '../deploy_l1_contracts.js';
|
|
7
8
|
import type { L1ContractAddresses } from '../l1_contract_addresses.js';
|
|
8
9
|
import type { L1ReaderConfig } from '../l1_reader.js';
|
|
@@ -26,6 +27,7 @@ export declare class RollupContract {
|
|
|
26
27
|
static getFromConfig(config: L1ReaderConfig): RollupContract;
|
|
27
28
|
constructor(client: ViemPublicClient, address: Hex | EthAddress);
|
|
28
29
|
get address(): `0x${string}`;
|
|
30
|
+
getContract(): GetContractReturnType<typeof RollupAbi, ViemPublicClient>;
|
|
29
31
|
getSlashingProposer(): Promise<SlashingProposerContract>;
|
|
30
32
|
getL1StartBlock(): Promise<bigint>;
|
|
31
33
|
getL1GenesisTime(): Promise<bigint>;
|
|
@@ -36,7 +38,9 @@ export declare class RollupContract {
|
|
|
36
38
|
getMinimumStake(): Promise<bigint>;
|
|
37
39
|
getManaTarget(): Promise<bigint>;
|
|
38
40
|
getProvingCostPerMana(): Promise<bigint>;
|
|
41
|
+
getProvingCostPerManaInFeeAsset(): Promise<bigint>;
|
|
39
42
|
getManaLimit(): Promise<bigint>;
|
|
43
|
+
getSlasher(): Promise<`0x${string}`>;
|
|
40
44
|
getSlashingProposerAddress(): Promise<EthAddress>;
|
|
41
45
|
getBlockNumber(): Promise<bigint>;
|
|
42
46
|
getProvenBlockNumber(): Promise<bigint>;
|
|
@@ -83,6 +87,30 @@ export declare class RollupContract {
|
|
|
83
87
|
*/
|
|
84
88
|
canProposeAtNextEthBlock(archive: Buffer, account: `0x${string}` | Account, slotDuration: bigint | number): Promise<[bigint, bigint]>;
|
|
85
89
|
/** Calls getHasSubmitted directly. Returns whether the given prover has submitted a proof with the given length for the given epoch. */
|
|
86
|
-
getHasSubmittedProof(epochNumber: number, numberOfBlocksInEpoch: number, prover: EthAddress): Promise<boolean>;
|
|
90
|
+
getHasSubmittedProof(epochNumber: number, numberOfBlocksInEpoch: number, prover: Hex | EthAddress): Promise<boolean>;
|
|
91
|
+
getManaBaseFeeAt(timestamp: bigint, inFeeAsset: boolean): Promise<bigint>;
|
|
92
|
+
getVersion(): Promise<bigint>;
|
|
93
|
+
getSlotAt(timestamp: bigint): Promise<bigint>;
|
|
94
|
+
status(blockNumber: bigint, options?: {
|
|
95
|
+
blockNumber?: bigint;
|
|
96
|
+
}): Promise<readonly [bigint, `0x${string}`, bigint, `0x${string}`, `0x${string}`, bigint]>;
|
|
97
|
+
canPruneAtTime(timestamp: bigint, options?: {
|
|
98
|
+
blockNumber?: bigint;
|
|
99
|
+
}): Promise<boolean>;
|
|
100
|
+
archive(): Promise<`0x${string}`>;
|
|
101
|
+
archiveAt(blockNumber: bigint): Promise<`0x${string}`>;
|
|
102
|
+
getSequencerRewards(address: Hex | EthAddress): Promise<bigint>;
|
|
103
|
+
getSpecificProverRewardsForEpoch(epoch: bigint, prover: Hex | EthAddress): Promise<bigint>;
|
|
104
|
+
getAttesters(): Promise<readonly `0x${string}`[]>;
|
|
105
|
+
getEpochCommittee(epoch: bigint): Promise<readonly `0x${string}`[]>;
|
|
106
|
+
getInfo(address: Hex | EthAddress): Promise<{
|
|
107
|
+
stake: bigint;
|
|
108
|
+
withdrawer: `0x${string}`;
|
|
109
|
+
proposer: `0x${string}`;
|
|
110
|
+
status: number;
|
|
111
|
+
}>;
|
|
112
|
+
getBlobPublicInputsHash(blockNumber: bigint): Promise<`0x${string}`>;
|
|
113
|
+
getStakingAsset(): Promise<`0x${string}`>;
|
|
114
|
+
getProposerForAttester(attester: Hex | EthAddress): Promise<`0x${string}`>;
|
|
87
115
|
}
|
|
88
116
|
//# sourceMappingURL=rollup.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../../src/contracts/rollup.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;
|
|
1
|
+
{"version":3,"file":"rollup.d.ts","sourceRoot":"","sources":["../../src/contracts/rollup.ts"],"names":[],"mappings":";;AACA,OAAO,EAAE,UAAU,EAAE,MAAM,+BAA+B,CAAC;AAC3D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,iCAAiC,CAAC;AACrE,OAAO,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAI1D,OAAO,EAAE,KAAK,OAAO,EAAE,KAAK,qBAAqB,EAAE,KAAK,GAAG,EAA2B,MAAM,MAAM,CAAC;AAGnG,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,2BAA2B,CAAC;AAC7E,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,iBAAiB,CAAC;AACtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAEpD,OAAO,EAAE,wBAAwB,EAAE,MAAM,wBAAwB,CAAC;AAElE,MAAM,MAAM,yBAAyB,GAAG,IAAI,CAC1C,mBAAmB,EACjB,eAAe,GACf,cAAc,GACd,eAAe,GACf,uBAAuB,GACvB,iBAAiB,GACjB,qBAAqB,GACrB,0BAA0B,GAC1B,qBAAqB,CACxB,CAAC;AAEF,MAAM,MAAM,yBAAyB,GAAG;IACtC,eAAe,EAAE,KAAK,MAAM,EAAE,CAAC;IAC/B,UAAU,EAAE,KAAK,MAAM,EAAE,CAAC;IAC1B,iBAAiB,EAAE,KAAK,MAAM,EAAE,CAAC;IACjC,YAAY,EAAE,KAAK,MAAM,EAAE,CAA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AAY;IAIZ,iBAAiB,CAAC,KAAK,EAAE,MAAM;IAI/B,OAAO,CAAC,OAAO,EAAE,GAAG,GAAG,UAAU;;;;;;IAOjC,uBAAuB,CAAC,WAAW,EAAE,MAAM;IAI3C,eAAe;IAIf,sBAAsB,CAAC,QAAQ,EAAE,GAAG,GAAG,UAAU;CAMlD"}
|
package/dest/contracts/rollup.js
CHANGED
|
@@ -46,6 +46,9 @@ export class RollupContract {
|
|
|
46
46
|
get address() {
|
|
47
47
|
return this.rollup.address;
|
|
48
48
|
}
|
|
49
|
+
getContract() {
|
|
50
|
+
return this.rollup;
|
|
51
|
+
}
|
|
49
52
|
async getSlashingProposer() {
|
|
50
53
|
const slasherAddress = await this.rollup.read.getSlasher();
|
|
51
54
|
const slasher = getContract({
|
|
@@ -83,11 +86,17 @@ export class RollupContract {
|
|
|
83
86
|
getProvingCostPerMana() {
|
|
84
87
|
return this.rollup.read.getProvingCostPerManaInEth();
|
|
85
88
|
}
|
|
89
|
+
getProvingCostPerManaInFeeAsset() {
|
|
90
|
+
return this.rollup.read.getProvingCostPerManaInFeeAsset();
|
|
91
|
+
}
|
|
86
92
|
getManaLimit() {
|
|
87
93
|
return this.rollup.read.getManaLimit();
|
|
88
94
|
}
|
|
95
|
+
getSlasher() {
|
|
96
|
+
return this.rollup.read.getSlasher();
|
|
97
|
+
}
|
|
89
98
|
async getSlashingProposerAddress() {
|
|
90
|
-
const slasherAddress = await this.
|
|
99
|
+
const slasherAddress = await this.getSlasher();
|
|
91
100
|
const slasher = getContract({
|
|
92
101
|
address: getAddress(slasherAddress.toString()),
|
|
93
102
|
abi: SlasherAbi,
|
|
@@ -104,10 +113,16 @@ export class RollupContract {
|
|
|
104
113
|
getSlotNumber() {
|
|
105
114
|
return this.rollup.read.getCurrentSlot();
|
|
106
115
|
}
|
|
107
|
-
getCommitteeAt(timestamp) {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
116
|
+
async getCommitteeAt(timestamp) {
|
|
117
|
+
const { result } = await this.client.simulateContract({
|
|
118
|
+
address: this.address,
|
|
119
|
+
abi: RollupAbi,
|
|
120
|
+
functionName: 'getCommitteeAt',
|
|
121
|
+
args: [
|
|
122
|
+
timestamp
|
|
123
|
+
]
|
|
124
|
+
});
|
|
125
|
+
return result;
|
|
111
126
|
}
|
|
112
127
|
getSampleSeedAt(timestamp) {
|
|
113
128
|
return this.rollup.read.getSampleSeedAt([
|
|
@@ -117,16 +132,34 @@ export class RollupContract {
|
|
|
117
132
|
getCurrentSampleSeed() {
|
|
118
133
|
return this.rollup.read.getCurrentSampleSeed();
|
|
119
134
|
}
|
|
120
|
-
getCurrentEpochCommittee() {
|
|
121
|
-
|
|
135
|
+
async getCurrentEpochCommittee() {
|
|
136
|
+
const { result } = await this.client.simulateContract({
|
|
137
|
+
address: this.address,
|
|
138
|
+
abi: RollupAbi,
|
|
139
|
+
functionName: 'getCurrentEpochCommittee',
|
|
140
|
+
args: []
|
|
141
|
+
});
|
|
142
|
+
return result;
|
|
122
143
|
}
|
|
123
|
-
getCurrentProposer() {
|
|
124
|
-
|
|
144
|
+
async getCurrentProposer() {
|
|
145
|
+
const { result } = await this.client.simulateContract({
|
|
146
|
+
address: this.address,
|
|
147
|
+
abi: RollupAbi,
|
|
148
|
+
functionName: 'getCurrentProposer',
|
|
149
|
+
args: []
|
|
150
|
+
});
|
|
151
|
+
return result;
|
|
125
152
|
}
|
|
126
|
-
getProposerAt(timestamp) {
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
153
|
+
async getProposerAt(timestamp) {
|
|
154
|
+
const { result } = await this.client.simulateContract({
|
|
155
|
+
address: this.address,
|
|
156
|
+
abi: RollupAbi,
|
|
157
|
+
functionName: 'getProposerAt',
|
|
158
|
+
args: [
|
|
159
|
+
timestamp
|
|
160
|
+
]
|
|
161
|
+
});
|
|
162
|
+
return result;
|
|
130
163
|
}
|
|
131
164
|
getBlock(blockNumber) {
|
|
132
165
|
return this.rollup.read.getBlock([
|
|
@@ -176,7 +209,11 @@ export class RollupContract {
|
|
|
176
209
|
}
|
|
177
210
|
async validateHeader(args, account) {
|
|
178
211
|
try {
|
|
179
|
-
await this.
|
|
212
|
+
await this.client.simulateContract({
|
|
213
|
+
address: this.address,
|
|
214
|
+
abi: RollupAbi,
|
|
215
|
+
functionName: 'validateHeader',
|
|
216
|
+
args,
|
|
180
217
|
account
|
|
181
218
|
});
|
|
182
219
|
} catch (error) {
|
|
@@ -197,10 +234,14 @@ export class RollupContract {
|
|
|
197
234
|
}
|
|
198
235
|
const timeOfNextL1Slot = (await this.client.getBlock()).timestamp + slotDuration;
|
|
199
236
|
try {
|
|
200
|
-
const [slot, blockNumber] = await this.
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
237
|
+
const { result: [slot, blockNumber] } = await this.client.simulateContract({
|
|
238
|
+
address: this.address,
|
|
239
|
+
abi: RollupAbi,
|
|
240
|
+
functionName: 'canProposeAtTime',
|
|
241
|
+
args: [
|
|
242
|
+
timeOfNextL1Slot,
|
|
243
|
+
`0x${archive.toString('hex')}`
|
|
244
|
+
],
|
|
204
245
|
account
|
|
205
246
|
});
|
|
206
247
|
return [
|
|
@@ -212,10 +253,94 @@ export class RollupContract {
|
|
|
212
253
|
}
|
|
213
254
|
}
|
|
214
255
|
/** Calls getHasSubmitted directly. Returns whether the given prover has submitted a proof with the given length for the given epoch. */ getHasSubmittedProof(epochNumber, numberOfBlocksInEpoch, prover) {
|
|
256
|
+
if (prover instanceof EthAddress) {
|
|
257
|
+
prover = prover.toString();
|
|
258
|
+
}
|
|
215
259
|
return this.rollup.read.getHasSubmitted([
|
|
216
260
|
BigInt(epochNumber),
|
|
217
261
|
BigInt(numberOfBlocksInEpoch),
|
|
218
|
-
prover
|
|
262
|
+
prover
|
|
263
|
+
]);
|
|
264
|
+
}
|
|
265
|
+
getManaBaseFeeAt(timestamp, inFeeAsset) {
|
|
266
|
+
return this.rollup.read.getManaBaseFeeAt([
|
|
267
|
+
timestamp,
|
|
268
|
+
inFeeAsset
|
|
269
|
+
]);
|
|
270
|
+
}
|
|
271
|
+
getVersion() {
|
|
272
|
+
return this.rollup.read.getVersion();
|
|
273
|
+
}
|
|
274
|
+
getSlotAt(timestamp) {
|
|
275
|
+
return this.rollup.read.getSlotAt([
|
|
276
|
+
timestamp
|
|
277
|
+
]);
|
|
278
|
+
}
|
|
279
|
+
status(blockNumber, options) {
|
|
280
|
+
return this.rollup.read.status([
|
|
281
|
+
blockNumber
|
|
282
|
+
], options);
|
|
283
|
+
}
|
|
284
|
+
canPruneAtTime(timestamp, options) {
|
|
285
|
+
return this.rollup.read.canPruneAtTime([
|
|
286
|
+
timestamp
|
|
287
|
+
], options);
|
|
288
|
+
}
|
|
289
|
+
archive() {
|
|
290
|
+
return this.rollup.read.archive();
|
|
291
|
+
}
|
|
292
|
+
archiveAt(blockNumber) {
|
|
293
|
+
return this.rollup.read.archiveAt([
|
|
294
|
+
blockNumber
|
|
295
|
+
]);
|
|
296
|
+
}
|
|
297
|
+
getSequencerRewards(address) {
|
|
298
|
+
if (address instanceof EthAddress) {
|
|
299
|
+
address = address.toString();
|
|
300
|
+
}
|
|
301
|
+
return this.rollup.read.getSequencerRewards([
|
|
302
|
+
address
|
|
303
|
+
]);
|
|
304
|
+
}
|
|
305
|
+
getSpecificProverRewardsForEpoch(epoch, prover) {
|
|
306
|
+
if (prover instanceof EthAddress) {
|
|
307
|
+
prover = prover.toString();
|
|
308
|
+
}
|
|
309
|
+
return this.rollup.read.getSpecificProverRewardsForEpoch([
|
|
310
|
+
epoch,
|
|
311
|
+
prover
|
|
312
|
+
]);
|
|
313
|
+
}
|
|
314
|
+
getAttesters() {
|
|
315
|
+
return this.rollup.read.getAttesters();
|
|
316
|
+
}
|
|
317
|
+
getEpochCommittee(epoch) {
|
|
318
|
+
return this.rollup.read.getEpochCommittee([
|
|
319
|
+
epoch
|
|
320
|
+
]);
|
|
321
|
+
}
|
|
322
|
+
getInfo(address) {
|
|
323
|
+
if (address instanceof EthAddress) {
|
|
324
|
+
address = address.toString();
|
|
325
|
+
}
|
|
326
|
+
return this.rollup.read.getInfo([
|
|
327
|
+
address
|
|
328
|
+
]);
|
|
329
|
+
}
|
|
330
|
+
getBlobPublicInputsHash(blockNumber) {
|
|
331
|
+
return this.rollup.read.getBlobPublicInputsHash([
|
|
332
|
+
blockNumber
|
|
333
|
+
]);
|
|
334
|
+
}
|
|
335
|
+
getStakingAsset() {
|
|
336
|
+
return this.rollup.read.getStakingAsset();
|
|
337
|
+
}
|
|
338
|
+
getProposerForAttester(attester) {
|
|
339
|
+
if (attester instanceof EthAddress) {
|
|
340
|
+
attester = attester.toString();
|
|
341
|
+
}
|
|
342
|
+
return this.rollup.read.getProposerForAttester([
|
|
343
|
+
attester
|
|
219
344
|
]);
|
|
220
345
|
}
|
|
221
346
|
}
|
|
@@ -249,6 +374,9 @@ _ts_decorate([
|
|
|
249
374
|
_ts_decorate([
|
|
250
375
|
memoize
|
|
251
376
|
], RollupContract.prototype, "getProvingCostPerMana", null);
|
|
377
|
+
_ts_decorate([
|
|
378
|
+
memoize
|
|
379
|
+
], RollupContract.prototype, "getProvingCostPerManaInFeeAsset", null);
|
|
252
380
|
_ts_decorate([
|
|
253
381
|
memoize
|
|
254
382
|
], RollupContract.prototype, "getManaLimit", null);
|