-
Notifications
You must be signed in to change notification settings - Fork 274
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4261 from BitGo/zeta-redelegation
feat(sdk-coin-zeta): add redelegate transaction support for zeta
- Loading branch information
Showing
13 changed files
with
402 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
modules/abstract-cosmos/src/lib/StakingRedelegateBuilder.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { TransactionType } from '@bitgo/sdk-core'; | ||
import { BaseCoin as CoinConfig } from '@bitgo/statics'; | ||
import * as constants from './constants'; | ||
import { RedelegateMessage } from './iface'; | ||
import { CosmosTransactionBuilder } from './transactionBuilder'; | ||
import { CosmosUtils } from './utils'; | ||
|
||
export class StakingRedelegateBuilder extends CosmosTransactionBuilder { | ||
protected _utils: CosmosUtils; | ||
|
||
constructor(_coinConfig: Readonly<CoinConfig>, utils: CosmosUtils) { | ||
super(_coinConfig, utils); | ||
this._utils = utils; | ||
} | ||
|
||
protected get transactionType(): TransactionType { | ||
return TransactionType.StakingRedelegate; | ||
} | ||
|
||
/** @inheritdoc */ | ||
messages(redelegateMessages: RedelegateMessage[]): this { | ||
this._messages = redelegateMessages.map((redelegateMessage) => { | ||
this._utils.validateRedelegateMessage(redelegateMessage); | ||
return { | ||
typeUrl: constants.redelegateTypeUrl, | ||
value: redelegateMessage, | ||
}; | ||
}); | ||
return this; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.