包详细信息

@celo/contractkit

celo-org176.3kApache-2.09.2.1

Celo's ContractKit to interact with Celo network

celo, blockchain, contractkit

自述文件

Developer Tooling

This repository contains the source code for various JS/TS developer tools and CLI(s) released by cLabs for the Celo community.

How we work

We are a GitHub-first team, which means we have a strong preference for communicating via GitHub. Please use GitHub to:

🐞 File a bug report

💬 Ask a question

Suggest a feature

🧑‍💻 Contribute!

🚔 Report a security vulnerability

[!TIP]

Please avoid messaging us via Slack, Telegram, or email. We are more likely to respond to you on GitHub than if you message us anywhere else. We actively monitor GitHub, and will get back to you shortly 🌟

Code

This repository contains source code for:

Contributing

If you're interested in contributing, please read the contributing docs before submitting a pull request.

Documentation

Head to the documentation to read and learn more about Celo SDK(s) and CLI(s).

Community

Check out the following places for more developer tooling-related content:

Authors

更新日志

@celo/contractkit

9.2.1

Patch Changes

9.2.0

Minor Changes

9.1.1

Patch Changes

9.1.0

Minor Changes

  • #535 c184fb1 Thanks @aaronmgdr! - Add CeloToken and LockedCelo aliases for deprecated GoldToken and LockedCelo Contracts enum

  • #533 549450f Thanks @soloseng! - added support for epochManager processGroups function to contractkit && celocli

Patch Changes

  • #553 78f9831 Thanks @aaronmgdr! - Use production release of @celo/abis

  • #558 f11a069 Thanks @aaronmgdr! - Fix incorrect repo link in package.json

  • Updated dependencies [f11a069]:

    • @celo/base@7.0.2
    • @celo/wallet-local@7.0.1
    • @celo/connect@6.1.2
    • @celo/utils@8.0.2

9.1.0-beta.1

Minor Changes

  • #533 549450f Thanks @soloseng! - added support for epochManager processGroups function to contractkit && celocli

Patch Changes

9.1.0-beta.0

Minor Changes

  • #535 c184fb1 Thanks @aaronmgdr! - Add CeloToken and LockedCelo aliases for deprecated GoldToken and LockedCelo Contracts enum

Patch Changes

  • Updated dependencies []:
    • @celo/wallet-local@7.0.1-beta.0

9.0.1

Patch Changes

9.0.1-beta.2

Patch Changes

9.0.1-beta.1

Patch Changes

  • #510 0d307db Thanks @shazarre! - Expose sendValidatorPayment methods for EpochManager contract wrapper

  • Updated dependencies []:

    • @celo/wallet-local@7.0.0-beta.1

9.0.1-beta.0

Patch Changes

9.0.0

Major Changes

  • #340 33ad4aa Thanks @aaronmgdr! - Removes all exports under the lib/identity folder. These have been move to a new @celo/metadata-claims package and should be imported from there.

    Note that folder structure is also flattened slightly. so replace @celo/contractkit/lib/identity/claims/ with @celo/metadata-claims/lib/

    example

    - import { createAccountClaim } from '@celo/contractkit/lib/identity/claims/account'
    + import { createAccountClaim } from '@celo/metadata-claims/lib/account'
    
    - import { ContractKit, IdentityMetadataWrapper, newKitFromWeb3 } from '@celo/contractkit'
    - import { ClaimTypes } from '@celo/contractkit/lib/identity'
    + import { ContractKit, newKitFromWeb3 } from '@celo/contractkit'
    + import { ClaimTypes, IdentityMetadataWrapper } from '@celo/metadata-claims'
    

    Note that Contractkit is Not a dependency. Instead when using IdentityMetadataWrapper you should make an object that satisfis the AccountMetadataSignerGetters type

    import { AccountMetadataSignerGetters } from '@celo/metadata-claims/lib/types'
    

    using viem it would be like

    const accountsMetaDataSignerGetters: AccountMetadataSignerGetters = {
      isAccount: async (address: string) => accounts.read.isAccount([address as Address]),
      getValidatorSigner: async (address: string) =>
        accounts.read.getValidatorSigner([address as Address]),
      getVoteSigner: async (address: string) =>
        accounts.read.getValidatorSigner([address as Address]),
      getAttestationSigner: async (address: string) =>
        accounts.read.getValidatorSigner([address as Address]),
    }
    

Minor Changes

  • #447 7bc05c2 Thanks @shazarre! - Exposes EpochManager.getElectedSigners contract method

  • 76045eb Thanks @shazarre! - ValidatorsWrapper: add registerValidatorNoBls to allow registration without BLS keys which are not supported in L2

Patch Changes

  • #463 eba89a3 Thanks @aaronmgdr! - Add GovernanceSlasher to RegisteredContractsEnum

  • #467 43e8474 Thanks @shazarre! - fix: add transferOwnership() to proxy abi list

  • #446 42d091f Thanks @aaronmgdr! - Bump @celo/abis-12

  • #480 b83d8c4 Thanks @aaronmgdr! - Recommended node version is now node 20

  • #455 36c4369 Thanks @aaronmgdr! - Mark contract wrapper methods that will not work on L2 because solidity contracts have onlyL1 modifier as deprecated.

    | Deprecated Contract / Method | Replacement or none | | -------------------------------------------- | ----------------------------------------- | | Validators#registerValidator | Validators#registerValidatorNoBLS | | BlockchainParams#getEpochNumberOfBlock | EpochManager#getEpochNumberOfBlock | | BlockchainParams#getFirstBlockNumberForEpoch | EpochManager#getFirstBlockAtEpoch | | Election#getCurrentValidatorSigners | EpochManager#getElectedSigners | | Election#getGroupEpochRewards | Election#getGroupEpochRewardsBasedOnScore | | GovernanceSlasher#slash | GovernanceSlasher#slashL2 | | DoubleSigningSlasher | X | | DowntimeSlasher | X |

  • #400 38fe4d0 Thanks @shazarre! - Renames getElected and its usages to getElectedAccounts for EpochManagerWrapper

  • #456 d5c9204 Thanks @nicolasbrugneaux! - Backwards compat for some methods using epoch's block numbers

  • Updated dependencies [c4b9c6d, d988d31, 4ef76eb, 26b9779, fb08485]:

    • @celo/wallet-local@6.0.4
    • @celo/base@7.0.0
    • @celo/utils@8.0.0
    • @celo/connect@6.1.0

9.0.0-beta.5

Patch Changes

9.0.0-beta.4

Patch Changes

9.0.0-beta.3

Minor Changes

Patch Changes

  • #446 42d091f Thanks @aaronmgdr! - Bump @celo/abis-12

  • #455 36c4369 Thanks @aaronmgdr! - Mark contract wrapper methods that will not work on L2 because solidity contracts have onlyL1 modifier as deprecated.

    | Deprecated Contract / Method | Replacement or none | | -------------------------------------------- | ----------------------------------------- | | Validators#registerValidator | Validators#registerValidatorNoBLS | | BlockchainParams#getEpochNumberOfBlock | EpochManager#getEpochNumberOfBlock | | BlockchainParams#getFirstBlockNumberForEpoch | EpochManager#getFirstBlockAtEpoch | | Election#getCurrentValidatorSigners | EpochManager#getElectedSigners | | Election#getGroupEpochRewards | Election#getGroupEpochRewardsBasedOnScore | | GovernanceSlasher#slash | GovernanceSlasher#slashL2 | | DoubleSigningSlasher | X | | DowntimeSlasher | X |

  • #456 d5c9204 Thanks @nicolasbrugneaux! - Backwards compat for some methods using epoch's block numbers

  • Updated dependencies []:

    • @celo/wallet-local@6.0.4-beta.1

9.0.0-beta.2

Patch Changes

  • Updated dependencies [c4b9c6d, fb08485]:
    • @celo/wallet-local@6.0.3-beta.1
    • @celo/connect@6.1.0-beta.1

9.0.0-beta.1

Minor Changes

  • 76045eb Thanks @shazarre! - ValidatorsWrapper: add registerValidatorNoBls to allow registration without BLS keys which are not supported in L2

Patch Changes

  • #400 38fe4d0 Thanks @shazarre! - Renames getElected and its usages to getElectedAccounts for EpochManagerWrapper

  • Updated dependencies [d988d31]:

    • @celo/wallet-local@6.0.2-beta.1

9.0.0-beta.0

Major Changes

  • #340 33ad4aa Thanks @aaronmgdr! - Removes all exports under the lib/identity folder. These have been move to a new @celo/metadata-claims package and should be imported from there.

    Note that folder structure is also flattened slightly. so replace @celo/contractkit/lib/identity/claims/ with @celo/metadata-claims/lib/

    example

    - import { createAccountClaim } from '@celo/contractkit/lib/identity/claims/account'
    + import { createAccountClaim } from '@celo/metadata-claims/lib/account'
    
    - import { ContractKit, IdentityMetadataWrapper, newKitFromWeb3 } from '@celo/contractkit'
    - import { ClaimTypes } from '@celo/contractkit/lib/identity'
    + import { ContractKit, newKitFromWeb3 } from '@celo/contractkit'
    + import { ClaimTypes, IdentityMetadataWrapper } from '@celo/metadata-claims'
    

    Note that Contractkit is Not a dependency. Instead when using IdentityMetadataWrapper you should make an object that satisfis the AccountMetadataSignerGetters type

    import { AccountMetadataSignerGetters } from '@celo/metadata-claims/lib/types'
    

    using viem it would be like

    const accountsMetaDataSignerGetters: AccountMetadataSignerGetters = {
      isAccount: async (address: string) => accounts.read.isAccount([address as Address]),
      getValidatorSigner: async (address: string) =>
        accounts.read.getValidatorSigner([address as Address]),
      getVoteSigner: async (address: string) =>
        accounts.read.getValidatorSigner([address as Address]),
      getAttestationSigner: async (address: string) =>
        accounts.read.getValidatorSigner([address as Address]),
    }
    

Patch Changes

  • Updated dependencies [4ef76eb]:
    • @celo/base@7.0.0-beta.0
    • @celo/utils@8.0.0-beta.0
    • @celo/connect@6.0.3-beta.0
    • @celo/wallet-local@6.0.2-beta.0

8.3.1

Patch Changes

  • #409 e709b88 Thanks @aaronmgdr! - Renames getElected and its usages to getElectedAccounts for EpochManagerWrapper

8.3.0

Minor Changes

  • #348 76d09b7 Thanks @shazarre! - Adds support for firstKnownEpoch, getFirstBlockAtEpoch, getLastBlockAtEpoch on EpochManager wrapper

Patch Changes

  • Updated dependencies [433b70e]:
    • @celo/connect@6.0.2

8.2.0

Minor Changes

8.1.1

Patch Changes

8.1.1-beta.0

Patch Changes

  • #315 dd67b8f Thanks @aaronmgdr! - chore (bump deps)

  • Updated dependencies [d245703]:

    • @celo/connect@6.0.1-beta.0
    • @celo/wallet-local@6.0.1-beta.0

8.1.0

Minor Changes

  • #264 59f4b42 Thanks @nicolasbrugneaux! - Add support for serializing, sending, parsing and deserializing cip66 transactions. This tx type is preffered over cip64 when paying for gas with tokens. Like eip1559 maxFeePerGass and maxPriorityFeePerGas are denominated in CELO. To create an cip66 transaction with Contractkit call the kit.populateMaxFeeInToken method with your transaction and then send it.

  • #267 f553539 Thanks @shazarre! - Introduced CeloDistributionScheduleWrapper

  • #266 182bf73 Thanks @aaronmgdr! - Adds support for FeeCurrencyDirectory contract

  • #266 182bf73 Thanks @aaronmgdr! - Introduces getConfig for FeeCurrencyDirectoryWrapper

  • #279 06019bf Thanks @shazarre! - Adds support for <1.5.0.0 and >=1.5.0.0 Governance contract version

Patch Changes

8.1.0-beta.1

Minor Changes

  • #264 59f4b42 Thanks @nicolasbrugneaux! - Add support for serializing, sending, parsing and deserializing cip66 transactions. This tx type is preffered over cip64 when paying for gas with tokens. Like eip1559 maxFeePerGass and maxPriorityFeePerGas are denominated in CELO. To create an cip66 transaction with Contractkit call the kit.populateMaxFeeInToken method with your transaction and then send it.

Patch Changes

  • Updated dependencies [59f4b42]:
    • @celo/wallet-local@6.0.0-beta.2
    • @celo/connect@6.0.0-beta.1

8.1.0-beta.0

Minor Changes

Patch Changes

8.0.0

Major Changes

  • #200 6e3372f Thanks @nicolasbrugneaux! - The following changes are related to adding support for more fee currencies in the @celo packages.

    (BREAKING): setFeeCurrency changed to accept an address instead of previously accepting a StableToken (CHANGED): all places referring to gasCurrencies have been changed from string to StrongAddress for safer types. This shouldn't impact you as you already should have been giving 0x${string} in these places (CHANGED): reinforced the types of most contract wrappers to use StrongAddress where appropriate

  • #200 6e3372f Thanks @nicolasbrugneaux! - Removes stable token infos from the kit.getNetworkConfig()

    Removes from StableTokenWrapper all InflationParameters including, valueToUnits(), unitsToValues(), setInflationParameters(),

    Removes the inflation params from StableTokenWrapper.getConfig

Patch Changes

8.0.0-beta.0

Major Changes

  • #188 08b0d6a Thanks @github-actions! - The following changes are related to adding support for more fee currencies in the @celo packages.

    (BREAKING): setFeeCurrency changed to accept an address instead of previously accepting a StableToken (CHANGED): all places referring to gasCurrencies have been changed from string to StrongAddress for safer types. This shouldn't impact you as you already should have been giving 0x${string} in these places (CHANGED): reinforced the types of most contract wrappers to use StrongAddress where appropriate

  • #188 a317972 Thanks @github-actions! - Removes stable token infos from the kit.getNetworkConfig()

    Removes from StableTokenWrapper all InflationParameters including, valueToUnits(), unitsToValues(), setInflationParameters(),

    Removes the inflation params from StableTokenWrapper.getConfig

Patch Changes

  • #168 c42682d Thanks @renovate! - Bump Cross Fetch to fix security vulnerability

  • #168 c42682d Thanks @renovate! - Bump web3-* to 1.10.4 -- Some consumers may be forced to upgrade their web3 instance to the same version

  • Updated dependencies [c42682d, 08b0d6a, 5335af5, 08b0d6a, 08b0d6a]:

    • @celo/wallet-local@5.2.0-beta.0
    • @celo/connect@5.3.0-beta.0
    • @celo/utils@6.0.1-beta.0
    • @celo/base@6.0.1-beta.0

7.2.0

Minor Changes

7.1.0

Minor Changes

  • #140 0ad9c01 Thanks @timmoreton! - Activate votes from any account, new optional parameter to specify for account in ElectionWrapper:activate

Patch Changes

  • Updated dependencies [28cd8f8]:
    • @celo/connect@5.2.0
    • @celo/wallet-local@5.1.3

7.1.0-beta.1

Patch Changes

  • Updated dependencies [28cd8f8]:
    • @celo/connect@5.2.0-beta.0
    • @celo/wallet-local@5.1.3-beta.0

7.1.0-beta.0

Minor Changes

  • #140 0ad9c01 Thanks @timmoreton! - Activate votes from any account, new optional parameter to specify for account in ElectionWrapper:activate

7.0.0

Major Changes

Patch Changes

  • #57 8fb6c76 Thanks @aaronmgdr! - Re-removes MetaTransaction wallets, as previously removed in 6.0.0 (9ab9d00eb).

    Remove support for deprecated MetaTransactionWallet and MetaTransactionWalletDeployer. If absolutely needed the contracts can be accessed directly or an alternative such as account abstraction should be used.

  • #56 7dfbcd6 Thanks @aaronmgdr! - Re-removes grandamento

    While 6.0.0 (9ab9d00eb) previously removed grandamento it was added back temporarily because @celo/celocli required the wrappers to be available in order to execute the proposal to remove it from governance. It is now gone for good. RIP.

    Due to previous removal this is not considered a breaking change.

  • Updated dependencies [6b2e34c]:

    • @celo/utils@6.0.0
    • @celo/wallet-local@5.1.2
    • @celo/connect@5.1.2

7.0.0-beta.2

Major Changes

Patch Changes

  • Updated dependencies [6b2e34c]:
    • @celo/utils@6.0.0-beta.0
    • @celo/connect@5.1.2-beta.0
    • @celo/wallet-local@5.1.2-beta.0

6.0.1-beta.1

Patch Changes

  • #56 7dfbcd6 Thanks @aaronmgdr! - Reremoves grandamento

    While 9ab9d00eb previously removed grandamento it was added back temporarily because the celo cli required the wrappers to be available in order to execute the proposal to remove it from governance. It is now gone for good. RIP.

    Due to previous removal this is not considered a breaking change.

6.0.1-beta.0

Patch Changes

  • #57 8fb6c76 Thanks @aaronmgdr! - Re-removes MetaTransaction wallets (as previously removed in 6.0)

    previous messsage for removal - 9ab9d00eb: Remove Support for deprecated MetaTransactionWallet and MetaTransactionWalletDeployer. IF absolutely needed the contracts can be accessed directly or an alternative such as account abstraction should be used

6.0.0

Major Changes

  • 1c9c844cf: Remove contracts from lib/generated. now available in @celo/abis package at @celo/abis/web3

6.0.0-beta.2

Patch Changes

  • ba27783ae: Revert removal of Contracts

6.0.0-beta.1

Major Changes

  • 9ab9d00eb: Remove Support for deprecated MetaTransactionWallet and MetaTransactionWalletDeployer. IF absolutely needed the contracts can be accessed directly or an alternative such as account abstraction should be used
  • 9ab9d00eb: Removes Grandamento from cli and contractkit completely as it has become no op by mento team

6.0.0-beta.0

Major Changes

  • 1c9c844cf: Remove contracts from lib/generated. now available in @celo/abis package at @celo/abis/web3

    If you were directly importing contracts from @celo/contractkit/lib/generated/* eg @celo/lib/generated/Accounts do a find replace

    find: @celo/contractkit/lib/generated/ replace: @celo/abis/web3/

5.2.1

Patch Changes

  • 88e3788b8: add notice that LockedGold.getTotalPendingWithdrawalsCount is not yet available on all networks
  • 70f600bb0: Mark MetaTransactionWallet and MetaTransactionWalletDeployer as deprecated, including functions to get them and their wrappers. see https://github.com/celo-org/celo-monorepo/issues/10766
  • 2985f9eb2: Refactor Accounts.getParsedSignatureOfAddress

5.2.0

Minor Changes

  • add FeeHandler Wrapper
  • 32face3d8: Governance delegation functions added
  • 87647b46b: Add multisig:approve command to CLI, expose MultiSig.confirmTransaction in ContractKit.

Patch Changes

  • Updated dependencies [679ef0c60]
  • Updated dependencies [97d5ccf43]
    • @celo/connect@5.1.1
    • @celo/base@6.0.0
    • @celo/utils@5.0.6
    • @celo/wallet-local@5.1.1

5.2.0-beta.0

Minor Changes

  • add FeeHandler Wrapper
  • 32face3d8: Governance delegation functions added
  • 87647b46b: Add multisig:approve command to CLI, expose MultiSig.confirmTransaction in ContractKit.

Patch Changes

  • Updated dependencies [97d5ccf43]
    • @celo/base@6.0.0-beta.0
    • @celo/connect@5.1.1-beta.0
    • @celo/utils@5.0.6-beta.0
    • @celo/wallet-local@5.1.1-beta.0

5.1.0

Minor Changes

  • d48c68afc: Add MultiSig.getTransaction() now optionally takes a second boolean param to avoid fetching confirmations information
  • d48c68afc: Add method getConfirmations() to Multisig Wrapper
  • 53bbd4958: Add cip64 support for feeCurrency Transactions. Note this is the replacement for the deprecated cip42 and legacy tx types https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip/0064.md

Patch Changes

  • 53bbd4958: Note celo sdk packages will no longer be fix bumped (ie will not share the same version always) and will now use ^range when depending on each other
  • d48c68afc: parallelize async calls in Governance Wrapper
  • Updated dependencies [d48c68afc]
  • Updated dependencies [53bbd4958]
  • Updated dependencies [53bbd4958]
    • @celo/connect@5.1.0
    • @celo/wallet-local@5.1.0
    • @celo/utils@5.0.5
    • @celo/base@5.0.5

5.1.0-beta.0

Minor Changes

  • d48c68afc: Add MultiSig.getTransaction() now optionally takes a second boolean param to avoid fetching confirmations information
  • d48c68afc: Add method getConfirmations() to Multisig Wrapper
  • 53bbd4958: Add cip64 support for feeCurrency Transactions. Note this is the replacement for the deprecated cip42 and legacy tx types https://github.com/celo-org/celo-proposals/blob/master/CIPs/cip/0064.md

Patch Changes

  • 53bbd4958: Note celo sdk packages will no longer be fix bumped (ie will not share the same version always) and will now use ^range when depending on each other
  • d48c68afc: parallelize async calls in Governance Wrapper
  • Updated dependencies [d48c68afc]
  • Updated dependencies [53bbd4958]
  • Updated dependencies [53bbd4958]
    • @celo/connect@5.1.0-beta.0
    • @celo/wallet-local@5.1.0-beta.0
    • @celo/utils@5.0.5-beta.0
    • @celo/base@5.0.5-beta.0