-
Notifications
You must be signed in to change notification settings - Fork 11
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
PLT-7693 get transaction by id #42
Conversation
export function proxy<A = never>(): A { | ||
return null as 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.
After making this I realized that I should probably try to make a Proxy<T>
type that is unusable instead of casting to A. For the purpose that is being used it shouldn't matter, but it would be better of course
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'm assuming this is missing functionality in fp-ts
and io-ts
and that it corresponds to data Proxy (t :: k)
from Haskell.
Can we live without this? It looks like growing tech debt. Is there an alternate solution where we cut out some fp-ts code instead which makes this unecessary?
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.
It is not missing functionality from fp-ts/io-ts in the sense that this is not required for "normal use". It is required by us for the reason I wrote at the beginning of the file.
If you use TypeScript (or any statically typed language) you'll eventually need some sort of dynamic checks or you are bound to have runtime errors.
For TS as far as I know you have:
and possible others...
Back in the day I created parmenides with a friend before the other libraries existed/got traction.
Knowing that we need runtime validation, and we already have io-ts in place (which has all the features we need and more), I don't believe this is adding to the technical debt. We just need to be judicious on what and how we expose things. See this exported doc as an example and note the difference between the types and the dynamic guards.
* @see {@link @marlowe.io/wallet!api.WalletAPI#signTx} | ||
* @see {@link index.RestAPI#submitContract} | ||
*/ | ||
// QUESTION: Should we rename the property or the type to indicate that is unsigned? |
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 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.
Yes we should imo
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.
cc: @jhbertra if you agree we can schedule this for 0.0.6
* @experimental | ||
* This type is experimental and subject to change. See current DISCUSSIONS in the source code. | ||
*/ |
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.
cc @nhenin , we should probably add this note to any experimental endpoint or attribute
// DISCUSSION: @Jamie, @N.H. The optional part is because this is only present if the transaction is confirmed? | ||
// If so, we should maybe include the Block Header as part of the confirmed constructor to avoid | ||
// impossible states? | ||
block: O.Option<BlockHeader>; | ||
/** | ||
* The UTXO that was used as input for the transaction. | ||
*/ | ||
inputUtxo: TxOutRef; | ||
/** | ||
* The list of Marlowe inputs that were applied in this transaction | ||
*/ | ||
inputs: Input[]; | ||
// DISCUSSION: @Jamie, @N.H. Similar discussion as the block one. Are these Options part of a confirmed | ||
// transaction? | ||
// Looking for this contractid and txid it has None for these fields in preprod | ||
// contractID "19a90f8db56fab54d5e4fc4a4c0fd5084bb280a07841f2182b22305962285ad1#1", | ||
// txId "b733caef6a21526b98586112d2090d0e1373654bf17ad85240fb12f08fb58802" | ||
outputUtxo: O.Option<TxOutRef>; | ||
outputContract: O.Option<Contract>; | ||
outputState: O.Option<MarloweState>; | ||
// QUESTION: @Jamie, @N.H, what is this? | ||
consumingTx: O.Option<TxId>; | ||
// DISCUSSION: @Jamie, @N.H. Should this be a TimeInterval instead? | ||
invalidBefore: ISO8601; | ||
invalidHereafter: ISO8601; | ||
// QUESTION: @Jamie, what is this? The signed txbody? | ||
txBody: O.Option<TextEnvelope>; |
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 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 are some states behind these Options that are not explicit... I would prefer have a notion of state instead of these pieces of information flatten...
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.
*/ | ||
// DISCUSSION: @N.H: Should we rename this to RestClient? |
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.
cc @nhenin
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.
Yes we should
* @see {@link @marlowe.io/wallet!api.WalletAPI#signTx} | ||
* @see {@link index.RestAPI#submitContract} | ||
*/ | ||
// QUESTION: Should we rename the property or the type to indicate that is unsigned? |
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.
Yes we should imo
// DISCUSSION: @Jamie, @N.H. The optional part is because this is only present if the transaction is confirmed? | ||
// If so, we should maybe include the Block Header as part of the confirmed constructor to avoid | ||
// impossible states? | ||
block: O.Option<BlockHeader>; | ||
/** | ||
* The UTXO that was used as input for the transaction. | ||
*/ | ||
inputUtxo: TxOutRef; | ||
/** | ||
* The list of Marlowe inputs that were applied in this transaction | ||
*/ | ||
inputs: Input[]; | ||
// DISCUSSION: @Jamie, @N.H. Similar discussion as the block one. Are these Options part of a confirmed | ||
// transaction? | ||
// Looking for this contractid and txid it has None for these fields in preprod | ||
// contractID "19a90f8db56fab54d5e4fc4a4c0fd5084bb280a07841f2182b22305962285ad1#1", | ||
// txId "b733caef6a21526b98586112d2090d0e1373654bf17ad85240fb12f08fb58802" | ||
outputUtxo: O.Option<TxOutRef>; | ||
outputContract: O.Option<Contract>; | ||
outputState: O.Option<MarloweState>; | ||
// QUESTION: @Jamie, @N.H, what is this? | ||
consumingTx: O.Option<TxId>; | ||
// DISCUSSION: @Jamie, @N.H. Should this be a TimeInterval instead? | ||
invalidBefore: ISO8601; | ||
invalidHereafter: ISO8601; | ||
// QUESTION: @Jamie, what is this? The signed txbody? | ||
txBody: O.Option<TextEnvelope>; |
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 are some states behind these Options that are not explicit... I would prefer have a notion of state instead of these pieces of information flatten...
// DISCUSSION: @Jamie, @N.H. The optional part is because this is only present if the transaction is confirmed? | ||
// If so, we should maybe include the Block Header as part of the confirmed constructor to avoid | ||
// impossible states? | ||
block: O.Option<BlockHeader>; | ||
/** | ||
* The UTXO that was used as input for the transaction. | ||
*/ | ||
inputUtxo: TxOutRef; | ||
/** | ||
* The list of Marlowe inputs that were applied in this transaction | ||
*/ | ||
inputs: Input[]; | ||
// DISCUSSION: @Jamie, @N.H. Similar discussion as the block one. Are these Options part of a confirmed | ||
// transaction? | ||
// Looking for this contractid and txid it has None for these fields in preprod | ||
// contractID "19a90f8db56fab54d5e4fc4a4c0fd5084bb280a07841f2182b22305962285ad1#1", | ||
// txId "b733caef6a21526b98586112d2090d0e1373654bf17ad85240fb12f08fb58802" | ||
outputUtxo: O.Option<TxOutRef>; | ||
outputContract: O.Option<Contract>; | ||
outputState: O.Option<MarloweState>; | ||
// QUESTION: @Jamie, @N.H, what is this? | ||
consumingTx: O.Option<TxId>; | ||
// DISCUSSION: @Jamie, @N.H. Should this be a TimeInterval instead? | ||
invalidBefore: ISO8601; | ||
invalidHereafter: ISO8601; | ||
// QUESTION: @Jamie, what is this? The signed txbody? | ||
txBody: O.Option<TextEnvelope>; |
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.
*/ | ||
// DISCUSSION: @N.H: Should we rename this to RestClient? |
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.
Yes we should
@hrajchert can you resolve the conflicts ? and we can merge it |
a7c30b5
to
0894555
Compare
This PR: