Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

you CAN pass publicKey to Contract Client methods #1055

Open
chadoh opened this issue Sep 20, 2024 · 5 comments
Open

you CAN pass publicKey to Contract Client methods #1055

chadoh opened this issue Sep 20, 2024 · 5 comments
Labels

Comments

@chadoh
Copy link
Contributor

chadoh commented Sep 20, 2024

Describe the bug

If I pass publicKey to a specific method call on a contract client, it tells me that's not supported:

image

But it actually is passed through!

What version are you on?
12.3.0

To Reproduce
Steps to reproduce the behavior:

  1. Instantiate a contract client, omitting publicKey
  2. For a write method, set publicKey to your sender's address. You may need to add a // @ts-ignore or // @ts-expect-error before the line!
  3. See that the publicKey you set on the method call is set as the invoker on the call.

Expected behavior
We need to update the types to let people know they can do this! It's super handy, allowing you to have static contract clients in the project (as set up in our frontend templates), but still override transaction senders for change methods (which are actually fairly rare in apps, in my experience)

Additional context
We will need to update the types generated in the TS bindings to match, once this is done.

@chadoh chadoh added the bug label Sep 20, 2024
@github-project-automation github-project-automation bot moved this to Backlog (Not Ready) in DevX Sep 20, 2024
@chadoh chadoh moved this from Backlog (Not Ready) to Todo (Ready for Dev) in DevX Sep 20, 2024
@ShantelPeters
Copy link

Hello @chadoh i will love to take this up when OD hack begins tomorrow

@Botdavid
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

software engineering background and smart contract developer.

How I plan on tackling this issue

I would try updating the typescript bindings to accurately document and support the passing of publickey in contract client methods.

@ShantelPeters
Copy link

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

i am a blockchain developer and i will like to contribute to this ecosystem.

How I plan on tackling this issue

To approach this issue, i will firstly verify the bug by the following:

  1. Reproduce the Bug
  2. Update Type Definitions
  3. Test Changes
  4. Submit Changes

@ooochoche
Copy link

ooochoche commented Sep 27, 2024

I am applying to this issue via OnlyDust platform.

My background and how it can be leveraged

@chadoh I am a Frontend and a Blockchain Dev

How I plan on tackling this issue

This is the steps i will take to solve the existing bug:

  • I will reproduce the bug to confirm the issue.
  • Move to Identify the source of type mismatch, then update these types to include publicKey as a valid parameter.
  • I will modify the type definitions so that publicKey is recognized as a valid parameter in contract method calls. I’ll ensure the generator can properly handle this behavior.
  • Finally, after updating the types, I’ll test both the static type-checking and the runtime behavior to ensure everything works as expected without having to manually suppress TypeScript errors.

@ooochoche
Copy link

@chadoh I'm creating a PR soon, thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Status: Todo (Ready for Dev)
Development

No branches or pull requests

5 participants