Enhance contract functionalities and streamline client configuration#74
Conversation
- Introduced `cancelled` and `cancelTreasury` functions in `AllOrNothing` and `KeepWhatsRaised` contracts. - Added `cancelCampaign` function in `CampaignInfo` contract. - Updated corresponding types in `client.ts` to reflect the new functionalities.
- Refactored the account assignment in the `createWallet` function to utilize `privateKeyToAccount` for improved clarity and correctness. - Removed redundant account extraction from the wallet client, streamlining the wallet creation process.
- Updated function names from `getplatformHash` and `getplatformFeePercent` to `getPlatformHash` and `getPlatformFeePercent` for consistency and adherence to naming conventions in both the contract and type definitions.
- Eliminated the `ResolvedOakContractsClientConfig` interface from `client.ts` to streamline the type definitions and improve clarity in client configuration handling.
- Updated the `buildClients` function to accept a new `options` parameter, allowing for customizable request timeouts in HTTP transport calls and transaction receipt waits. - Adjusted the default timeout value in `OakContractsClientOptions` from 3000ms to 30000ms for improved reliability in client operations.
- Introduced a new module for error handling in the contracts package by adding `errors` to the package.json and tsup.config.ts files. - Updated the build configuration to include the new `errors/index.ts` entry point for better organization and accessibility of error-related functionalities.
- Eliminated the `keccak256` export from the `index.ts` file in the contracts package to streamline the module exports and improve clarity.
- Updated the `createBrowserProvider` and `getSigner` functions to use `EIP1193Provider` instead of `any` for the `ethereum` parameter, enhancing type safety and clarity in the wallet client implementation. - Adjusted the transport handling in `createWallet` to utilize the `custom` transport method for better compatibility with various providers.
- Changed the chain ID from `CHAIN_IDS.CELO_SEPOLIA` to `CHAIN_IDS.CELO_TESTNET_SEPOLIA` in the client example for clarity. - Updated the chain ID constants to follow a new naming convention, distinguishing between mainnet and testnet. - Added `Celo Mainnet` definition to the chain registry for improved clarity and organization.
- Changed all instances of `CHAIN_IDS.CELO_SEPOLIA` to `CHAIN_IDS.CELO_TESTNET_SEPOLIA` in the README to reflect the correct testnet configuration. - Updated chain ID constants to better differentiate between mainnet and testnet environments, enhancing documentation accuracy.
- It's unreferenced dead code and its functionality is already covered by `contracts/`
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 00a0e9fdba
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 46f5ec5927
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
- Improved type checks for the `chainId`, `rpcUrl`, and `privateKey` properties in the `isSimpleConfig` function to ensure they meet specific criteria, enhancing type safety and configuration reliability.
- Deleted the `CELO_TESTNET_ALFAJORES` constant from the `CHAIN_IDS` to eliminate outdated references and encourage the use of `CELO_TESTNET_SEPOLIA` for new development.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f079d3ce21
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
Add missing function implementations to contract entities
cancelledandcancelTreasuryfunctions inAllOrNothingandKeepWhatsRaisedcontracts.cancelCampaignfunction inCampaignInfocontract.client.tsto reflect the new functionalities.Update account handling in wallet client creation
createWalletfunction to utilizeprivateKeyToAccountfor improved clarity and correctness.Standardize function name casing in PaymentTreasuryEntity
getplatformHashandgetplatformFeePercenttogetPlatformHashandgetPlatformFeePercentfor consistency and adherence to naming conventions in both the contract and type definitions.Remove
ResolvedOakContractsClientConfiginterfaceResolvedOakContractsClientConfiginterface fromclient.tsto streamline the type definitions and improve clarity in client configuration handling.Enhance client configuration with timeout options
buildClientsfunction to accept a newoptionsparameter, allowing for customizable request timeouts in HTTP transport calls and transaction receipt waits.OakContractsClientOptionsfrom 3000ms to 30000ms for improved reliability in client operations.Add error module to contract package
errorsto the package.json and tsup.config.ts files.errors/index.tsentry point for better organization and accessibility of error-related functionalities.Remove keccak256 export from contracts index
keccak256export from theindex.tsfile in the contracts package to streamline the module exports and improve clarity.Improve type definitions in wallet client functions
createBrowserProviderandgetSignerfunctions to useEIP1193Providerinstead ofanyfor theethereumparameter, enhancing type safety and clarity in the wallet client implementation.createWalletto utilize thecustomtransport method for better compatibility with various providers.keep Jest config loadable after switching package to ESM
Update chain ID naming and usage in client configuration
CHAIN_IDS.CELO_SEPOLIAtoCHAIN_IDS.CELO_TESTNET_SEPOLIAin the client example for clarity.Celo Mainnetdefinition to the chain registry for improved clarity and organization.Update chain ID references in README for clarity
CHAIN_IDS.CELO_SEPOLIAtoCHAIN_IDS.CELO_TESTNET_SEPOLIAin the README to reflect the correct testnet configuration.Remove deprecated `entities' files
contracts/.