Skip to content

feat: generalized coder#407

Closed
tynes wants to merge 2 commits intomasterfrom
feat/core-utils-coder
Closed

feat: generalized coder#407
tynes wants to merge 2 commits intomasterfrom
feat/core-utils-coder

Conversation

@tynes
Copy link
Copy Markdown
Contributor

@tynes tynes commented Feb 11, 2021

Description

This is a WIP pull request, trying to deduplicate logic across services into the npm packages. This adds a generalized way to encode and decode the sequencer ctc elements

Metadata

Fixes

  • Fixes # [Link to Issue]

Contributing Agreement

Comment on lines +197 to +199
function encode(data) {
// TODO(annieke): establish API for how to decide which type
const type = 1 // parseInt(data.slice(0, 2), 16)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@tynes the data transport layer only generic decodes which you've written for already - for encode, what's the preferred way to established which type we should encode to? or is there a way to tell from the decoded tx?

Copy link
Copy Markdown
Contributor Author

@tynes tynes Feb 16, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we need to add a type field to this object:

      const eip155TxData = {
        sig: {
          v: 1,
          r: '0x' + '11'.repeat(32),
          s: '0x' + '22'.repeat(32),
        },
        gasLimit: 500,
        gasPrice: 100,
        nonce: 100,
        target: '0x' + '12'.repeat(20),
        data: '0x' + '99'.repeat(10),
      }

So that this encode function could look at the type and pass through to the appropriate coder. We may need to update a typescript type so that typescript builds

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

will do!

@tynes
Copy link
Copy Markdown
Contributor Author

tynes commented Feb 17, 2021

Closing this in favor of the non-monorepo version of this

@tynes tynes closed this Feb 17, 2021
@gakonst gakonst deleted the feat/core-utils-coder branch April 12, 2021 00:09
emhane pushed a commit that referenced this pull request Feb 3, 2026
Closes #224 
Closes #387

---------

Co-authored-by: Arun Dhyani <dhyaniarun7@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants