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

deno-web3 / solc / 13575745341

27 Feb 2025 08:59PM UTC coverage: 76.21% (+4.4%) from 71.786%
13575745341

Pull #3

github

web-flow
Merge ba97409cf into 3d76b77ea
Pull Request #3: Update with upstream

4 of 8 branches covered (50.0%)

Branch coverage included in aggregate %.

159 of 214 new or added lines in 7 files covered. (74.3%)

185 of 240 relevant lines covered (77.08%)

2.17 hits per line

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

82.5
/bindings/helpers.ts
1
import { isNil } from '../common.ts'
1✔
2
import type { SolJson } from 'solc/types'
3

4
export function bindSolcMethod<T>(
1✔
5
  solJson: SolJson,
1✔
6
  method: string,
1✔
7
  returnType: string | null,
1✔
8
  args: string[],
1✔
9
  defaultValue?: unknown,
1✔
10
): T {
NEW
11
  if (isNil(solJson[`_${method}` as keyof typeof solJson]) && defaultValue !== undefined) {
×
NEW
12
    return defaultValue as T
×
NEW
13
  }
×
14

15
  return solJson.cwrap<T>(method, returnType, args)
6✔
16
}
6✔
17

18
export function bindSolcMethodWithFallbackFunc<T>(
1✔
19
  solJson: SolJson,
1✔
20
  method: string,
1✔
21
  returnType: string | null,
1✔
22
  args: string[],
1✔
23
  fallbackMethod: string,
1✔
24
  finalFallback: (() => void) | undefined = undefined,
1✔
25
): T {
26
  const methodFunc = bindSolcMethod<T>(solJson, method, returnType, args, null)
3✔
27

28
  if (!isNil(methodFunc)) {
3✔
29
    return methodFunc as T
3✔
30
  }
3!
31

NEW
32
  return bindSolcMethod<T>(solJson, fallbackMethod, returnType, args, finalFallback)
×
33
}
3✔
34

35
export function getSupportedMethods(solJson: SolJson) {
1✔
36
  return {
2✔
37
    licenseSupported: anyMethodExists(solJson, 'solidity_license'),
2✔
38
    versionSupported: anyMethodExists(solJson, 'solidity_version'),
2✔
39
    allocSupported: anyMethodExists(solJson, 'solidity_alloc'),
2✔
40
    resetSupported: anyMethodExists(solJson, 'solidity_reset'),
2✔
41
    compileJsonStandardSupported: anyMethodExists(solJson, 'compileStandard', 'solidity_compile'),
2✔
42
  }
2✔
43
}
2✔
44

45
function anyMethodExists(solJson: SolJson, ...names: string[]) {
6✔
46
  return names.some((name) => !isNil(solJson[`_${name}` as keyof typeof solJson]))
6✔
47
}
6✔
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

© 2026 Coveralls, Inc