mirror of
https://github.com/Xahau/xahau.js.git
synced 2025-11-19 11:45:49 +00:00
* create credentials obj, modify depositpreauth * structrure of transaction models * initial validation methods and modify transactions affected by deposit auth * cleanup and add new transactions to list * binarycodec and add amendments to config * methods account for credentials * binary codec update * add amendments to config * error validation for credentials actions * core logic of error validation completed * type checking in error validation * init test files and field type validations * basic tests for crud transactions * cred delete tests * cred accept unit tests * cred create and accept unit tests * cred delete unit tests * depositPreauth unit tests * generic checks for payment, paymentchannelclaim, escrowfinish credential list * ledger entry update * lint errors * cleanup and use helper methods * fix lint bug * init integration tests for new transactions * fix build error, integration test docker update * unit test fixes -- all pass now * integration test layout complete * integration command * integration tests run * cicd command edit * lint and cleanup * modified history markdown * deposit preauth integration update * update docs with new docker command * fix validation for string id credential arrays * exports * add flag * lint * fix typo in contributing doc * docstring typos * readable string * fix test' * review comment fixes * txn duplicate fix * Apply suggestions from code review Co-authored-by: Omar Khan <khancodegt@gmail.com> Co-authored-by: Mayukha Vadari <mvadari@ripple.com> * Apply suggestions from code review Co-authored-by: Omar Khan <khancodegt@gmail.com> * Apply suggestions from code review Co-authored-by: Omar Khan <khancodegt@gmail.com> Co-authored-by: Mayukha Vadari <mvadari@ripple.com> * typo in auto suggest * rebase * readd definitions after rebase * cleanup list val * unit tests fixed and running * lint * refactor authcred check to work * Update packages/xrpl/src/models/transactions/payment.ts Co-authored-by: Omar Khan <khancodegt@gmail.com> * typo * Update .ci-config/rippled.cfg Co-authored-by: Omar Khan <khancodegt@gmail.com> * update rippled version * optional field nits * add to response depositauthorize * Update packages/xrpl/src/models/transactions/CredentialCreate.ts Co-authored-by: Omar Khan <khancodegt@gmail.com> * Update packages/xrpl/src/models/transactions/CredentialDelete.ts Co-authored-by: Omar Khan <khancodegt@gmail.com> * Update packages/xrpl/src/models/transactions/accountDelete.ts Co-authored-by: Omar Khan <khancodegt@gmail.com> * Apply suggestions from code review Co-authored-by: Omar Khan <khancodegt@gmail.com> * cleanups * unit test fix * more escrowfinish tests * clearer error message * re add statement * undo autodeleted mandates * remove extraneous integration tests for now * lint * Update .ci-config/rippled.cfg Co-authored-by: Omar Khan <khancodegt@gmail.com> * Update packages/xrpl/src/models/transactions/common.ts Co-authored-by: Omar Khan <khancodegt@gmail.com> * added tests * typo --------- Co-authored-by: Omar Khan <khancodegt@gmail.com> Co-authored-by: Mayukha Vadari <mvadari@ripple.com>
45 lines
1.2 KiB
TypeScript
45 lines
1.2 KiB
TypeScript
import {
|
|
BaseTransaction,
|
|
isString,
|
|
validateBaseTransaction,
|
|
validateCredentialType,
|
|
validateRequiredField,
|
|
} from './common'
|
|
|
|
/**
|
|
* Accepts a credential issued to the Account (i.e. the Account is the Subject of the Credential object).
|
|
* Credentials are represented in hex. Whilst they are allowed a maximum length of 64
|
|
* bytes, every byte requires 2 hex characters for representation.
|
|
* The credential is not considered valid until it has been transferred/accepted.
|
|
*
|
|
* @category Transaction Models
|
|
* */
|
|
export interface CredentialAccept extends BaseTransaction {
|
|
TransactionType: 'CredentialAccept'
|
|
|
|
/** The subject of the credential. */
|
|
Account: string
|
|
|
|
/** The issuer of the credential. */
|
|
Issuer: string
|
|
|
|
/** A hex-encoded value to identify the type of credential from the issuer. */
|
|
CredentialType: string
|
|
}
|
|
|
|
/**
|
|
* Verify the form and type of a CredentialAccept at runtime.
|
|
*
|
|
* @param tx - A CredentialAccept Transaction.
|
|
* @throws When the CredentialAccept is Malformed.
|
|
*/
|
|
export function validateCredentialAccept(tx: Record<string, unknown>): void {
|
|
validateBaseTransaction(tx)
|
|
|
|
validateRequiredField(tx, 'Account', isString)
|
|
|
|
validateRequiredField(tx, 'Issuer', isString)
|
|
|
|
validateCredentialType(tx)
|
|
}
|