-
Notifications
You must be signed in to change notification settings - Fork 518
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
84 additions
and
2 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
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
56 changes: 56 additions & 0 deletions
56
packages/xrpl/src/models/transactions/sidechainXChainAccountCreate.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,56 @@ | ||
import { ValidationError } from '../../errors' | ||
import { Amount, XChainBridge } from '../common' | ||
|
||
import { BaseTransaction, validateBaseTransaction } from './common' | ||
|
||
/** | ||
* | ||
* @category Transaction Models | ||
*/ | ||
export interface SidechainXChainAccountCreate extends BaseTransaction { | ||
TransactionType: 'SidechainXChainAccountCreate' | ||
|
||
XChainBridge: XChainBridge | ||
|
||
SignatureReward: number | string | ||
|
||
Destination: string | ||
|
||
Amount: Amount | ||
} | ||
|
||
/** | ||
* Verify the form and type of a SidechainXChainAccountCreate at runtime. | ||
* | ||
* @param tx - A SidechainXChainAccountCreate Transaction. | ||
* @throws When the SidechainXChainAccountCreate is malformed. | ||
*/ | ||
export function validateSidechainXChainAccountCreate( | ||
tx: Record<string, unknown>, | ||
): void { | ||
validateBaseTransaction(tx) | ||
|
||
if (tx.XChainBridge == null) { | ||
throw new ValidationError( | ||
'SidechainXChainAccountCreate: missing field XChainBridge', | ||
) | ||
} | ||
|
||
if (tx.SignatureReward == null) { | ||
throw new ValidationError( | ||
'SidechainXChainAccountCreate: missing field SignatureReward', | ||
) | ||
} | ||
|
||
if (tx.Destination == null) { | ||
throw new ValidationError( | ||
'SidechainXChainAccountCreate: missing field Destination', | ||
) | ||
} | ||
|
||
if (tx.Amount == null) { | ||
throw new ValidationError( | ||
'SidechainXChainAccountCreate: missing field Amount', | ||
) | ||
} | ||
} |
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