-
Notifications
You must be signed in to change notification settings - Fork 301
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
Migrating ethwrite adapter to monorepo #290
Migrating ethwrite adapter to monorepo #290
Conversation
I see that you haven't updated any CHANGELOG files. Would it make sense to do so? |
6d5453f
to
bda1d1f
Compare
4ca6233
to
c166c8a
Compare
c166c8a
to
1e3f4e7
Compare
export const execute: ExecuteWithConfig<Config> = async (request) => { | ||
const validator = new Validator(request, customParams) | ||
if (validator.error) throw validator.error | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Load the provider and the wallet here, with the values from config
ethwrite/src/endpoint/txsend.ts
Outdated
if (validator.error) throw validator.error | ||
|
||
const jobRunID = validator.validated.id | ||
const externalAddress = validator.validated.data.exAddr || '' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
exAddr
is mandatory, so no need of giving the default value
import { deploy } from '../deploy_contract' | ||
|
||
// using DELAYED ROOT SUITE in order to start the chain and deploy the contract | ||
setTimeout(async function () { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not sure about this approach. Could a before
work?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Spent some time to make it working with before
, but async initialization does not work on describe
/context
(mochajs/mocha#2975).
Async calls could be resolved inside it
though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Opened a low priority issue #321 just so we remember this
6005db1
to
ab33a03
Compare
ethwrite/README.md
Outdated
|
||
- `exAddr`: The address for sending the transaction to. | ||
- `funcId`: (Optional) One of the following setter functions: `0xc2b12a73` for `bytes32`, `0xa53b1c1e` for `int256` or `0xd2282dc5` for `uint256` (defaults to `0xd2282dc5`) | ||
- `dataType`: (Optional) One of the following types: `bytes32`, `int256` or `uint256` (defaults to `uint256`) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We normally get the data pre-encoded from the previous tasks in the job run, and IMO we should not have dataType as a param (it should be assumed it's already encoded)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Made it optional(default usage will not encode the result), to retain the other functionality as well.
ab33a03
to
bcc535b
Compare
fc7671e
to
b2cbfc4
Compare
rpcUrl: string | ||
network?: string | ||
privateKey: string | ||
api: any |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you can remove api
right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If I want to use ExecuteWithConfig<C extends Config>
, I can't, since it is required in main Config type. And I don't feel like changing the adapter.ts
boilerplate, since IMHO should be removed at some point.
I was thinking of changing this type to ExecuteWithConfig<C>
but I am considering of checking this again separately, maybe as part of #293.
I can also just use execute = async (input: AdapterRequest, config: Config): Promise<AdapterResponse>
for the particular adapter as in synth-index
though. Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You're right, the tweak is made is some places is defining the makeExecute as const makeExecute = (config?: Config): Execute => {...
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's check changing it to either ExecuteWithConfig or removing the requirement of api
param, in another PR, what do you think?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's leave it as it is. There's an issue open on Config
inflexibility, we can leave it for another PR
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tagging #217
ethwrite/README.md
Outdated
} | ||
``` | ||
|
||
## Deploy & Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update the Readme as well. This won't be necessary anymore
ethwrite/test/adapter.test.ts
Outdated
const contract = new ethers.Contract(address, abi, provider) | ||
|
||
describe('execute', async () => { | ||
const execute = makeExecute({ rpcUrl, privateKey, api: {} }) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice 👍
8636560
to
1065b87
Compare
hardhat.config.js
Outdated
// See (https://hardhat.org/config/) for more details. | ||
|
||
// const { MNEMONIC } = require('./test.env') | ||
// const MNEMONIC = 'novel mobile inform nurse circle spoon cricket soup crowd clip hawk glad' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we clean this comments?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think only that last changes are needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great work 🥇. LGTM
2338cdd
to
5255bd4
Compare
Migration of this adapter: https://github.com/smartcontractkit/ethwrite-adapter