@0xsequence/catapult 1.3.17 → 1.5.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/README.md +276 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +1 -0
- package/dist/cli.js.map +1 -1
- package/dist/commands/index.d.ts +1 -0
- package/dist/commands/index.d.ts.map +1 -1
- package/dist/commands/index.js +1 -0
- package/dist/commands/index.js.map +1 -1
- package/dist/commands/list.d.ts.map +1 -1
- package/dist/commands/list.js +12 -0
- package/dist/commands/list.js.map +1 -1
- package/dist/commands/provenance.d.ts +3 -0
- package/dist/commands/provenance.d.ts.map +1 -0
- package/dist/commands/provenance.js +138 -0
- package/dist/commands/provenance.js.map +1 -0
- package/dist/lib/__tests__/deployer.spec.js +118 -1
- package/dist/lib/__tests__/deployer.spec.js.map +1 -1
- package/dist/lib/__tests__/network-loader.spec.js.map +1 -1
- package/dist/lib/__tests__/provenance.spec.d.ts +2 -0
- package/dist/lib/__tests__/provenance.spec.d.ts.map +1 -0
- package/dist/lib/__tests__/provenance.spec.js +205 -0
- package/dist/lib/__tests__/provenance.spec.js.map +1 -0
- package/dist/lib/contracts/__tests__/repository.spec.js +243 -0
- package/dist/lib/contracts/__tests__/repository.spec.js.map +1 -1
- package/dist/lib/contracts/repository.d.ts +9 -1
- package/dist/lib/contracts/repository.d.ts.map +1 -1
- package/dist/lib/contracts/repository.js +93 -7
- package/dist/lib/contracts/repository.js.map +1 -1
- package/dist/lib/core/__tests__/assert-action.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/assert-action.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/assert-action.spec.js +377 -0
- package/dist/lib/core/__tests__/assert-action.spec.js.map +1 -0
- package/dist/lib/core/__tests__/engine.spec.js +80 -0
- package/dist/lib/core/__tests__/engine.spec.js.map +1 -1
- package/dist/lib/core/__tests__/loader.spec.js +29 -0
- package/dist/lib/core/__tests__/loader.spec.js.map +1 -1
- package/dist/lib/core/__tests__/resolver.spec.js +405 -0
- package/dist/lib/core/__tests__/resolver.spec.js.map +1 -1
- package/dist/lib/core/__tests__/sign-actions.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/sign-actions.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/sign-actions.spec.js +128 -0
- package/dist/lib/core/__tests__/sign-actions.spec.js.map +1 -0
- package/dist/lib/core/__tests__/signer.spec.d.ts +2 -0
- package/dist/lib/core/__tests__/signer.spec.d.ts.map +1 -0
- package/dist/lib/core/__tests__/signer.spec.js +40 -0
- package/dist/lib/core/__tests__/signer.spec.js.map +1 -0
- package/dist/lib/core/context.d.ts +3 -2
- package/dist/lib/core/context.d.ts.map +1 -1
- package/dist/lib/core/context.js +3 -2
- package/dist/lib/core/context.js.map +1 -1
- package/dist/lib/core/engine.d.ts +4 -0
- package/dist/lib/core/engine.d.ts.map +1 -1
- package/dist/lib/core/engine.js +206 -0
- package/dist/lib/core/engine.js.map +1 -1
- package/dist/lib/core/loader.d.ts +1 -0
- package/dist/lib/core/loader.d.ts.map +1 -1
- package/dist/lib/core/loader.js +6 -1
- package/dist/lib/core/loader.js.map +1 -1
- package/dist/lib/core/resolver.d.ts +2 -0
- package/dist/lib/core/resolver.d.ts.map +1 -1
- package/dist/lib/core/resolver.js +89 -0
- package/dist/lib/core/resolver.js.map +1 -1
- package/dist/lib/core/signer.d.ts +7 -0
- package/dist/lib/core/signer.d.ts.map +1 -0
- package/dist/lib/core/signer.js +60 -0
- package/dist/lib/core/signer.js.map +1 -0
- package/dist/lib/deployer.d.ts.map +1 -1
- package/dist/lib/deployer.js +21 -4
- package/dist/lib/deployer.js.map +1 -1
- package/dist/lib/index.d.ts +1 -0
- package/dist/lib/index.d.ts.map +1 -1
- package/dist/lib/index.js +1 -0
- package/dist/lib/index.js.map +1 -1
- package/dist/lib/parsers/__tests__/job.spec.js +77 -0
- package/dist/lib/parsers/__tests__/job.spec.js.map +1 -1
- package/dist/lib/parsers/__tests__/source.spec.d.ts +2 -0
- package/dist/lib/parsers/__tests__/source.spec.d.ts.map +1 -0
- package/dist/lib/parsers/__tests__/source.spec.js +158 -0
- package/dist/lib/parsers/__tests__/source.spec.js.map +1 -0
- package/dist/lib/parsers/index.d.ts +1 -0
- package/dist/lib/parsers/index.d.ts.map +1 -1
- package/dist/lib/parsers/index.js +1 -0
- package/dist/lib/parsers/index.js.map +1 -1
- package/dist/lib/parsers/job.d.ts.map +1 -1
- package/dist/lib/parsers/job.js +11 -0
- package/dist/lib/parsers/job.js.map +1 -1
- package/dist/lib/parsers/source.d.ts +4 -0
- package/dist/lib/parsers/source.d.ts.map +1 -0
- package/dist/lib/parsers/source.js +107 -0
- package/dist/lib/parsers/source.js.map +1 -0
- package/dist/lib/provenance.d.ts +34 -0
- package/dist/lib/provenance.d.ts.map +1 -0
- package/dist/lib/provenance.js +694 -0
- package/dist/lib/provenance.js.map +1 -0
- package/dist/lib/types/actions.d.ts +42 -2
- package/dist/lib/types/actions.d.ts.map +1 -1
- package/dist/lib/types/actions.js +4 -0
- package/dist/lib/types/actions.js.map +1 -1
- package/dist/lib/types/contracts.d.ts +3 -0
- package/dist/lib/types/contracts.d.ts.map +1 -1
- package/dist/lib/types/definitions.d.ts +1 -0
- package/dist/lib/types/definitions.d.ts.map +1 -1
- package/dist/lib/types/index.d.ts +1 -0
- package/dist/lib/types/index.d.ts.map +1 -1
- package/dist/lib/types/index.js +1 -0
- package/dist/lib/types/index.js.map +1 -1
- package/dist/lib/types/source.d.ts +26 -0
- package/dist/lib/types/source.d.ts.map +1 -0
- package/dist/lib/types/source.js +3 -0
- package/dist/lib/types/source.js.map +1 -0
- package/dist/lib/types/values.d.ts +33 -1
- package/dist/lib/types/values.d.ts.map +1 -1
- package/package.json +4 -1
- package/.eslintrc.json +0 -29
- package/.github/workflows/ci.yml +0 -181
- package/CONCEPT.md +0 -24
- package/contracts/checked-call.huff +0 -65
- package/eslint.config.js +0 -48
- package/examples/jobs/guards-v1.yaml +0 -17
- package/examples/jobs/sequence-seq-0001-patch.yaml +0 -59
- package/examples/jobs/sequence-v1.yaml +0 -59
- package/examples/templates/sequence-factory-v1.yaml +0 -56
- package/jest.config.js +0 -25
- package/src/cli.ts +0 -17
- package/src/commands/common.ts +0 -61
- package/src/commands/dry.ts +0 -209
- package/src/commands/etherscan.ts +0 -360
- package/src/commands/index.ts +0 -5
- package/src/commands/list.ts +0 -249
- package/src/commands/run.ts +0 -146
- package/src/commands/utils.ts +0 -215
- package/src/index.ts +0 -67
- package/src/lib/__tests__/deployer-events.spec.ts +0 -338
- package/src/lib/__tests__/deployer.spec.ts +0 -2093
- package/src/lib/__tests__/network-loader.spec.ts +0 -150
- package/src/lib/__tests__/network-selection.spec.ts +0 -41
- package/src/lib/__tests__/network-utils.spec.ts +0 -230
- package/src/lib/artifacts/__tests__/fixtures/contract1.json +0 -19
- package/src/lib/artifacts/__tests__/fixtures/contract2.json +0 -19
- package/src/lib/artifacts/__tests__/fixtures/duplicate-name.json +0 -19
- package/src/lib/artifacts/__tests__/fixtures/nested/nested-contract.json +0 -18
- package/src/lib/artifacts/__tests__/fixtures/not-an-artifact.json +0 -8
- package/src/lib/artifacts/__tests__/fixtures/readme.txt +0 -2
- package/src/lib/contracts/__tests__/repository.spec.ts +0 -344
- package/src/lib/contracts/repository.ts +0 -313
- package/src/lib/core/__tests__/context.spec.ts +0 -37
- package/src/lib/core/__tests__/engine.spec.ts +0 -1889
- package/src/lib/core/__tests__/graph.spec.ts +0 -125
- package/src/lib/core/__tests__/json-integration.spec.ts +0 -425
- package/src/lib/core/__tests__/loader.spec.ts +0 -334
- package/src/lib/core/__tests__/multi-platform-verification.spec.ts +0 -406
- package/src/lib/core/__tests__/resolver.spec.ts +0 -2053
- package/src/lib/core/__tests__/static-action.spec.ts +0 -172
- package/src/lib/core/context.ts +0 -127
- package/src/lib/core/engine.ts +0 -1782
- package/src/lib/core/graph.ts +0 -252
- package/src/lib/core/loader.ts +0 -247
- package/src/lib/core/resolver.ts +0 -757
- package/src/lib/deployer.ts +0 -981
- package/src/lib/events/__tests__/event-system.spec.ts +0 -392
- package/src/lib/events/cli-adapter.ts +0 -369
- package/src/lib/events/emitter.ts +0 -62
- package/src/lib/events/index.ts +0 -3
- package/src/lib/events/types.ts +0 -520
- package/src/lib/index.ts +0 -14
- package/src/lib/network-loader.ts +0 -90
- package/src/lib/network-selection.ts +0 -73
- package/src/lib/network-utils.ts +0 -64
- package/src/lib/parsers/__tests__/buildinfo.spec.ts +0 -122
- package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-bytecode-buildinfo.json +0 -62
- package/src/lib/parsers/__tests__/fixtures/buildinfo/invalid-json.txt +0 -2
- package/src/lib/parsers/__tests__/fixtures/buildinfo/multi-contract-buildinfo.json +0 -89
- package/src/lib/parsers/__tests__/fixtures/buildinfo/no-contracts-buildinfo.json +0 -17
- package/src/lib/parsers/__tests__/fixtures/buildinfo/simple-buildinfo.json +0 -63
- package/src/lib/parsers/__tests__/fixtures/buildinfo/wrong-format.json +0 -4
- package/src/lib/parsers/__tests__/job.spec.ts +0 -358
- package/src/lib/parsers/__tests__/template.spec.ts +0 -111
- package/src/lib/parsers/artifact/__tests__/artifact.spec.ts +0 -117
- package/src/lib/parsers/artifact/__tests__/fixtures/empty-bytecode.json +0 -5
- package/src/lib/parsers/artifact/__tests__/fixtures/hardhat-artifact.json +0 -67
- package/src/lib/parsers/artifact/__tests__/fixtures/invalid-bytecode.json +0 -5
- package/src/lib/parsers/artifact/__tests__/fixtures/invalid-json.txt +0 -11
- package/src/lib/parsers/artifact/__tests__/fixtures/minimal-artifact.json +0 -5
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-abi.json +0 -4
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-bytecode.json +0 -11
- package/src/lib/parsers/artifact/__tests__/fixtures/missing-contract-name.json +0 -11
- package/src/lib/parsers/artifact/__tests__/fixtures/simple-artifact.json +0 -40
- package/src/lib/parsers/artifact/__tests__/fixtures/wrong-types.json +0 -7
- package/src/lib/parsers/artifact/foundry-1.2.ts +0 -72
- package/src/lib/parsers/artifact/index.ts +0 -27
- package/src/lib/parsers/artifact/types.ts +0 -9
- package/src/lib/parsers/buildinfo.ts +0 -127
- package/src/lib/parsers/constants.ts +0 -56
- package/src/lib/parsers/index.ts +0 -5
- package/src/lib/parsers/job.ts +0 -148
- package/src/lib/parsers/template.ts +0 -135
- package/src/lib/std/templates/arachnid-deterministic-deployment-proxy.yaml +0 -68
- package/src/lib/std/templates/assured-deployment.yaml +0 -46
- package/src/lib/std/templates/era-evm-predeploy.yaml +0 -35
- package/src/lib/std/templates/erc-2470.yaml +0 -70
- package/src/lib/std/templates/min-balance.yaml +0 -35
- package/src/lib/std/templates/nano-universal-deployer.yaml +0 -61
- package/src/lib/std/templates/raw-erc-2470.yaml +0 -62
- package/src/lib/std/templates/raw-nano-universal-deployer.yaml +0 -54
- package/src/lib/std/templates/raw-sequence-universal-deployer-2.yaml +0 -52
- package/src/lib/std/templates/sequence-universal-deployer-2.yaml +0 -61
- package/src/lib/types/__tests__/json-request-action.spec.ts +0 -243
- package/src/lib/types/__tests__/read-json-value.spec.ts +0 -278
- package/src/lib/types/__tests__/resolve-json-value.spec.ts +0 -769
- package/src/lib/types/actions.ts +0 -127
- package/src/lib/types/artifacts.ts +0 -21
- package/src/lib/types/buildinfo.ts +0 -116
- package/src/lib/types/conditions.ts +0 -50
- package/src/lib/types/contracts.ts +0 -23
- package/src/lib/types/definitions.ts +0 -70
- package/src/lib/types/index.ts +0 -8
- package/src/lib/types/network.ts +0 -33
- package/src/lib/types/project.ts +0 -9
- package/src/lib/types/task.ts +0 -9
- package/src/lib/types/values.ts +0 -150
- package/src/lib/utils/assertion.ts +0 -24
- package/src/lib/utils/validation.ts +0 -116
- package/src/lib/validation/contract-references.ts +0 -210
- package/src/lib/validation/index.ts +0 -1
- package/src/lib/verification/__tests__/etherscan.spec.ts +0 -710
- package/src/lib/verification/__tests__/sourcify.spec.ts +0 -288
- package/src/lib/verification/etherscan.ts +0 -547
- package/src/lib/verification/sourcify.ts +0 -248
- package/test_validation/artifacts/TestContract.json +0 -9
- package/test_validation/jobs/test-missing.yaml +0 -16
- package/test_validation/networks.yaml +0 -3
- package/tsconfig.json +0 -36
package/src/lib/network-utils.ts
DELETED
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { ethers } from 'ethers'
|
|
2
|
-
import { Network } from './types'
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Attempts to detect network information from an RPC URL
|
|
6
|
-
* @param rpcUrl The RPC URL to query
|
|
7
|
-
* @returns Promise that resolves with detected network information
|
|
8
|
-
*/
|
|
9
|
-
export async function detectNetworkFromRpc(rpcUrl: string): Promise<Partial<Network>> {
|
|
10
|
-
// Detect network information from RPC URL
|
|
11
|
-
|
|
12
|
-
try {
|
|
13
|
-
const provider = new ethers.JsonRpcProvider(rpcUrl)
|
|
14
|
-
|
|
15
|
-
// Create provider and get network information
|
|
16
|
-
const network = await provider.getNetwork()
|
|
17
|
-
|
|
18
|
-
// Network detected successfully
|
|
19
|
-
|
|
20
|
-
return {
|
|
21
|
-
name: network.name,
|
|
22
|
-
chainId: Number(network.chainId),
|
|
23
|
-
rpcUrl: rpcUrl
|
|
24
|
-
}
|
|
25
|
-
} catch (error) {
|
|
26
|
-
// Failed to detect network
|
|
27
|
-
throw new Error(`Failed to detect network from RPC URL "${rpcUrl}": ${error instanceof Error ? error.message : String(error)}`)
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
/**
|
|
32
|
-
* Validates if a string is a valid RPC URL
|
|
33
|
-
* @param url The URL to validate
|
|
34
|
-
* @returns True if the URL appears to be a valid RPC URL
|
|
35
|
-
*/
|
|
36
|
-
export function isValidRpcUrl(url: string): boolean {
|
|
37
|
-
try {
|
|
38
|
-
// Basic URL validation
|
|
39
|
-
const urlObj = new URL(url)
|
|
40
|
-
|
|
41
|
-
// Check if it's http/https or a common RPC protocol
|
|
42
|
-
const isValidProtocol = urlObj.protocol === 'http:' ||
|
|
43
|
-
urlObj.protocol === 'https:' ||
|
|
44
|
-
url.startsWith('ws://') ||
|
|
45
|
-
url.startsWith('wss://')
|
|
46
|
-
|
|
47
|
-
if (!isValidProtocol) {
|
|
48
|
-
// Invalid protocol
|
|
49
|
-
return false
|
|
50
|
-
}
|
|
51
|
-
|
|
52
|
-
// Check if it has a hostname
|
|
53
|
-
if (!urlObj.hostname) {
|
|
54
|
-
// Missing hostname
|
|
55
|
-
return false
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Valid RPC URL format
|
|
59
|
-
return true
|
|
60
|
-
} catch {
|
|
61
|
-
// Invalid RPC URL format
|
|
62
|
-
return false
|
|
63
|
-
}
|
|
64
|
-
}
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import * as fs from 'fs'
|
|
2
|
-
import * as path from 'path'
|
|
3
|
-
import { parseBuildInfo, isBuildInfoFile, extractedContractToArtifact } from '../buildinfo'
|
|
4
|
-
|
|
5
|
-
describe('Build-Info Parsing', () => {
|
|
6
|
-
const fixturesDir = path.join(__dirname, 'fixtures/buildinfo')
|
|
7
|
-
|
|
8
|
-
// Helper function to read fixture files
|
|
9
|
-
const readFixture = (filename: string): string => {
|
|
10
|
-
return fs.readFileSync(path.join(fixturesDir, filename), 'utf-8')
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
describe('isBuildInfoFile function', () => {
|
|
14
|
-
it('should identify build-info files correctly', () => {
|
|
15
|
-
expect(isBuildInfoFile('artifacts/build-info/abc123.json')).toBe(true)
|
|
16
|
-
expect(isBuildInfoFile('out/build-info/def456.json')).toBe(true)
|
|
17
|
-
expect(isBuildInfoFile('/path/to/artifacts/build-info/xyz789.json')).toBe(true)
|
|
18
|
-
|
|
19
|
-
expect(isBuildInfoFile('artifacts/Contract.json')).toBe(false)
|
|
20
|
-
expect(isBuildInfoFile('src/Contract.sol')).toBe(false)
|
|
21
|
-
expect(isBuildInfoFile('build-info.json')).toBe(false)
|
|
22
|
-
})
|
|
23
|
-
})
|
|
24
|
-
|
|
25
|
-
describe('parseBuildInfo function', () => {
|
|
26
|
-
it('should parse a simple build-info file with one contract', () => {
|
|
27
|
-
const content = readFixture('simple-buildinfo.json')
|
|
28
|
-
const result = parseBuildInfo(content, '/test/simple-buildinfo.json')
|
|
29
|
-
|
|
30
|
-
expect(result).not.toBeNull()
|
|
31
|
-
expect(result).toHaveLength(1)
|
|
32
|
-
|
|
33
|
-
const contract = result![0]
|
|
34
|
-
expect(contract.contractName).toBe('Counter')
|
|
35
|
-
expect(contract.sourceName).toBe('src/Counter.sol')
|
|
36
|
-
expect(contract.fullyQualifiedName).toBe('src/Counter.sol:Counter')
|
|
37
|
-
expect(contract.abi).toBeInstanceOf(Array)
|
|
38
|
-
expect(contract.abi.length).toBe(2)
|
|
39
|
-
expect(contract.bytecode).toMatch(/^0x[0-9a-fA-F]+$/)
|
|
40
|
-
expect(contract.deployedBytecode).toMatch(/^0x[0-9a-fA-F]+$/)
|
|
41
|
-
expect(contract.compiler.version).toBe('0.8.30+commit.8fe82020')
|
|
42
|
-
expect(contract.buildInfoId).toBe('901568e56d422b1e1e3f64004cb4dd6e')
|
|
43
|
-
})
|
|
44
|
-
|
|
45
|
-
it('should parse a build-info file with multiple contracts', () => {
|
|
46
|
-
const content = readFixture('multi-contract-buildinfo.json')
|
|
47
|
-
const result = parseBuildInfo(content, '/test/multi-contract-buildinfo.json')
|
|
48
|
-
|
|
49
|
-
expect(result).not.toBeNull()
|
|
50
|
-
expect(result).toHaveLength(2)
|
|
51
|
-
|
|
52
|
-
const contracts = result!
|
|
53
|
-
expect(contracts.map(c => c.contractName)).toEqual(['Token', 'TokenFactory'])
|
|
54
|
-
expect(contracts.map(c => c.sourceName)).toEqual(['src/Token.sol', 'src/TokenFactory.sol'])
|
|
55
|
-
expect(contracts.map(c => c.fullyQualifiedName)).toEqual([
|
|
56
|
-
'src/Token.sol:Token',
|
|
57
|
-
'src/TokenFactory.sol:TokenFactory'
|
|
58
|
-
])
|
|
59
|
-
})
|
|
60
|
-
|
|
61
|
-
it('should return null for invalid JSON', () => {
|
|
62
|
-
const content = readFixture('invalid-json.txt')
|
|
63
|
-
const result = parseBuildInfo(content, '/test/invalid-json.txt')
|
|
64
|
-
|
|
65
|
-
expect(result).toBeNull()
|
|
66
|
-
})
|
|
67
|
-
|
|
68
|
-
it('should return null for JSON with wrong format', () => {
|
|
69
|
-
const content = readFixture('wrong-format.json')
|
|
70
|
-
const result = parseBuildInfo(content, '/test/wrong-format.json')
|
|
71
|
-
|
|
72
|
-
expect(result).toBeNull()
|
|
73
|
-
})
|
|
74
|
-
|
|
75
|
-
it('should return null for build-info with no contracts', () => {
|
|
76
|
-
const content = readFixture('no-contracts-buildinfo.json')
|
|
77
|
-
const result = parseBuildInfo(content, '/test/no-contracts-buildinfo.json')
|
|
78
|
-
|
|
79
|
-
expect(result).toBeNull()
|
|
80
|
-
})
|
|
81
|
-
|
|
82
|
-
it('should skip contracts with invalid bytecode', () => {
|
|
83
|
-
const content = readFixture('invalid-bytecode-buildinfo.json')
|
|
84
|
-
const result = parseBuildInfo(content, '/test/invalid-bytecode-buildinfo.json')
|
|
85
|
-
|
|
86
|
-
expect(result).not.toBeNull()
|
|
87
|
-
expect(result).toHaveLength(1) // Only one valid contract should be extracted
|
|
88
|
-
expect(result![0].contractName).toBe('ValidContract')
|
|
89
|
-
})
|
|
90
|
-
|
|
91
|
-
it('should include source content when available', () => {
|
|
92
|
-
const content = readFixture('simple-buildinfo.json')
|
|
93
|
-
const result = parseBuildInfo(content, '/test/simple-buildinfo.json')
|
|
94
|
-
|
|
95
|
-
expect(result).not.toBeNull()
|
|
96
|
-
expect(result![0].source).toContain('contract Counter')
|
|
97
|
-
})
|
|
98
|
-
})
|
|
99
|
-
|
|
100
|
-
describe('extractedContractToArtifact function', () => {
|
|
101
|
-
it('should convert ExtractedContract to Artifact format', () => {
|
|
102
|
-
const content = readFixture('simple-buildinfo.json')
|
|
103
|
-
const contracts = parseBuildInfo(content, '/test/simple-buildinfo.json')
|
|
104
|
-
|
|
105
|
-
expect(contracts).not.toBeNull()
|
|
106
|
-
const extracted = contracts![0]
|
|
107
|
-
const artifact = extractedContractToArtifact(extracted)
|
|
108
|
-
|
|
109
|
-
expect(artifact.contractName).toBe(extracted.contractName)
|
|
110
|
-
expect(artifact.abi).toBe(extracted.abi)
|
|
111
|
-
expect(artifact.bytecode).toBe(extracted.bytecode)
|
|
112
|
-
expect(artifact.deployedBytecode).toBe(extracted.deployedBytecode)
|
|
113
|
-
expect(artifact.sourceName).toBe(extracted.sourceName)
|
|
114
|
-
expect(artifact.source).toBe(extracted.source)
|
|
115
|
-
expect(artifact.compiler).toBe(extracted.compiler)
|
|
116
|
-
|
|
117
|
-
// Should not have build-info specific fields
|
|
118
|
-
expect(artifact).not.toHaveProperty('buildInfoId')
|
|
119
|
-
expect(artifact).not.toHaveProperty('fullyQualifiedName')
|
|
120
|
-
})
|
|
121
|
-
})
|
|
122
|
-
})
|
|
@@ -1,62 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_format": "hh-sol-build-info-1",
|
|
3
|
-
"id": "invalid123456789012345678901234567890abcd",
|
|
4
|
-
"solcVersion": "0.8.30",
|
|
5
|
-
"solcLongVersion": "0.8.30+commit.8fe82020",
|
|
6
|
-
"input": {
|
|
7
|
-
"language": "Solidity",
|
|
8
|
-
"sources": {
|
|
9
|
-
"src/ValidContract.sol": {
|
|
10
|
-
"content": "pragma solidity 0.8.30; contract ValidContract {}"
|
|
11
|
-
},
|
|
12
|
-
"src/InvalidContract.sol": {
|
|
13
|
-
"content": "pragma solidity 0.8.30; contract InvalidContract {}"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"settings": {
|
|
17
|
-
"outputSelection": {
|
|
18
|
-
"*": {
|
|
19
|
-
"*": ["abi", "evm.bytecode", "evm.deployedBytecode"]
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
},
|
|
24
|
-
"output": {
|
|
25
|
-
"contracts": {
|
|
26
|
-
"src/ValidContract.sol": {
|
|
27
|
-
"ValidContract": {
|
|
28
|
-
"abi": [],
|
|
29
|
-
"evm": {
|
|
30
|
-
"bytecode": {
|
|
31
|
-
"object": "0x608060405234801561001057600080fd5b50005b"
|
|
32
|
-
},
|
|
33
|
-
"deployedBytecode": {
|
|
34
|
-
"object": "0x608060405234801561001057600080fd5b50005b"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
},
|
|
39
|
-
"src/InvalidContract.sol": {
|
|
40
|
-
"InvalidContract": {
|
|
41
|
-
"abi": [],
|
|
42
|
-
"evm": {
|
|
43
|
-
"bytecode": {
|
|
44
|
-
"object": "invalid_bytecode_without_0x_prefix"
|
|
45
|
-
},
|
|
46
|
-
"deployedBytecode": {
|
|
47
|
-
"object": "0x608060405234801561001057600080fd5b50005b"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"sources": {
|
|
54
|
-
"src/ValidContract.sol": {
|
|
55
|
-
"id": 0
|
|
56
|
-
},
|
|
57
|
-
"src/InvalidContract.sol": {
|
|
58
|
-
"id": 1
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
@@ -1,89 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_format": "hh-sol-build-info-1",
|
|
3
|
-
"id": "abc123def456789012345678901234567890abcd",
|
|
4
|
-
"solcVersion": "0.8.30",
|
|
5
|
-
"solcLongVersion": "0.8.30+commit.8fe82020",
|
|
6
|
-
"input": {
|
|
7
|
-
"language": "Solidity",
|
|
8
|
-
"sources": {
|
|
9
|
-
"src/Token.sol": {
|
|
10
|
-
"content": "pragma solidity 0.8.30;\n\ncontract Token {\n string public name = \"TestToken\";\n uint256 public totalSupply = 1000;\n}"
|
|
11
|
-
},
|
|
12
|
-
"src/TokenFactory.sol": {
|
|
13
|
-
"content": "pragma solidity 0.8.30;\n\ncontract TokenFactory {\n function createToken() external returns (address) {\n // Factory logic here\n return address(0);\n }\n}"
|
|
14
|
-
}
|
|
15
|
-
},
|
|
16
|
-
"settings": {
|
|
17
|
-
"optimizer": {
|
|
18
|
-
"enabled": true,
|
|
19
|
-
"runs": 200
|
|
20
|
-
},
|
|
21
|
-
"outputSelection": {
|
|
22
|
-
"*": {
|
|
23
|
-
"*": ["abi", "evm.bytecode", "evm.deployedBytecode"]
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
}
|
|
27
|
-
},
|
|
28
|
-
"output": {
|
|
29
|
-
"contracts": {
|
|
30
|
-
"src/Token.sol": {
|
|
31
|
-
"Token": {
|
|
32
|
-
"abi": [
|
|
33
|
-
{
|
|
34
|
-
"type": "function",
|
|
35
|
-
"name": "name",
|
|
36
|
-
"inputs": [],
|
|
37
|
-
"outputs": [{"name": "", "type": "string", "internalType": "string"}],
|
|
38
|
-
"stateMutability": "view"
|
|
39
|
-
},
|
|
40
|
-
{
|
|
41
|
-
"type": "function",
|
|
42
|
-
"name": "totalSupply",
|
|
43
|
-
"inputs": [],
|
|
44
|
-
"outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}],
|
|
45
|
-
"stateMutability": "view"
|
|
46
|
-
}
|
|
47
|
-
],
|
|
48
|
-
"evm": {
|
|
49
|
-
"bytecode": {
|
|
50
|
-
"object": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806306fdde031461003b57806318160ddd14610059575b600080fd5b610043610077565b6040516100509190610100565b60405180910390f35b610061610115565b60405161006e9190610122565b60405180910390f35b60606040518060400160405280600981526020017f546573745f546f6b656e0000000000000000000000000000000000000000000081525090565b60006103e890505b90565b600081519050919050565b600082825260208201905092915050565b60005b8381101561015957808201518184015260208101905061013e565b83811115610168576000848401525b50505050565b6000601f19601f8301169050919050565b6000610186826101225b61019081610174565b9050919050565b60006020820190508181036000830152610197816101a0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806101d957607f821691505b602082108114156101ed576101ec6101a2565b5b5091905056fea2646970667358221220d4c6f7e4b8f9a5d8c2b1a0e9f8d7c6b5a4938271605948372819465730384756464736f6c634300081e0033"
|
|
51
|
-
},
|
|
52
|
-
"deployedBytecode": {
|
|
53
|
-
"object": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c806306fdde031461003b57806318160ddd14610059575b600080fd5b610043610077565b6040516100509190610100565b60405180910390f35b610061610115565b60405161006e9190610122565b60405180910390f35b60606040518060400160405280600981526020017f546573745f546f6b656e0000000000000000000000000000000000000000000081525090565b60006103e890505b90565b600081519050919050565b600082825260208201905092915050565b60005b8381101561015957808201518184015260208101905061013e565b83811115610168576000848401525b50505050565b6000601f19601f8301169050919050565b6000610186826101225b61019081610174565b9050919050565b60006020820190508181036000830152610197816101a0565b9050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806101d957607f821691505b602082108114156101ed576101ec6101a2565b5b5091905056fea2646970667358221220e5d7f6e4b8f9a5d8c2b1a0e9f8d7c6b5a4938271605948372819465730384756464736f6c634300081e0033"
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
},
|
|
58
|
-
"src/TokenFactory.sol": {
|
|
59
|
-
"TokenFactory": {
|
|
60
|
-
"abi": [
|
|
61
|
-
{
|
|
62
|
-
"type": "function",
|
|
63
|
-
"name": "createToken",
|
|
64
|
-
"inputs": [],
|
|
65
|
-
"outputs": [{"name": "", "type": "address", "internalType": "address"}],
|
|
66
|
-
"stateMutability": "nonpayable"
|
|
67
|
-
}
|
|
68
|
-
],
|
|
69
|
-
"evm": {
|
|
70
|
-
"bytecode": {
|
|
71
|
-
"object": "0x608060405234801561001057600080fd5b50600436106100295760003560e01c8063c63a5b6d1461002e575b600080fd5b61003661004c565b60405161004391906100a1565b60405180910390f35b60006000905090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061007f82610054565b9050919050565b61008f81610074565b82525050565b60006020820190506100aa6000830184610086565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806100f857607f821691505b6020821081141561010c5761010b6100b1565b5b5091905056fea2646970667358221220e5d7f6e4b8f9a5d8c2b1a0e9f8d7c6b5a4938271605948372819465730384756464736f6c634300081e0033"
|
|
72
|
-
},
|
|
73
|
-
"deployedBytecode": {
|
|
74
|
-
"object": "0x608060405234801561001057600080fd5b50600436106100295760003560e01c8063c63a5b6d1461002e575b600080fd5b61003661004c565b60405161004391906100a1565b60405180910390f35b60006000905090565b600073ffffffffffffffffffffffffffffffffffffffff82169050919050565b600061007f82610054565b9050919050565b61008f81610074565b82525050565b60006020820190506100aa6000830184610086565b92915050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052602260045260246000fd5b600060028204905060018216806100f857607f821691505b6020821081141561010c5761010b6100b1565b5b5091905056fea2646970667358221220e5d7f6e4b8f9a5d8c2b1a0e9f8d7c6b5a4938271605948372819465730384756464736f6c634300081e0033"
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
},
|
|
80
|
-
"sources": {
|
|
81
|
-
"src/Token.sol": {
|
|
82
|
-
"id": 0
|
|
83
|
-
},
|
|
84
|
-
"src/TokenFactory.sol": {
|
|
85
|
-
"id": 1
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_format": "hh-sol-build-info-1",
|
|
3
|
-
"id": "000000000000000000000000000000000000000000000000000000000000000",
|
|
4
|
-
"solcVersion": "0.8.30",
|
|
5
|
-
"solcLongVersion": "0.8.30+commit.8fe82020",
|
|
6
|
-
"input": {
|
|
7
|
-
"language": "Solidity",
|
|
8
|
-
"sources": {},
|
|
9
|
-
"settings": {
|
|
10
|
-
"outputSelection": {}
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"output": {
|
|
14
|
-
"contracts": {},
|
|
15
|
-
"sources": {}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"_format": "hh-sol-build-info-1",
|
|
3
|
-
"id": "901568e56d422b1e1e3f64004cb4dd6e",
|
|
4
|
-
"solcVersion": "0.8.30",
|
|
5
|
-
"solcLongVersion": "0.8.30+commit.8fe82020",
|
|
6
|
-
"input": {
|
|
7
|
-
"language": "Solidity",
|
|
8
|
-
"sources": {
|
|
9
|
-
"src/Counter.sol": {
|
|
10
|
-
"content": "pragma solidity 0.8.30;\n\ncontract Counter {\n uint256 public count;\n \n function increment() external {\n count++;\n }\n \n function getCount() external view returns (uint256) {\n return count;\n }\n}"
|
|
11
|
-
}
|
|
12
|
-
},
|
|
13
|
-
"settings": {
|
|
14
|
-
"optimizer": {
|
|
15
|
-
"enabled": true,
|
|
16
|
-
"runs": 200
|
|
17
|
-
},
|
|
18
|
-
"outputSelection": {
|
|
19
|
-
"*": {
|
|
20
|
-
"*": ["abi", "evm.bytecode", "evm.deployedBytecode"]
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
}
|
|
24
|
-
},
|
|
25
|
-
"output": {
|
|
26
|
-
"contracts": {
|
|
27
|
-
"src/Counter.sol": {
|
|
28
|
-
"Counter": {
|
|
29
|
-
"abi": [
|
|
30
|
-
{
|
|
31
|
-
"type": "function",
|
|
32
|
-
"name": "increment",
|
|
33
|
-
"inputs": [],
|
|
34
|
-
"outputs": [],
|
|
35
|
-
"stateMutability": "nonpayable"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
"type": "function",
|
|
39
|
-
"name": "getCount",
|
|
40
|
-
"inputs": [],
|
|
41
|
-
"outputs": [{"name": "", "type": "uint256", "internalType": "uint256"}],
|
|
42
|
-
"stateMutability": "view"
|
|
43
|
-
}
|
|
44
|
-
],
|
|
45
|
-
"evm": {
|
|
46
|
-
"bytecode": {
|
|
47
|
-
"object": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063a87d942c1461003b578063d09de08a14610059575b600080fd5b610043610063565b6040516100509190610084565b60405180910390f35b610061610069565b005b60005481565b600160008082825461007b919061009f565b92505081905550565b60005b8381101561009e5780820151818401526020810190506100835b50505050565b60008201905061009c565b60008219050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600081905091905056fea2646970667358221220c4d6f7e4b8f9a5d8c2b1a0e9f8d7c6b5a4938271605948372819465730384756464736f6c634300081e0033",
|
|
48
|
-
"sourceMap": "25:194:0:-:0;;;67:1;44:24;;25:194;;;;;;"
|
|
49
|
-
},
|
|
50
|
-
"deployedBytecode": {
|
|
51
|
-
"object": "0x608060405234801561001057600080fd5b50600436106100365760003560e01c8063a87d942c1461003b578063d09de08a14610059575b600080fd5b610043610063565b6040516100509190610084565b60405180910390f35b610061610069565b005b60005481565b600160008082825461007b919061009f565b92505081905550565b60005b8381101561009e5780820151818401526020810190506100835b50505050565b60008201905061009c565b60008219050919050565b7f4e487b7100000000000000000000000000000000000000000000000000000000600052601160045260246000fd5b600081905091905056fea2646970667358221220c4d6f7e4b8f9a5d8c2b1a0e9f8d7c6b5a4938271605948372819465730384756464736f6c634300081e0033"
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
},
|
|
57
|
-
"sources": {
|
|
58
|
-
"src/Counter.sol": {
|
|
59
|
-
"id": 0
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
}
|