Skip to content

Contract-library tries to find all contracts on Github even under NPM Link status #3

@benjamistan

Description

@benjamistan

Expected Behavior

When trying to test new contracts using a local dev copy of contracts-library, the contracts-library repo should look locally if the HTTP call to find the json on Github fails.

Current Behavior

When trying to test a new GMTetherToken.sol contract using npm link, it appears that utils.js is still redirecting to Github to find the json and getting a 404.

Possible Solution

Check local before going to Github?

Steps to Reproduce

  1. Create new contract in this library using the standard steps
  2. Run npm link in your local contract-library folder
  3. Run npm link @xgm/contract-library in your local godmode-sample-project folder
  4. Run npx godmode install in your local godmode-sample-project-folder

Output

Installing protocols for GM...
/Users/Ben-XGM/gm/contract-library/dist/utils.js:27
                    throw error_codes_1.HTTPError(res.statusCode, `${url} ${res.statusCode} ${res.statusMessage}`);
                    ^

CustomError [HTTPError]: https://raw.githubusercontent.com/xGodMode/contract-library/main/build/protocols/Tether.json 404 Not Found
    at Object.HTTPError (/Users/Ben-XGM/gm/contract-library/node_modules/@xgm/error-codes/dist/index.js:23:12)
    at ClientRequest.<anonymous> (/Users/Ben-XGM/gm/contract-library/dist/utils.js:27:41)
    at Object.onceWrapper (events.js:422:26)
    at ClientRequest.emit (events.js:315:20)
    at HTTPParser.parserOnIncomingClient [as onIncoming] (_http_client.js:641:27)
    at HTTPParser.parserOnHeadersComplete (_http_common.js:126:17)
    at TLSSocket.socketOnData (_http_client.js:509:22)
    at TLSSocket.emit (events.js:315:20)
    at addChunk (internal/streams/readable.js:309:12)
    at readableAddChunk (internal/streams/readable.js:284:9) {
  code: 'HTTP404',
  timestamp: 1630955568532,
  metadata: { statusCode: 404 }
}

Context (Environment)

I need to test local dev copies of contract-library without having to run npm publish each time I make changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions