-
Notifications
You must be signed in to change notification settings - Fork 78
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
Deprecate /transaction-confirmation
endpoint
#1973
Conversation
Pull Request Test Coverage Report for Build 11106369405Details
💛 - Coveralls |
public findDepositTransaction(args: { | ||
chainId: string; | ||
to?: `0x${string}`; | ||
data: `0x${string}`; | ||
}): Promise<{ to: `0x${string}`; data: `0x${string}` } | null> { | ||
return this.findNativeStakingTransaction({ | ||
signature: KilnNativeStakingHelper.VALIDATORS_EXIT_SIGNATURE, | ||
...args, | ||
}); | ||
value: string; | ||
}): { to?: `0x${string}`; data: `0x${string}`; value: string } | null { | ||
const selector = toFunctionSelector( | ||
KilnNativeStakingHelper.DEPOSIT_SIGNATURE, | ||
); | ||
return this.transactionFinder.findTransaction( | ||
(transaction) => transaction.data.startsWith(selector), | ||
args, | ||
); | ||
} | ||
|
||
public async findWithdrawTransaction(args: { | ||
public findValidatorsExitTransaction(args: { | ||
chainId: string; | ||
to?: `0x${string}`; | ||
data: `0x${string}`; | ||
}): Promise<{ to: `0x${string}`; data: `0x${string}` } | null> { | ||
return this.findNativeStakingTransaction({ | ||
signature: KilnNativeStakingHelper.WITHDRAW_SIGNATURE, | ||
...args, | ||
}); | ||
value: string; | ||
}): { to?: `0x${string}`; data: `0x${string}`; value: string } | null { | ||
const selector = toFunctionSelector( | ||
KilnNativeStakingHelper.VALIDATORS_EXIT_SIGNATURE, | ||
); | ||
return this.transactionFinder.findTransaction( | ||
(transaction) => transaction.data.startsWith(selector), | ||
args, | ||
); | ||
} | ||
|
||
private async findNativeStakingTransaction(args: { | ||
signature: string; | ||
public findWithdrawTransaction(args: { | ||
chainId: string; | ||
to?: `0x${string}`; | ||
data: `0x${string}`; | ||
}): Promise<{ to: `0x${string}`; data: `0x${string}` } | null> { | ||
const transaction = this.transactionFinder.findTransaction( | ||
(transaction) => | ||
transaction.data.startsWith(toFunctionSelector(args.signature)), | ||
value: string; | ||
}): { to?: `0x${string}`; data: `0x${string}`; value: string } | null { | ||
const selector = toFunctionSelector( | ||
KilnNativeStakingHelper.WITHDRAW_SIGNATURE, | ||
); | ||
return this.transactionFinder.findTransaction( | ||
(transaction) => transaction.data.startsWith(selector), | ||
args, | ||
); |
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.
When writing the tests, I realised we also check the deployment when mapping and fallback to a "standard" transaction there. This is therefore unnecessary, and now covered by tests.
args.dataDecoded, | ||
); | ||
const publicKeys = this.kilnNativeStakingHelper.splitPublicKeys( | ||
this.kilnDecoder.decodeValidatorsExit(args.data)!.parameters[0].value, |
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.
There is a TODO added to the KilnDecoder
to simplify this after deprecating the /transaction-confirmations
endpoint.
return []; | ||
}): Promise<Array<`0x${string}`> | null> { | ||
if (!args.txHash) { | ||
return null; |
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 have looked through the client codebase and this will not affect the current implementation. The validators
are only mapped on exit transactions, when we know the values.
/transaction-confirmation
endpoint
@@ -364,4 +414,3299 @@ describe('Preview transaction - Transactions Controller (Unit)', () => { | |||
}, | |||
}); | |||
}); | |||
|
|||
describe('CoW Swap', () => { |
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.
Very nit: what do you think about splitting these transactions preview
tests by the provider (CowSwap, Kiln, Safe) into several files?
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.
Split in 3a2c239.
At the request of QA, I'm marking this as a draft until the multichain feature is released. |
Adds swap and staking test coverage to the `/preview` endpoint to ensure usage of it can replace the `/transaction-confirmation` one (migrated from the latter's suite), fixing any found issues: - Decode staking transaction data instead of using `dataDecoded` (because of batches). - Correct types for `/preview` endpoint. - Add swap/staking test coverage to `/preview` endpoint. - Update other tests according.
Adds swap and staking test coverage to the `/preview` endpoint to ensure usage of it can replace the `/transaction-confirmation` one (migrated from the latter's suite), fixing any found issues: - Decode staking transaction data instead of using `dataDecoded` (because of batches). - Correct types for `/preview` endpoint. - Add swap/staking test coverage to `/preview` endpoint. - Update other tests according.
Summary
Resolves #1927
Currently, the
/transaction-confirmation
returns aTransactionInfo
-like entity for the client to render details about swaps and TWAPs. We equally have the/preview
endpoint that returns aTransactionInfo
entity.This adds swap and staking test coverage to the
/preview
endpoint to ensure usage of it can replace the/transaction-confirmation
one (migrated from the latter's suite), fixing any found issues.Changes
dataDecoded
(because of batches)./preview
endpoint./preview
endpoint.