optakt / flow-dps

Flow Data Provisioning Service
Apache License 2.0
29 stars 13 forks source link

Add tests for Rosetta Construction API #400

Closed Ullaakut closed 3 years ago

Ullaakut commented 3 years ago

Goal of this PR

Part of #333

Additional Notes

// FIXME: The naming of those funcs conflict with the transactor's, since they have the same dependencies :(
//        How can we name this in a consistent way that makes sense?
func ParseTransaction(tx *sdk.Transaction) func(*TransactionParser) {
    return func(parser *TransactionParser) {
        parser.tx = tx
    }
}

func ParseValidator(validate Validator) func(*TransactionParser) {
    return func(parser *TransactionParser) {
        parser.validate = validate
    }
}

func ParseGenerator(generate Generator) func(*TransactionParser) {
    return func(parser *TransactionParser) {
        parser.generate = generate
    }
}

func ParseInvoker(invoke Invoker) func(*TransactionParser) {
    return func(parser *TransactionParser) {
        parser.invoke = invoke
    }
}

Any suggestions? Since we already have WithX for injecting those dependencies to the Transactor in the same package.

Checklist

awfm9 commented 3 years ago

Any suggestions? Since we already have WithX for injecting those dependencies to the Transactor in the same package.

If these are purely for testing, you can just use InjectXXX etc?