@argonprotocol/testing 1.4.3-dev.7c826893 → 1.4.3-dev.83602b96
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/lib/index.cjs +1462 -16
- package/lib/index.cjs.map +1 -1
- package/lib/index.d.cts +265 -2
- package/lib/index.d.ts +265 -2
- package/lib/index.js +1485 -15
- package/lib/index.js.map +1 -1
- package/package.json +6 -6
package/lib/index.d.cts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _argonprotocol_mainchain from '@argonprotocol/mainchain';
|
|
2
|
+
import { KeyringPair, ArgonClient, EthereumReceipt, EthereumBeaconHeaderDetailsResponse, EthereumBeaconBlockResponse, EvmContracts, IArgonQueryable } from '@argonprotocol/mainchain';
|
|
2
3
|
import { Client } from 'pg';
|
|
4
|
+
import * as viem from 'viem';
|
|
5
|
+
import { Hex, createWalletClient, defineChain, Address, ContractFunctionArgs } from 'viem';
|
|
6
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
7
|
+
import * as _polkadot_types_codec from '@polkadot/types-codec';
|
|
3
8
|
|
|
4
9
|
declare class TestNotary implements ITeardownable {
|
|
5
10
|
#private;
|
|
@@ -119,6 +124,51 @@ declare class TestOracle implements ITeardownable {
|
|
|
119
124
|
teardown(): Promise<void>;
|
|
120
125
|
}
|
|
121
126
|
|
|
127
|
+
interface EthereumEndpoints {
|
|
128
|
+
executionRpcUrl: string;
|
|
129
|
+
beaconApiUrl: string;
|
|
130
|
+
chainId: string;
|
|
131
|
+
}
|
|
132
|
+
interface EthereumMintingGatewayFixture {
|
|
133
|
+
argonTokenAddress: Hex;
|
|
134
|
+
argonotTokenAddress: Hex;
|
|
135
|
+
gatewayAddress: Hex;
|
|
136
|
+
}
|
|
137
|
+
interface EthereumPrefundedAccount {
|
|
138
|
+
balance: string;
|
|
139
|
+
}
|
|
140
|
+
type EthereumConsensusClient = 'lighthouse' | 'lodestar';
|
|
141
|
+
type EthereumBeaconPreset = 'mainnet' | 'minimal';
|
|
142
|
+
declare class TestEthereum implements ITeardownable {
|
|
143
|
+
#private;
|
|
144
|
+
readonly enclaveName: string;
|
|
145
|
+
readonly kurtosisBin: string;
|
|
146
|
+
readonly packageRef: string;
|
|
147
|
+
executionRpcUrl?: string;
|
|
148
|
+
beaconApiUrl?: string;
|
|
149
|
+
chainId?: string;
|
|
150
|
+
constructor(enclaveName?: string, kurtosisBin?: string, packageRef?: string);
|
|
151
|
+
static isInstalled(kurtosisBin?: string): boolean;
|
|
152
|
+
launch(options?: {
|
|
153
|
+
consensusClient?: EthereumConsensusClient;
|
|
154
|
+
preset?: EthereumBeaconPreset;
|
|
155
|
+
secondsPerSlot?: number;
|
|
156
|
+
waitForFinalization?: boolean;
|
|
157
|
+
prefundedAccounts?: Record<string, EthereumPrefundedAccount>;
|
|
158
|
+
}): Promise<EthereumEndpoints>;
|
|
159
|
+
callExecution<TResult>(method: string, params?: unknown[]): Promise<TResult>;
|
|
160
|
+
getBeacon<TResult>(path: string): Promise<TResult>;
|
|
161
|
+
deployMintingGatewayFixture(options: {
|
|
162
|
+
deployerPrivateKey: Hex;
|
|
163
|
+
adminSafe?: Hex;
|
|
164
|
+
guardianSafe?: Hex;
|
|
165
|
+
initialMicrogonsPerArgonot?: bigint;
|
|
166
|
+
seedArgonRecipient?: Hex;
|
|
167
|
+
seedArgonAmountBaseUnits?: bigint;
|
|
168
|
+
}): Promise<EthereumMintingGatewayFixture>;
|
|
169
|
+
teardown(): Promise<void>;
|
|
170
|
+
}
|
|
171
|
+
|
|
122
172
|
declare function startNetwork(testName: string, options?: {
|
|
123
173
|
shouldLog: boolean;
|
|
124
174
|
dockerEnv?: Record<string, string>;
|
|
@@ -127,6 +177,219 @@ declare function startNetwork(testName: string, options?: {
|
|
|
127
177
|
notaryUrl: string;
|
|
128
178
|
}>;
|
|
129
179
|
|
|
180
|
+
declare function signGatewayPermit(args: {
|
|
181
|
+
account: ReturnType<typeof privateKeyToAccount>;
|
|
182
|
+
chainId: number;
|
|
183
|
+
tokenAddress: Hex;
|
|
184
|
+
gatewayAddress: Hex;
|
|
185
|
+
owner: Hex;
|
|
186
|
+
value: bigint;
|
|
187
|
+
nonce: bigint;
|
|
188
|
+
deadline: bigint;
|
|
189
|
+
}): Promise<{
|
|
190
|
+
v: number;
|
|
191
|
+
r: `0x${string}`;
|
|
192
|
+
s: `0x${string}`;
|
|
193
|
+
}>;
|
|
194
|
+
declare function waitForFinalizedBeaconExecutionAtOrAbove(ethereum: TestEthereum, minimumExecutionBlockNumber: bigint, options?: {
|
|
195
|
+
minimumFinalizedSlot?: bigint;
|
|
196
|
+
}): Promise<{
|
|
197
|
+
header: EthereumBeaconHeaderDetailsResponse;
|
|
198
|
+
block: EthereumBeaconBlockResponse;
|
|
199
|
+
}>;
|
|
200
|
+
declare function mineLaterExecutionAnchorReceipt(walletClient: Pick<ReturnType<typeof createWalletClient>, 'sendTransaction'>, chain: ReturnType<typeof defineChain>, ethereum: TestEthereum, account: ReturnType<typeof privateKeyToAccount>, minimumBlockNumber: bigint): Promise<viem.TransactionReceipt>;
|
|
201
|
+
declare function waitForExecutionReceipt(ethereum: TestEthereum, transactionHash: Hex): Promise<EthereumReceipt>;
|
|
202
|
+
declare function syncEthereumVerifierUntilAnchorCovers(mainchainClient: ArgonClient, relayer: KeyringPair, beaconApiUrl: string, minimumExecutionBlockNumber: bigint): Promise<void>;
|
|
203
|
+
declare function toArgonKeccakSignature(signature: Hex): Hex;
|
|
204
|
+
declare function toEvmRecoverableSignature(signature: Hex): Hex;
|
|
205
|
+
|
|
206
|
+
type ApplyGatewayUpdatesArgs = ContractFunctionArgs<typeof EvmContracts.mintingGatewayAbi, 'nonpayable', 'applyGatewayUpdates'>;
|
|
207
|
+
type MintingGatewayCouncilSnapshot = ApplyGatewayUpdatesArgs[0];
|
|
208
|
+
type MintingGatewayGatewayUpdate = ApplyGatewayUpdatesArgs[1][number];
|
|
209
|
+
type EthereumGatewayUpdateBatch = {
|
|
210
|
+
destinationChain: 'Ethereum';
|
|
211
|
+
chainId: bigint;
|
|
212
|
+
gatewayAddress: Address;
|
|
213
|
+
currentCouncilHash: Hex;
|
|
214
|
+
currentCouncil: MintingGatewayCouncilSnapshot;
|
|
215
|
+
argonApprovalsNonce: bigint;
|
|
216
|
+
argonApprovalsHash: Hex;
|
|
217
|
+
paused: boolean;
|
|
218
|
+
firstQueueNonce?: bigint;
|
|
219
|
+
lastQueueNonce?: bigint;
|
|
220
|
+
updates: MintingGatewayGatewayUpdate[];
|
|
221
|
+
};
|
|
222
|
+
declare function getReadyEthereumGatewayUpdates(client: IArgonQueryable, gatewayClient: {
|
|
223
|
+
readContract: (...args: any[]) => Promise<unknown>;
|
|
224
|
+
}, options?: {
|
|
225
|
+
destinationChain?: 'Ethereum';
|
|
226
|
+
maxQueueEntries?: number;
|
|
227
|
+
}): Promise<EthereumGatewayUpdateBatch>;
|
|
228
|
+
|
|
229
|
+
type DeployerAccount = ReturnType<typeof privateKeyToAccount>;
|
|
230
|
+
type EthereumChain = ReturnType<typeof defineChain>;
|
|
231
|
+
type EthereumPublicClient = {
|
|
232
|
+
getBalance: (args: {
|
|
233
|
+
address: Hex;
|
|
234
|
+
}) => Promise<bigint>;
|
|
235
|
+
getBlock: (...args: any[]) => Promise<any>;
|
|
236
|
+
getBlockNumber: () => Promise<bigint>;
|
|
237
|
+
readContract: (...args: any[]) => Promise<unknown>;
|
|
238
|
+
waitForTransactionReceipt: (args: {
|
|
239
|
+
hash: Hex;
|
|
240
|
+
}) => Promise<{
|
|
241
|
+
status: string;
|
|
242
|
+
blockNumber: bigint;
|
|
243
|
+
}>;
|
|
244
|
+
};
|
|
245
|
+
type EthereumWalletClient = {
|
|
246
|
+
sendTransaction: (...args: any[]) => Promise<Hex>;
|
|
247
|
+
writeContract: (...args: any[]) => Promise<Hex>;
|
|
248
|
+
};
|
|
249
|
+
type GatewayDeployment = Awaited<ReturnType<TestEthereum['deployMintingGatewayFixture']>>;
|
|
250
|
+
declare class EthereumProofE2eHarness {
|
|
251
|
+
readonly ethereum: TestEthereum;
|
|
252
|
+
readonly endpoints: Awaited<ReturnType<TestEthereum['launch']>>;
|
|
253
|
+
readonly mainchain: TestMainchain;
|
|
254
|
+
readonly sudoSigner: KeyringPair;
|
|
255
|
+
readonly deployer: DeployerAccount;
|
|
256
|
+
readonly chain: EthereumChain;
|
|
257
|
+
readonly publicClient: EthereumPublicClient;
|
|
258
|
+
readonly walletClient: EthereumWalletClient;
|
|
259
|
+
readonly mainchainClient: ArgonClient;
|
|
260
|
+
readonly proofRelayer: KeyringPair;
|
|
261
|
+
private constructor();
|
|
262
|
+
static launch(args: {
|
|
263
|
+
testAccount: {
|
|
264
|
+
address: Hex;
|
|
265
|
+
balance: string;
|
|
266
|
+
privateKey: Hex;
|
|
267
|
+
};
|
|
268
|
+
proofRelayerUri: string;
|
|
269
|
+
}): Promise<EthereumProofE2eHarness>;
|
|
270
|
+
submit(tx: unknown, signer: KeyringPair): Promise<_argonprotocol_mainchain.TxResult>;
|
|
271
|
+
sudoSubmit(tx: unknown): Promise<_argonprotocol_mainchain.TxResult>;
|
|
272
|
+
bootstrapVerifier(): Promise<_argonprotocol_mainchain.TxResult>;
|
|
273
|
+
syncVerifierThrough(minimumExecutionBlockNumber: bigint): Promise<void>;
|
|
274
|
+
proveGatewayActivity(gatewayAddress: Hex, throughExecutionBlockNumber: bigint): Promise<{
|
|
275
|
+
payload: _argonprotocol_mainchain.EthereumGatewayActivityProofPayload;
|
|
276
|
+
result: _argonprotocol_mainchain.TxResult;
|
|
277
|
+
}>;
|
|
278
|
+
setEthereumChainConfig(gateway: TestMintingGateway): Promise<_argonprotocol_mainchain.TxResult>;
|
|
279
|
+
fundBurnAccount(amount: bigint): Promise<_argonprotocol_mainchain.TxResult>;
|
|
280
|
+
fundProofRelayer(amount?: bigint): Promise<_argonprotocol_mainchain.TxResult>;
|
|
281
|
+
forceSetBalance(address: string, amount: bigint): Promise<_argonprotocol_mainchain.TxResult>;
|
|
282
|
+
forceSetOwnership(address: string, amount: bigint): Promise<_argonprotocol_mainchain.TxResult>;
|
|
283
|
+
waitForExecutionFinalizedAfter(minimumExecutionBlockNumber: bigint): Promise<viem.TransactionReceipt>;
|
|
284
|
+
}
|
|
285
|
+
declare class TestMintingGateway {
|
|
286
|
+
readonly harness: EthereumProofE2eHarness;
|
|
287
|
+
readonly deployment: GatewayDeployment;
|
|
288
|
+
private constructor();
|
|
289
|
+
static deploy(harness: EthereumProofE2eHarness, options: Parameters<TestEthereum['deployMintingGatewayFixture']>[0]): Promise<TestMintingGateway>;
|
|
290
|
+
get gatewayAddress(): `0x${string}`;
|
|
291
|
+
get argonTokenAddress(): `0x${string}`;
|
|
292
|
+
get argonotTokenAddress(): `0x${string}`;
|
|
293
|
+
startTransferToArgon(args: {
|
|
294
|
+
account: DeployerAccount;
|
|
295
|
+
amountRuntimeUnits: bigint;
|
|
296
|
+
recipientArgonAddress: Hex;
|
|
297
|
+
}): Promise<viem.TransactionReceipt>;
|
|
298
|
+
forceUpdateActiveCouncil(currentCouncil: {
|
|
299
|
+
signers: Hex[];
|
|
300
|
+
weights: bigint[];
|
|
301
|
+
}): Promise<{
|
|
302
|
+
status: string;
|
|
303
|
+
blockNumber: bigint;
|
|
304
|
+
}>;
|
|
305
|
+
relayReadyApprovals(batch: Awaited<ReturnType<typeof getReadyEthereumGatewayUpdates>>, operatorAddress: string): Promise<{
|
|
306
|
+
status: string;
|
|
307
|
+
blockNumber: bigint;
|
|
308
|
+
}>;
|
|
309
|
+
argonApprovalsNonce(): Promise<bigint>;
|
|
310
|
+
globalIssuanceCouncil(): Promise<[Hex[], bigint[], Hex]>;
|
|
311
|
+
authorityCollateral(signingKey: Hex): Promise<[bigint, bigint]>;
|
|
312
|
+
finalizeTransferOut(args: {
|
|
313
|
+
transferRequest: {
|
|
314
|
+
argonAccountId: Hex;
|
|
315
|
+
argonTransferNonce: bigint;
|
|
316
|
+
chainId: bigint;
|
|
317
|
+
councilHash: Hex;
|
|
318
|
+
recipient: Hex;
|
|
319
|
+
validUntilBlock: bigint;
|
|
320
|
+
token: Hex;
|
|
321
|
+
amount: bigint;
|
|
322
|
+
mintingAuthorityTip: bigint;
|
|
323
|
+
};
|
|
324
|
+
collateralizationSignature: Hex;
|
|
325
|
+
micronotCollateral: bigint;
|
|
326
|
+
}): Promise<{
|
|
327
|
+
status: string;
|
|
328
|
+
blockNumber: bigint;
|
|
329
|
+
}>;
|
|
330
|
+
isFinalizedTransferOut(transferRequest: Parameters<typeof EvmContracts.hashMintingGatewayTransferOutOfArgonRequest>[0]): Promise<boolean>;
|
|
331
|
+
argonBalance(address: Hex): Promise<bigint>;
|
|
332
|
+
fundExecutionAccount(address: Hex, value: bigint): Promise<{
|
|
333
|
+
status: string;
|
|
334
|
+
blockNumber: bigint;
|
|
335
|
+
}>;
|
|
336
|
+
}
|
|
337
|
+
declare class TestMintingAuthorityActor {
|
|
338
|
+
readonly harness: EthereumProofE2eHarness;
|
|
339
|
+
readonly operator: KeyringPair;
|
|
340
|
+
readonly councilSigner: DeployerAccount;
|
|
341
|
+
readonly authoritySigner: DeployerAccount;
|
|
342
|
+
private gateway?;
|
|
343
|
+
constructor(harness: EthereumProofE2eHarness, args: {
|
|
344
|
+
operatorUri: string;
|
|
345
|
+
councilPrivateKey: Hex;
|
|
346
|
+
authorityPrivateKey: Hex;
|
|
347
|
+
});
|
|
348
|
+
attachGateway(gateway: TestMintingGateway): void;
|
|
349
|
+
prepareOperator(args: {
|
|
350
|
+
freeBalance: bigint;
|
|
351
|
+
ownershipBalance: bigint;
|
|
352
|
+
committedArgonots: bigint;
|
|
353
|
+
bitcoinXpub: string;
|
|
354
|
+
}): Promise<void>;
|
|
355
|
+
registerCouncilSigner(): Promise<_argonprotocol_mainchain.TxResult>;
|
|
356
|
+
forceSingleMemberCouncil(): Promise<{
|
|
357
|
+
activeCouncilHash: `0x${string}`;
|
|
358
|
+
activeCouncil: _argonprotocol_mainchain.PalletCrosschainTransferGlobalIssuanceCouncil;
|
|
359
|
+
currentCouncil: {
|
|
360
|
+
signers: `0x${string}`[];
|
|
361
|
+
weights: bigint[];
|
|
362
|
+
};
|
|
363
|
+
}>;
|
|
364
|
+
setMinimumValue(value: bigint): Promise<_argonprotocol_mainchain.TxResult>;
|
|
365
|
+
registerMintingAuthority(micronotCollateral: bigint): Promise<_argonprotocol_mainchain.TxResult>;
|
|
366
|
+
approveActivationQueueEntry(queueNonce?: bigint): Promise<{
|
|
367
|
+
approvalQueueEntry: _polkadot_types_codec.Option<_argonprotocol_mainchain.PalletCrosschainTransferCouncilApprovalQueueEntry>;
|
|
368
|
+
councilApprovalSignature: `0x${string}`;
|
|
369
|
+
batch: EthereumGatewayUpdateBatch;
|
|
370
|
+
}>;
|
|
371
|
+
collateralizeFirstPendingTransferOut(): Promise<{
|
|
372
|
+
pendingRequest: _argonprotocol_mainchain.PalletCrosschainTransferTransferOutPendingCollateralizationRequest;
|
|
373
|
+
transferId: `0x${string}`;
|
|
374
|
+
transferRequest: {
|
|
375
|
+
argonAccountId: `0x${string}`;
|
|
376
|
+
argonTransferNonce: bigint;
|
|
377
|
+
chainId: bigint;
|
|
378
|
+
councilHash: `0x${string}`;
|
|
379
|
+
recipient: `0x${string}`;
|
|
380
|
+
validUntilBlock: bigint;
|
|
381
|
+
token: `0x${string}`;
|
|
382
|
+
amount: bigint;
|
|
383
|
+
mintingAuthorityTip: bigint;
|
|
384
|
+
};
|
|
385
|
+
micronotCollateral: bigint;
|
|
386
|
+
collateralizationSignature: `0x${string}`;
|
|
387
|
+
result: _argonprotocol_mainchain.TxResult;
|
|
388
|
+
}>;
|
|
389
|
+
private registrationMessage;
|
|
390
|
+
private requireGateway;
|
|
391
|
+
}
|
|
392
|
+
|
|
130
393
|
interface ITeardownable {
|
|
131
394
|
teardown(): Promise<void>;
|
|
132
395
|
}
|
|
@@ -153,4 +416,4 @@ declare function disconnectOnTeardown<T extends {
|
|
|
153
416
|
declare function sudo(): KeyringPair;
|
|
154
417
|
declare function activateNotary(sudo: KeyringPair, client: ArgonClient, notary: TestNotary): Promise<void>;
|
|
155
418
|
|
|
156
|
-
export { type ITeardownable, SKIP_E2E, TestBitcoinCli, TestMainchain, TestNotary, TestOracle, activateNotary, addTeardown, cleanHostForDocker, closeOnTeardown, disconnectOnTeardown, getDockerPortMapping, getProxy, projectRoot, runOnTeardown, runTestScript, startNetwork, stringifyExt, sudo, teardown };
|
|
419
|
+
export { type EthereumGatewayUpdateBatch, EthereumProofE2eHarness, type ITeardownable, SKIP_E2E, TestBitcoinCli, TestEthereum, TestMainchain, TestMintingAuthorityActor, TestMintingGateway, TestNotary, TestOracle, activateNotary, addTeardown, cleanHostForDocker, closeOnTeardown, disconnectOnTeardown, getDockerPortMapping, getProxy, getReadyEthereumGatewayUpdates, mineLaterExecutionAnchorReceipt, projectRoot, runOnTeardown, runTestScript, signGatewayPermit, startNetwork, stringifyExt, sudo, syncEthereumVerifierUntilAnchorCovers, teardown, toArgonKeccakSignature, toEvmRecoverableSignature, waitForExecutionReceipt, waitForFinalizedBeaconExecutionAtOrAbove };
|
package/lib/index.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import * as _argonprotocol_mainchain from '@argonprotocol/mainchain';
|
|
2
|
+
import { KeyringPair, ArgonClient, EthereumReceipt, EthereumBeaconHeaderDetailsResponse, EthereumBeaconBlockResponse, EvmContracts, IArgonQueryable } from '@argonprotocol/mainchain';
|
|
2
3
|
import { Client } from 'pg';
|
|
4
|
+
import * as viem from 'viem';
|
|
5
|
+
import { Hex, createWalletClient, defineChain, Address, ContractFunctionArgs } from 'viem';
|
|
6
|
+
import { privateKeyToAccount } from 'viem/accounts';
|
|
7
|
+
import * as _polkadot_types_codec from '@polkadot/types-codec';
|
|
3
8
|
|
|
4
9
|
declare class TestNotary implements ITeardownable {
|
|
5
10
|
#private;
|
|
@@ -119,6 +124,51 @@ declare class TestOracle implements ITeardownable {
|
|
|
119
124
|
teardown(): Promise<void>;
|
|
120
125
|
}
|
|
121
126
|
|
|
127
|
+
interface EthereumEndpoints {
|
|
128
|
+
executionRpcUrl: string;
|
|
129
|
+
beaconApiUrl: string;
|
|
130
|
+
chainId: string;
|
|
131
|
+
}
|
|
132
|
+
interface EthereumMintingGatewayFixture {
|
|
133
|
+
argonTokenAddress: Hex;
|
|
134
|
+
argonotTokenAddress: Hex;
|
|
135
|
+
gatewayAddress: Hex;
|
|
136
|
+
}
|
|
137
|
+
interface EthereumPrefundedAccount {
|
|
138
|
+
balance: string;
|
|
139
|
+
}
|
|
140
|
+
type EthereumConsensusClient = 'lighthouse' | 'lodestar';
|
|
141
|
+
type EthereumBeaconPreset = 'mainnet' | 'minimal';
|
|
142
|
+
declare class TestEthereum implements ITeardownable {
|
|
143
|
+
#private;
|
|
144
|
+
readonly enclaveName: string;
|
|
145
|
+
readonly kurtosisBin: string;
|
|
146
|
+
readonly packageRef: string;
|
|
147
|
+
executionRpcUrl?: string;
|
|
148
|
+
beaconApiUrl?: string;
|
|
149
|
+
chainId?: string;
|
|
150
|
+
constructor(enclaveName?: string, kurtosisBin?: string, packageRef?: string);
|
|
151
|
+
static isInstalled(kurtosisBin?: string): boolean;
|
|
152
|
+
launch(options?: {
|
|
153
|
+
consensusClient?: EthereumConsensusClient;
|
|
154
|
+
preset?: EthereumBeaconPreset;
|
|
155
|
+
secondsPerSlot?: number;
|
|
156
|
+
waitForFinalization?: boolean;
|
|
157
|
+
prefundedAccounts?: Record<string, EthereumPrefundedAccount>;
|
|
158
|
+
}): Promise<EthereumEndpoints>;
|
|
159
|
+
callExecution<TResult>(method: string, params?: unknown[]): Promise<TResult>;
|
|
160
|
+
getBeacon<TResult>(path: string): Promise<TResult>;
|
|
161
|
+
deployMintingGatewayFixture(options: {
|
|
162
|
+
deployerPrivateKey: Hex;
|
|
163
|
+
adminSafe?: Hex;
|
|
164
|
+
guardianSafe?: Hex;
|
|
165
|
+
initialMicrogonsPerArgonot?: bigint;
|
|
166
|
+
seedArgonRecipient?: Hex;
|
|
167
|
+
seedArgonAmountBaseUnits?: bigint;
|
|
168
|
+
}): Promise<EthereumMintingGatewayFixture>;
|
|
169
|
+
teardown(): Promise<void>;
|
|
170
|
+
}
|
|
171
|
+
|
|
122
172
|
declare function startNetwork(testName: string, options?: {
|
|
123
173
|
shouldLog: boolean;
|
|
124
174
|
dockerEnv?: Record<string, string>;
|
|
@@ -127,6 +177,219 @@ declare function startNetwork(testName: string, options?: {
|
|
|
127
177
|
notaryUrl: string;
|
|
128
178
|
}>;
|
|
129
179
|
|
|
180
|
+
declare function signGatewayPermit(args: {
|
|
181
|
+
account: ReturnType<typeof privateKeyToAccount>;
|
|
182
|
+
chainId: number;
|
|
183
|
+
tokenAddress: Hex;
|
|
184
|
+
gatewayAddress: Hex;
|
|
185
|
+
owner: Hex;
|
|
186
|
+
value: bigint;
|
|
187
|
+
nonce: bigint;
|
|
188
|
+
deadline: bigint;
|
|
189
|
+
}): Promise<{
|
|
190
|
+
v: number;
|
|
191
|
+
r: `0x${string}`;
|
|
192
|
+
s: `0x${string}`;
|
|
193
|
+
}>;
|
|
194
|
+
declare function waitForFinalizedBeaconExecutionAtOrAbove(ethereum: TestEthereum, minimumExecutionBlockNumber: bigint, options?: {
|
|
195
|
+
minimumFinalizedSlot?: bigint;
|
|
196
|
+
}): Promise<{
|
|
197
|
+
header: EthereumBeaconHeaderDetailsResponse;
|
|
198
|
+
block: EthereumBeaconBlockResponse;
|
|
199
|
+
}>;
|
|
200
|
+
declare function mineLaterExecutionAnchorReceipt(walletClient: Pick<ReturnType<typeof createWalletClient>, 'sendTransaction'>, chain: ReturnType<typeof defineChain>, ethereum: TestEthereum, account: ReturnType<typeof privateKeyToAccount>, minimumBlockNumber: bigint): Promise<viem.TransactionReceipt>;
|
|
201
|
+
declare function waitForExecutionReceipt(ethereum: TestEthereum, transactionHash: Hex): Promise<EthereumReceipt>;
|
|
202
|
+
declare function syncEthereumVerifierUntilAnchorCovers(mainchainClient: ArgonClient, relayer: KeyringPair, beaconApiUrl: string, minimumExecutionBlockNumber: bigint): Promise<void>;
|
|
203
|
+
declare function toArgonKeccakSignature(signature: Hex): Hex;
|
|
204
|
+
declare function toEvmRecoverableSignature(signature: Hex): Hex;
|
|
205
|
+
|
|
206
|
+
type ApplyGatewayUpdatesArgs = ContractFunctionArgs<typeof EvmContracts.mintingGatewayAbi, 'nonpayable', 'applyGatewayUpdates'>;
|
|
207
|
+
type MintingGatewayCouncilSnapshot = ApplyGatewayUpdatesArgs[0];
|
|
208
|
+
type MintingGatewayGatewayUpdate = ApplyGatewayUpdatesArgs[1][number];
|
|
209
|
+
type EthereumGatewayUpdateBatch = {
|
|
210
|
+
destinationChain: 'Ethereum';
|
|
211
|
+
chainId: bigint;
|
|
212
|
+
gatewayAddress: Address;
|
|
213
|
+
currentCouncilHash: Hex;
|
|
214
|
+
currentCouncil: MintingGatewayCouncilSnapshot;
|
|
215
|
+
argonApprovalsNonce: bigint;
|
|
216
|
+
argonApprovalsHash: Hex;
|
|
217
|
+
paused: boolean;
|
|
218
|
+
firstQueueNonce?: bigint;
|
|
219
|
+
lastQueueNonce?: bigint;
|
|
220
|
+
updates: MintingGatewayGatewayUpdate[];
|
|
221
|
+
};
|
|
222
|
+
declare function getReadyEthereumGatewayUpdates(client: IArgonQueryable, gatewayClient: {
|
|
223
|
+
readContract: (...args: any[]) => Promise<unknown>;
|
|
224
|
+
}, options?: {
|
|
225
|
+
destinationChain?: 'Ethereum';
|
|
226
|
+
maxQueueEntries?: number;
|
|
227
|
+
}): Promise<EthereumGatewayUpdateBatch>;
|
|
228
|
+
|
|
229
|
+
type DeployerAccount = ReturnType<typeof privateKeyToAccount>;
|
|
230
|
+
type EthereumChain = ReturnType<typeof defineChain>;
|
|
231
|
+
type EthereumPublicClient = {
|
|
232
|
+
getBalance: (args: {
|
|
233
|
+
address: Hex;
|
|
234
|
+
}) => Promise<bigint>;
|
|
235
|
+
getBlock: (...args: any[]) => Promise<any>;
|
|
236
|
+
getBlockNumber: () => Promise<bigint>;
|
|
237
|
+
readContract: (...args: any[]) => Promise<unknown>;
|
|
238
|
+
waitForTransactionReceipt: (args: {
|
|
239
|
+
hash: Hex;
|
|
240
|
+
}) => Promise<{
|
|
241
|
+
status: string;
|
|
242
|
+
blockNumber: bigint;
|
|
243
|
+
}>;
|
|
244
|
+
};
|
|
245
|
+
type EthereumWalletClient = {
|
|
246
|
+
sendTransaction: (...args: any[]) => Promise<Hex>;
|
|
247
|
+
writeContract: (...args: any[]) => Promise<Hex>;
|
|
248
|
+
};
|
|
249
|
+
type GatewayDeployment = Awaited<ReturnType<TestEthereum['deployMintingGatewayFixture']>>;
|
|
250
|
+
declare class EthereumProofE2eHarness {
|
|
251
|
+
readonly ethereum: TestEthereum;
|
|
252
|
+
readonly endpoints: Awaited<ReturnType<TestEthereum['launch']>>;
|
|
253
|
+
readonly mainchain: TestMainchain;
|
|
254
|
+
readonly sudoSigner: KeyringPair;
|
|
255
|
+
readonly deployer: DeployerAccount;
|
|
256
|
+
readonly chain: EthereumChain;
|
|
257
|
+
readonly publicClient: EthereumPublicClient;
|
|
258
|
+
readonly walletClient: EthereumWalletClient;
|
|
259
|
+
readonly mainchainClient: ArgonClient;
|
|
260
|
+
readonly proofRelayer: KeyringPair;
|
|
261
|
+
private constructor();
|
|
262
|
+
static launch(args: {
|
|
263
|
+
testAccount: {
|
|
264
|
+
address: Hex;
|
|
265
|
+
balance: string;
|
|
266
|
+
privateKey: Hex;
|
|
267
|
+
};
|
|
268
|
+
proofRelayerUri: string;
|
|
269
|
+
}): Promise<EthereumProofE2eHarness>;
|
|
270
|
+
submit(tx: unknown, signer: KeyringPair): Promise<_argonprotocol_mainchain.TxResult>;
|
|
271
|
+
sudoSubmit(tx: unknown): Promise<_argonprotocol_mainchain.TxResult>;
|
|
272
|
+
bootstrapVerifier(): Promise<_argonprotocol_mainchain.TxResult>;
|
|
273
|
+
syncVerifierThrough(minimumExecutionBlockNumber: bigint): Promise<void>;
|
|
274
|
+
proveGatewayActivity(gatewayAddress: Hex, throughExecutionBlockNumber: bigint): Promise<{
|
|
275
|
+
payload: _argonprotocol_mainchain.EthereumGatewayActivityProofPayload;
|
|
276
|
+
result: _argonprotocol_mainchain.TxResult;
|
|
277
|
+
}>;
|
|
278
|
+
setEthereumChainConfig(gateway: TestMintingGateway): Promise<_argonprotocol_mainchain.TxResult>;
|
|
279
|
+
fundBurnAccount(amount: bigint): Promise<_argonprotocol_mainchain.TxResult>;
|
|
280
|
+
fundProofRelayer(amount?: bigint): Promise<_argonprotocol_mainchain.TxResult>;
|
|
281
|
+
forceSetBalance(address: string, amount: bigint): Promise<_argonprotocol_mainchain.TxResult>;
|
|
282
|
+
forceSetOwnership(address: string, amount: bigint): Promise<_argonprotocol_mainchain.TxResult>;
|
|
283
|
+
waitForExecutionFinalizedAfter(minimumExecutionBlockNumber: bigint): Promise<viem.TransactionReceipt>;
|
|
284
|
+
}
|
|
285
|
+
declare class TestMintingGateway {
|
|
286
|
+
readonly harness: EthereumProofE2eHarness;
|
|
287
|
+
readonly deployment: GatewayDeployment;
|
|
288
|
+
private constructor();
|
|
289
|
+
static deploy(harness: EthereumProofE2eHarness, options: Parameters<TestEthereum['deployMintingGatewayFixture']>[0]): Promise<TestMintingGateway>;
|
|
290
|
+
get gatewayAddress(): `0x${string}`;
|
|
291
|
+
get argonTokenAddress(): `0x${string}`;
|
|
292
|
+
get argonotTokenAddress(): `0x${string}`;
|
|
293
|
+
startTransferToArgon(args: {
|
|
294
|
+
account: DeployerAccount;
|
|
295
|
+
amountRuntimeUnits: bigint;
|
|
296
|
+
recipientArgonAddress: Hex;
|
|
297
|
+
}): Promise<viem.TransactionReceipt>;
|
|
298
|
+
forceUpdateActiveCouncil(currentCouncil: {
|
|
299
|
+
signers: Hex[];
|
|
300
|
+
weights: bigint[];
|
|
301
|
+
}): Promise<{
|
|
302
|
+
status: string;
|
|
303
|
+
blockNumber: bigint;
|
|
304
|
+
}>;
|
|
305
|
+
relayReadyApprovals(batch: Awaited<ReturnType<typeof getReadyEthereumGatewayUpdates>>, operatorAddress: string): Promise<{
|
|
306
|
+
status: string;
|
|
307
|
+
blockNumber: bigint;
|
|
308
|
+
}>;
|
|
309
|
+
argonApprovalsNonce(): Promise<bigint>;
|
|
310
|
+
globalIssuanceCouncil(): Promise<[Hex[], bigint[], Hex]>;
|
|
311
|
+
authorityCollateral(signingKey: Hex): Promise<[bigint, bigint]>;
|
|
312
|
+
finalizeTransferOut(args: {
|
|
313
|
+
transferRequest: {
|
|
314
|
+
argonAccountId: Hex;
|
|
315
|
+
argonTransferNonce: bigint;
|
|
316
|
+
chainId: bigint;
|
|
317
|
+
councilHash: Hex;
|
|
318
|
+
recipient: Hex;
|
|
319
|
+
validUntilBlock: bigint;
|
|
320
|
+
token: Hex;
|
|
321
|
+
amount: bigint;
|
|
322
|
+
mintingAuthorityTip: bigint;
|
|
323
|
+
};
|
|
324
|
+
collateralizationSignature: Hex;
|
|
325
|
+
micronotCollateral: bigint;
|
|
326
|
+
}): Promise<{
|
|
327
|
+
status: string;
|
|
328
|
+
blockNumber: bigint;
|
|
329
|
+
}>;
|
|
330
|
+
isFinalizedTransferOut(transferRequest: Parameters<typeof EvmContracts.hashMintingGatewayTransferOutOfArgonRequest>[0]): Promise<boolean>;
|
|
331
|
+
argonBalance(address: Hex): Promise<bigint>;
|
|
332
|
+
fundExecutionAccount(address: Hex, value: bigint): Promise<{
|
|
333
|
+
status: string;
|
|
334
|
+
blockNumber: bigint;
|
|
335
|
+
}>;
|
|
336
|
+
}
|
|
337
|
+
declare class TestMintingAuthorityActor {
|
|
338
|
+
readonly harness: EthereumProofE2eHarness;
|
|
339
|
+
readonly operator: KeyringPair;
|
|
340
|
+
readonly councilSigner: DeployerAccount;
|
|
341
|
+
readonly authoritySigner: DeployerAccount;
|
|
342
|
+
private gateway?;
|
|
343
|
+
constructor(harness: EthereumProofE2eHarness, args: {
|
|
344
|
+
operatorUri: string;
|
|
345
|
+
councilPrivateKey: Hex;
|
|
346
|
+
authorityPrivateKey: Hex;
|
|
347
|
+
});
|
|
348
|
+
attachGateway(gateway: TestMintingGateway): void;
|
|
349
|
+
prepareOperator(args: {
|
|
350
|
+
freeBalance: bigint;
|
|
351
|
+
ownershipBalance: bigint;
|
|
352
|
+
committedArgonots: bigint;
|
|
353
|
+
bitcoinXpub: string;
|
|
354
|
+
}): Promise<void>;
|
|
355
|
+
registerCouncilSigner(): Promise<_argonprotocol_mainchain.TxResult>;
|
|
356
|
+
forceSingleMemberCouncil(): Promise<{
|
|
357
|
+
activeCouncilHash: `0x${string}`;
|
|
358
|
+
activeCouncil: _argonprotocol_mainchain.PalletCrosschainTransferGlobalIssuanceCouncil;
|
|
359
|
+
currentCouncil: {
|
|
360
|
+
signers: `0x${string}`[];
|
|
361
|
+
weights: bigint[];
|
|
362
|
+
};
|
|
363
|
+
}>;
|
|
364
|
+
setMinimumValue(value: bigint): Promise<_argonprotocol_mainchain.TxResult>;
|
|
365
|
+
registerMintingAuthority(micronotCollateral: bigint): Promise<_argonprotocol_mainchain.TxResult>;
|
|
366
|
+
approveActivationQueueEntry(queueNonce?: bigint): Promise<{
|
|
367
|
+
approvalQueueEntry: _polkadot_types_codec.Option<_argonprotocol_mainchain.PalletCrosschainTransferCouncilApprovalQueueEntry>;
|
|
368
|
+
councilApprovalSignature: `0x${string}`;
|
|
369
|
+
batch: EthereumGatewayUpdateBatch;
|
|
370
|
+
}>;
|
|
371
|
+
collateralizeFirstPendingTransferOut(): Promise<{
|
|
372
|
+
pendingRequest: _argonprotocol_mainchain.PalletCrosschainTransferTransferOutPendingCollateralizationRequest;
|
|
373
|
+
transferId: `0x${string}`;
|
|
374
|
+
transferRequest: {
|
|
375
|
+
argonAccountId: `0x${string}`;
|
|
376
|
+
argonTransferNonce: bigint;
|
|
377
|
+
chainId: bigint;
|
|
378
|
+
councilHash: `0x${string}`;
|
|
379
|
+
recipient: `0x${string}`;
|
|
380
|
+
validUntilBlock: bigint;
|
|
381
|
+
token: `0x${string}`;
|
|
382
|
+
amount: bigint;
|
|
383
|
+
mintingAuthorityTip: bigint;
|
|
384
|
+
};
|
|
385
|
+
micronotCollateral: bigint;
|
|
386
|
+
collateralizationSignature: `0x${string}`;
|
|
387
|
+
result: _argonprotocol_mainchain.TxResult;
|
|
388
|
+
}>;
|
|
389
|
+
private registrationMessage;
|
|
390
|
+
private requireGateway;
|
|
391
|
+
}
|
|
392
|
+
|
|
130
393
|
interface ITeardownable {
|
|
131
394
|
teardown(): Promise<void>;
|
|
132
395
|
}
|
|
@@ -153,4 +416,4 @@ declare function disconnectOnTeardown<T extends {
|
|
|
153
416
|
declare function sudo(): KeyringPair;
|
|
154
417
|
declare function activateNotary(sudo: KeyringPair, client: ArgonClient, notary: TestNotary): Promise<void>;
|
|
155
418
|
|
|
156
|
-
export { type ITeardownable, SKIP_E2E, TestBitcoinCli, TestMainchain, TestNotary, TestOracle, activateNotary, addTeardown, cleanHostForDocker, closeOnTeardown, disconnectOnTeardown, getDockerPortMapping, getProxy, projectRoot, runOnTeardown, runTestScript, startNetwork, stringifyExt, sudo, teardown };
|
|
419
|
+
export { type EthereumGatewayUpdateBatch, EthereumProofE2eHarness, type ITeardownable, SKIP_E2E, TestBitcoinCli, TestEthereum, TestMainchain, TestMintingAuthorityActor, TestMintingGateway, TestNotary, TestOracle, activateNotary, addTeardown, cleanHostForDocker, closeOnTeardown, disconnectOnTeardown, getDockerPortMapping, getProxy, getReadyEthereumGatewayUpdates, mineLaterExecutionAnchorReceipt, projectRoot, runOnTeardown, runTestScript, signGatewayPermit, startNetwork, stringifyExt, sudo, syncEthereumVerifierUntilAnchorCovers, teardown, toArgonKeccakSignature, toEvmRecoverableSignature, waitForExecutionReceipt, waitForFinalizedBeaconExecutionAtOrAbove };
|