requestNetwork icon indicating copy to clipboard operation
requestNetwork copied to clipboard

feat: any to near advanced logic

Open leoslr opened this issue 2 years ago • 1 comments

  • Add the advanced logic extensions for payment with conversion for native token.
  • Add the native token near specific case
  • Add the associated tests

leoslr avatar May 05 '22 11:05 leoslr

Coverage Status

Coverage increased (+0.2%) to 88.465% when pulling 2f926c8f9b2f266233855664dcec00d3585ecafe on feat-any-to-near-advanced-logic into 97ee4354aac4b9f9583deec27505581b97e0799e on master.

coveralls avatar May 09 '22 08:05 coveralls

Code is great! I'm just missing some context:

  • What is this PN adding that any-to-eth-proxy does not support, apart from the fact that this is not for EVM?
  • What was the reason for adding this PN? (what feature is missing)
  • Maybe add the specs for any-to-native to clarify

@alexandre-abrioux

  • any-to-eth was EVM specific, this adds a generic PN (any-to-native) that can be used as a base to create other PN - any-to-near in this case, but we could also base any-to-eth on it.
  • For supporting any-to-near, we needed a new PN since some checks are network related, like the address validation.
  • I'll have to update the specs yes

leoslr avatar Sep 20 '22 10:09 leoslr

@yomarion I've made an update based on Alex comments that checks that network is define within the throwIfInvalidNetwork function. It makes this test fail https://github.com/RequestNetwork/requestNetwork/blob/master/packages/advanced-logic/test/extensions/payment-network/native-token.test.ts#L177 Are there any reason behind this test ? It looks a bit weird to me.

leoslr avatar Sep 20 '22 10:09 leoslr

@yomarion I've made an update based on Alex comments that checks that network is define within the throwIfInvalidNetwork function. It makes this test fail https://github.com/RequestNetwork/requestNetwork/blob/master/packages/advanced-logic/test/extensions/payment-network/native-token.test.ts#L177 Are there any reason behind this test ? It looks a bit weird to me.

I think it's to cover this case:

  • I create a request with a currency & network, without advanced-logic
  • I add an extension to the advanced logic, with a createAction. This action does not have to have a network, we get it from the request

yomarion avatar Sep 21 '22 16:09 yomarion

@yomarion I've made an update based on Alex comments that checks that network is define within the throwIfInvalidNetwork function. It makes this test fail https://github.com/RequestNetwork/requestNetwork/blob/master/packages/advanced-logic/test/extensions/payment-network/native-token.test.ts#L177 Are there any reason behind this test ? It looks a bit weird to me.

I think it's to cover this case:

  • I create a request with a currency & network, without advanced-logic
  • I add an extension to the advanced logic, with a createAction. This action does not have to have a network, we get it from the request

Note: We discussed this with Yoann and decided to go forward and remove the test

leoslr avatar Sep 22 '22 12:09 leoslr