From 65b5c0f3ed5896f8583c12d5a22cef1f0a307cd1 Mon Sep 17 00:00:00 2001 From: Jon Tzeng Date: Fri, 6 Oct 2023 10:54:08 -0700 Subject: [PATCH] fixup! Add EdgeTxInfo types --- CHANGELOG.md | 1 + src/types/types.ts | 21 ++++++++++++++++----- 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index bcd40d71f..d4b5ebfc1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,7 @@ # edge-core-js ## Unreleased +- added: EdgeTxInfo types to tag known transaction types (swap, stake, etc) ## 1.8.0 (2023-10-02) diff --git a/src/types/types.ts b/src/types/types.ts index 365f7bc44..91f2f1417 100644 --- a/src/types/types.ts +++ b/src/types/types.ts @@ -251,21 +251,32 @@ export interface EdgeMemo { export interface EdgeTxAsset { pluginId: string - tokenId: string - nativeAmount: string + tokenId?: string + nativeAmount?: string } +export type EdgeTxInfoSwapType = + | 'swap' + | 'swapOrderPost' + | 'swapOrderFill' + | 'swapOrderCancel' + export interface EdgeTxInfoSwap { - type: 'swap' | 'swapOrderPost' | 'swapOrderFill' + type: EdgeTxInfoSwapType orderId?: string - direction: 'from' | 'to' canBePartial?: boolean sourceAsset: EdgeTxAsset destAsset: EdgeTxAsset } +export type EdgeTxInfoStakeType = + | 'stake' + | 'stakeOrder' + | 'unstake' + | 'unstakeOrder' + export interface EdgeTxInfoStake { - type: 'stake' | 'stakeOrder' | 'unstake' | 'unstakeOrder' + type: EdgeTxInfoStakeType stakeAssets: EdgeTxAsset[] }