-
-
Notifications
You must be signed in to change notification settings - Fork 200
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
feat: add more bridge fields to txMeta for Bridge #4918
Changes from all commits
0e62557
b5e3828
845bee0
d6d4ebd
cd92b59
34a2425
2dc6c51
dcfef8e
df0821e
dea5e3e
bd9efa2
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 |
---|---|---|
|
@@ -68,6 +68,11 @@ type TransactionMetaBase = { | |
*/ | ||
blockTimestamp?: string; | ||
|
||
/** | ||
* | ||
*/ | ||
bridgeSteps?: BridgeStep[]; | ||
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. To clarify, do we definitely need to store this here? We don't have a bridge specific controller that will persist this state also and can link to a transaction ID? |
||
|
||
/** | ||
* Network code as per EIP-155 for this transaction. | ||
*/ | ||
|
@@ -121,6 +126,11 @@ type TransactionMetaBase = { | |
*/ | ||
deviceConfirmedOn?: WalletDevice; | ||
|
||
/** | ||
* The Network ID as per EIP-155 of the destination chain of a bridge transaction. | ||
*/ | ||
destinationChainId?: Hex; | ||
|
||
/** | ||
* The address of the token being received of swap transaction. | ||
*/ | ||
|
@@ -1354,3 +1364,37 @@ export type SubmitHistoryEntry = { | |
export type InternalAccount = ReturnType< | ||
AccountsController['getSelectedAccount'] | ||
>; | ||
enum BridgeActionTypes { | ||
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. Minor, line break. |
||
BRIDGE = 'bridge', | ||
SWAP = 'swap', | ||
REFUEL = 'refuel', | ||
} | ||
|
||
type BridgeProtocol = { | ||
name: string; | ||
displayName?: string; | ||
icon?: string; | ||
}; | ||
|
||
/** | ||
* A step in a bridge transaction. | ||
*/ | ||
export type BridgeStep = { | ||
action: BridgeActionTypes; | ||
srcChainId: Hex; | ||
destChainId?: Hex; | ||
srcAsset: BridgeAsset; | ||
destAsset: BridgeAsset; | ||
srcAmount: string; | ||
destAmount: string; | ||
protocol: BridgeProtocol; | ||
}; | ||
|
||
export type BridgeAsset = { | ||
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. JSDoc for types and all properties? |
||
chainId: Hex; | ||
address: string; | ||
symbol: string; | ||
name: string; | ||
decimals: number; | ||
icon?: string; | ||
}; |
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.
In an ideal world, the controller wouldn't be coupled to specific transaction types in the events since we already have the
unapprovedTransactionAdded
.Could we instead just subscribe to that in the client and check the
type
property?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 can, I was just referencing the similar Swap types here initially.