@subsocial/utils
Version:
JavaScript utils for Subsocial blockchain.
60 lines (59 loc) • 3.31 kB
TypeScript
export declare type DomainRegisterPayContent = {
domainName: string;
target: string;
token: string;
opId: string;
};
export declare type DomainRegisterCompletedContent = {
domainName: string;
target: string;
token: string;
opId: string;
};
export declare type DomainRegisterRefundContent = {
domainName: string;
target: string;
token: string;
opId: string;
};
export declare type EnergyGeneratePayContent = {
energyAmount: string;
target: string;
token: string;
opId: string;
};
export declare type EnergyGenerateCompletedContent = {
energyAmount: string;
target: string;
token: string;
opId: string;
};
export declare type EnergyGenerateRefundContent = {
energyAmount: string;
target: string;
token: string;
opId: string;
};
export declare type RemarkContentProps = keyof DomainRegisterPayContent | keyof DomainRegisterCompletedContent | keyof DomainRegisterRefundContent | keyof EnergyGeneratePayContent | keyof EnergyGenerateCompletedContent | keyof EnergyGenerateRefundContent;
export declare type SocialRemarkMessageVersion = '0.1';
export declare type SocialRemarkMessageDestination = '1' | '2' | '3';
export declare type SocialRemarkMessageAction = 'DMN_REG' | 'DMN_REG_OK' | 'DMN_REG_REFUND' | 'DMN_REG_REFUND_OK' | 'NRG_GEN' | 'NRG_GEN_OK' | 'NRG_GEN_REFUND' | 'NRG_GEN_REFUND_OK';
export declare type SocialRemarkMessageProtocolName = string;
export declare enum SocialRemarkDestChainsNameId {
subsocial = "1",
xsocial = "2",
soonsocial = "3"
}
export declare type SocialRemarkMessageContent<A extends SocialRemarkMessageAction | string> = A extends 'DMN_REG' ? DomainRegisterPayContent : A extends 'DMN_REG_OK' ? DomainRegisterCompletedContent : A extends 'DMN_REG_REFUND' | 'DMN_REG_REFUND_OK' ? DomainRegisterRefundContent : A extends 'NRG_GEN' ? EnergyGeneratePayContent : A extends 'NRG_GEN_OK' ? EnergyGenerateCompletedContent : A extends 'NRG_GEN_REFUND' | 'NRG_GEN_REFUND_OK' ? EnergyGenerateRefundContent : never;
export declare type SocialRemarkMessage<A extends SocialRemarkMessageAction | string = '', V extends true | false = false> = {
protName: SocialRemarkMessageProtocolName;
version: SocialRemarkMessageVersion;
destination: SocialRemarkMessageDestination;
action: A;
valid: V;
content: V extends true ? SocialRemarkMessageContent<A> : null;
};
export declare type SubSclSource<A extends SocialRemarkMessageAction | string = ''> = Omit<SocialRemarkMessage<A, true>, 'valid'>;
declare type VersionActionPropsMap = Record<SocialRemarkMessageVersion, Record<'DMN_REG', Record<keyof DomainRegisterPayContent, number>> | Record<'DMN_REG_OK', Record<keyof DomainRegisterCompletedContent, number>> | Record<'DMN_REG_REFUND', Record<keyof DomainRegisterRefundContent, number>> | Record<'DMN_REG_REFUND_OK', Record<keyof DomainRegisterRefundContent, number>> | Record<'NRG_GEN', Record<keyof EnergyGeneratePayContent, number>> | Record<'NRG_GEN_OK', Record<keyof EnergyGenerateCompletedContent, number>> | Record<'NRG_GEN_REFUND', Record<keyof EnergyGenerateRefundContent, number>> | Record<'NRG_GEN_REFUND_OK', Record<keyof EnergyGenerateRefundContent, number>>>;
export declare const REMARK_CONTENT_VERSION_ACTION_MAP: VersionActionPropsMap;
export {};