Skip to content

Commit

Permalink
Add EdgeTxInfo types
Browse files Browse the repository at this point in the history
  • Loading branch information
Jon-edge authored and swansontec committed Oct 10, 2023
1 parent a9432cb commit 23cbb63
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# edge-core-js

## Unreleased
- added: EdgeTxAction types to tag known smart contract trasaction types (swap, stake, etc)

## 1.9.0 (2023-10-10)

Expand Down
34 changes: 34 additions & 0 deletions src/types/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -249,6 +249,39 @@ export interface EdgeMemo {
memoName?: string
}

export interface EdgeAssetAmount {
pluginId: string
tokenId?: string
nativeAmount?: string
}

export type EdgeTxActionSwapType =
| 'swap'
| 'swapOrderPost'
| 'swapOrderFill'
| 'swapOrderCancel'

export interface EdgeTxActionSwap {
type: EdgeTxActionSwapType
orderId?: string
canBePartial?: boolean
sourceAsset: EdgeAssetAmount
destAsset: EdgeAssetAmount
}

export type EdgeTxActionStakeType =
| 'stake'
| 'stakeOrder'
| 'unstake'
| 'unstakeOrder'

export interface EdgeTxActionStake {
type: EdgeTxActionStakeType
stakeAssets: EdgeAssetAmount[]
}

export type EdgeTxAction = EdgeTxActionSwap | EdgeTxActionStake

// token info ----------------------------------------------------------

export interface EdgeDenomination {
Expand Down Expand Up @@ -468,6 +501,7 @@ export interface EdgeTransaction {
signedTx: string
memos: EdgeMemo[]
ourReceiveAddresses: string[]
action?: EdgeTxAction

// Spend-specific metadata:
deviceDescription?: string
Expand Down

0 comments on commit 23cbb63

Please sign in to comment.