• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

decentraland / transactions-server / 12352347889

12 Dec 2024 06:48PM UTC coverage: 64.756% (+0.1%) from 64.629%
12352347889

push

github

web-flow
feat: Update meta tx relayer params (#121)

* feat: Validate the transaction is valid before to send it to the relayer provider

* feat: Add a helper method encodeFunctionData

* feat: Add MetaTxForwarder ABI and contract config

* feat: Update data sent to Gelato relayer

* feat: Update tests

* fix: Estimate Gas

* fix: Remove MetaTxForwarder implementation

* fix: Tests

95 of 135 branches covered (70.37%)

Branch coverage included in aggregate %.

8 of 11 new or added lines in 4 files covered. (72.73%)

357 of 563 relevant lines covered (63.41%)

3.47 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

86.67
/src/logic/ethereum.ts
1
import { utils } from 'ethers'
5✔
2
import { ChainName, ChainId, getChainId } from '@dcl/schemas'
5✔
3
import { ContractData } from 'decentraland-transactions'
4
import { getNetworkMapping } from '@dcl/schemas/dist/dapps/chain-id'
5✔
5

6
export function getMaticChainIdFromChainName(chainName: ChainName): ChainId {
5✔
7
  const chainId = getChainId(chainName)
13✔
8
  if (!chainId) {
13✔
9
    throw new Error(
1✔
10
      `The chain name ${chainName} doesn't have a matic chain id to map to`
11
    )
12
  }
13
  return getNetworkMapping(chainId).MATIC
12✔
14
}
15

16
/**
17
 * Decode the data for a function call, splitting it into the different arguments
18
 * It thorws if the data, method or abi are incorrect
19
 * @param abi - Contract abi
20
 * @param methodName - Method to decode
21
 * @param data - data to decode (tx.data)
22
 */
23
export function decodeFunctionData(
5✔
24
  abi: ContractData['abi'],
25
  methodName: string,
26
  data: string
27
): utils.Result {
28
  const contractInterface = new utils.Interface(abi)
25✔
29
  return contractInterface.decodeFunctionData(methodName, data)
25✔
30
}
31

32
/**
33
 * Encode the data for a function call
34
 * It thorws if the data, method or abi are incorrect
35
 * @param abi - Contract abi
36
 * @param methodName - Method to encode
37
 * @param data - Arguments to encode (transaction.params)
38
 */
39
export function encodeFunctionData(
5✔
40
  abi: ContractData['abi'],
41
  methodName: string,
42
  data: string[]
43
): string {
NEW
44
  const contractInterface = new utils.Interface(abi)
×
NEW
45
  return contractInterface.encodeFunctionData(methodName, data)
×
46
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc