-
Notifications
You must be signed in to change notification settings - Fork 575
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
adds missing fields to wallet transaction RPCs #3768
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,16 +28,20 @@ export type GetAccountTransactionsRequest = { | |
} | ||
|
||
export type GetAccountTransactionsResponse = { | ||
hash: string | ||
status: TransactionStatus | ||
type: TransactionType | ||
hash: string | ||
confirmations: number | ||
fee: string | ||
blockHash?: string | ||
blockSequence?: number | ||
notesCount: number | ||
spendsCount: number | ||
mintsCount: number | ||
burnsCount: number | ||
expiration: number | ||
timestamp: number | ||
submittedSequence: number | ||
assetBalanceDeltas: Array<{ assetId: string; assetName: string; delta: string }> | ||
notes?: RpcAccountDecryptedNote[] | ||
} | ||
|
@@ -58,16 +62,20 @@ export const GetAccountTransactionsRequestSchema: yup.ObjectSchema<GetAccountTra | |
export const GetAccountTransactionsResponseSchema: yup.ObjectSchema<GetAccountTransactionsResponse> = | ||
yup | ||
.object({ | ||
hash: yup.string().defined(), | ||
status: yup.string().oneOf(Object.values(TransactionStatus)).defined(), | ||
confirmations: yup.number().defined(), | ||
type: yup.string().oneOf(Object.values(TransactionType)).defined(), | ||
hash: yup.string().defined(), | ||
fee: yup.string().defined(), | ||
blockHash: yup.string().optional(), | ||
blockSequence: yup.number().optional(), | ||
notesCount: yup.number().defined(), | ||
spendsCount: yup.number().defined(), | ||
mintsCount: yup.number().defined(), | ||
burnsCount: yup.number().defined(), | ||
expiration: yup.number().defined(), | ||
timestamp: yup.number().defined(), | ||
submittedSequence: yup.number().defined(), | ||
assetBalanceDeltas: yup | ||
.array( | ||
yup | ||
|
@@ -106,7 +114,7 @@ router.register<typeof GetAccountTransactionsRequestSchema, GetAccountTransactio | |
|
||
const options = { | ||
headSequence, | ||
confirmations: request.data.confirmations, | ||
confirmations: request.data.confirmations ?? node.config.get('confirmations'), | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. you don't need to materialize this here right? it gets materialized where its used farther down There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as above -- we only need to materialize this here to include it in the response |
||
} | ||
|
||
if (request.data.hash) { | ||
|
@@ -155,9 +163,9 @@ const streamTransaction = async ( | |
node: IronfishNode, | ||
account: Account, | ||
transaction: TransactionValue, | ||
options?: { | ||
headSequence?: number | null | ||
confirmations?: number | ||
options: { | ||
headSequence: number | null | ||
confirmations: number | ||
}, | ||
): Promise<void> => { | ||
const serializedTransaction = serializeRpcAccountTransaction(transaction) | ||
|
@@ -176,6 +184,7 @@ const streamTransaction = async ( | |
...serializedTransaction, | ||
assetBalanceDeltas, | ||
status, | ||
confirmations: options.confirmations, | ||
type, | ||
notes, | ||
} | ||
|
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.
getTransactonStatus already materializes this so I dont think we need this code in the RPC do we?
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 materializing it here only to include it in the response