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

Migrate From ContractKit to Viem #294

Draft
wants to merge 10 commits into
base: main
Choose a base branch
from
Draft

Migrate From ContractKit to Viem #294

wants to merge 10 commits into from

Conversation

aaronmgdr
Copy link
Member

@aaronmgdr aaronmgdr commented Sep 25, 2024

Description

Rather than use ContractKit use viem as the rpc caller / contracts library.

Changes

  • WalletSigner now takes a sign191 function instead of a contractKit instance. this makes it easy to use with whatever library you like such as viem client.signMessage or ethers.signMessage as long as they support eip191.

  • Many places that were expecting an address but typed as a regular string are now typed as 0x{string} aka Address

  • almost everywhere kit has been replaced with client and in some cases walletClient

  • @celo/phone-number-privacy-common/lib/contracts contract instances used internally (viem getContract + abi + address) getAccountsContract, getCUSDContract, getOdisPaymentsContract,

  • ContractKit is still needed for the @celo/identity/lib/offchain functions however these are not used in social connect as such ck is now a peer dependencies and marked as optional. Pottentially these offchain functions can be either deprecated or moved to a different codebase.

Tested

Needs someone who understand the system really well to really test it out.

TODO

  • need to re mock the getDataEncryptionKey method in the authentication.test in common package. one was done but the rest still need it and each seems to require different implementatation

  • try to replace contractkit with @celo/[email protected]

dont merge until we get this deployed to staging.

Related issues

Backwards compatibility

No. This is a Major Change

Documentation

documented in changesets the differences

Copy link

changeset-bot bot commented Sep 25, 2024

🦋 Changeset detected

Latest commit: 1f8fb50

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 7 packages
Name Type
@celo/phone-number-privacy-monitor Major
@celo/phone-number-privacy-combiner Major
@celo/identity Major
@celo/encrypted-backup Patch
@celo/phone-number-privacy-common Major
@celo/phone-number-privacy-signer Major
odis-example-scripts Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

Copy link

gitguardian bot commented Sep 25, 2024

⚠️ GitGuardian has uncovered 1 secret following the scan of your pull request.

Please consider investigating the findings and remediating the incidents. Failure to do so may lead to compromising the associated services or software components.

🔎 Detected hardcoded secret in your pull request
GitGuardian id GitGuardian status Secret Commit Filename
10990680 Triggered Generic High Entropy Secret 4a7b2c8 packages/common/src/test/values.ts View secret
🛠 Guidelines to remediate hardcoded secrets
  1. Understand the implications of revoking this secret by investigating where it is used in your code.
  2. Replace and store your secret safely. Learn here the best practices.
  3. Revoke and rotate this secret.
  4. If possible, rewrite git history. Rewriting git history is not a trivial act. You might completely break other contributing developers' workflow and you risk accidentally deleting legitimate data.

To avoid such incidents in the future consider


🦉 GitGuardian detects secrets in your source code to help developers and security teams secure the modern development process. You are seeing this because you or someone else with access to this repository has authorized GitGuardian to scan your pull request.

Copy link

socket-security bot commented Sep 25, 2024

New dependencies detected. Learn more about Socket for GitHub ↗︎

Package New capabilities Transitives Size Publisher
npm/@celo/[email protected] filesystem, network +5 5.28 MB app-tooling
npm/[email protected] network Transitive: environment, filesystem +17 20.9 MB jmoxey

View full report↗︎

await selfTransferTx.sendAndWaitForReceipt({ from: account })
}

export async function registerWalletAddress(
Copy link
Member Author

Choose a reason for hiding this comment

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

a test function not used in any tests

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.

Replace contractkit with viem
1 participant