@@ -4,7 +4,6 @@ import assert from "assert";
44import Decimal from "decimal.js" ;
55import { ethers , PopulatedTransaction , providers , VoidSigner } from "ethers" ;
66import { getGasPriceEstimate } from "../gasPriceOracle" ;
7- import { TypedMessage } from "../interfaces/TypedData" ;
87import { BigNumber , BigNumberish , BN , formatUnits , parseUnits , toBN } from "./BigNumberUtils" ;
98import { ConvertDecimals } from "./FormattingUtils" ;
109import { chainIsOPStack } from "./NetworkUtils" ;
@@ -323,106 +322,6 @@ async function getLineaGasFees(chainId: number, transport: Transport | undefined
323322 } ;
324323}
325324
326- export type UpdateDepositDetailsMessageType = {
327- UpdateDepositDetails : [
328- {
329- name : "depositId" ;
330- type : "uint32" ;
331- } ,
332- { name : "originChainId" ; type : "uint256" } ,
333- { name : "updatedRelayerFeePct" ; type : "int64" } ,
334- { name : "updatedRecipient" ; type : "address" } ,
335- { name : "updatedMessage" ; type : "bytes" } ,
336- ] ;
337- } ;
338-
339- export type UpdateV3DepositDetailsMessageType = {
340- UpdateDepositDetails : [
341- { name : "depositId" ; type : "uint32" } ,
342- { name : "originChainId" ; type : "uint256" } ,
343- { name : "updatedOutputAmount" ; type : "uint256" } ,
344- { name : "updatedRecipient" ; type : "address" } ,
345- { name : "updatedMessage" ; type : "bytes" } ,
346- ] ;
347- } ;
348-
349- /**
350- * Utility function to get EIP-712 compliant typed data that can be signed with the JSON-RPC method
351- * `eth_signedTypedDataV4` in MetaMask (https://docs.metamask.io/guide/signing-data.html). The resulting signature
352- * can then be used to call the method `speedUpDeposit` of a `SpokePool.sol` contract.
353- * @param depositId The deposit ID to speed up.
354- * @param originChainId The chain ID of the origin chain.
355- * @param updatedRelayerFeePct The new relayer fee percentage.
356- * @param updatedRecipient The new recipient address.
357- * @param updatedMessage The new message that should be provided to the recipient.
358- * @return EIP-712 compliant typed data.
359- */
360- export function getUpdateDepositTypedData (
361- depositId : number ,
362- originChainId : number ,
363- updatedRelayerFeePct : BigNumber ,
364- updatedRecipient : string ,
365- updatedMessage : string
366- ) : TypedMessage < UpdateDepositDetailsMessageType > {
367- return {
368- types : {
369- UpdateDepositDetails : [
370- { name : "depositId" , type : "uint32" } ,
371- { name : "originChainId" , type : "uint256" } ,
372- { name : "updatedRelayerFeePct" , type : "int64" } ,
373- { name : "updatedRecipient" , type : "address" } ,
374- { name : "updatedMessage" , type : "bytes" } ,
375- ] ,
376- } ,
377- primaryType : "UpdateDepositDetails" ,
378- domain : {
379- name : "ACROSS-V2" ,
380- version : "1.0.0" ,
381- chainId : originChainId ,
382- } ,
383- message : {
384- depositId,
385- originChainId,
386- updatedRelayerFeePct,
387- updatedRecipient,
388- updatedMessage,
389- } ,
390- } ;
391- }
392-
393- export function getUpdateV3DepositTypedData (
394- depositId : number ,
395- originChainId : number ,
396- updatedOutputAmount : BigNumber ,
397- updatedRecipient : string ,
398- updatedMessage : string
399- ) : TypedMessage < UpdateV3DepositDetailsMessageType > {
400- return {
401- types : {
402- UpdateDepositDetails : [
403- { name : "depositId" , type : "uint32" } ,
404- { name : "originChainId" , type : "uint256" } ,
405- { name : "updatedOutputAmount" , type : "uint256" } ,
406- { name : "updatedRecipient" , type : "address" } ,
407- { name : "updatedMessage" , type : "bytes" } ,
408- ] ,
409- } ,
410- primaryType : "UpdateDepositDetails" ,
411- domain : {
412- name : "ACROSS-V2" ,
413- version : "1.0.0" ,
414- chainId : originChainId ,
415- } ,
416- message : {
417- depositId,
418- originChainId,
419- updatedOutputAmount,
420- updatedRecipient,
421- updatedMessage,
422- } ,
423- } ;
424- }
425-
426325export function randomAddress ( ) {
427326 return ethers . utils . getAddress ( ethers . utils . hexlify ( ethers . utils . randomBytes ( 20 ) ) ) ;
428327}
0 commit comments