@safe-global/protocol-kit
Version:
SDK that facilitates the interaction with Safe Smart Accounts
36 lines • 1.78 kB
TypeScript
/**
* Generates a hash from the given input string and truncates it to the specified size.
*
* @param {string} input - The input string to be hashed.
* @param {number} size - The number of bytes to take from the end of the hash.
* @returns {string} A hexadecimal string representation of the truncated hash, without the `0x` prefix.
*/
export declare function generateHash(input: string, size: number): string;
export type OnChainIdentifierParamsType = {
project: string;
platform?: string;
tool: string;
toolVersion: string;
};
/**
* Generates an on-chain identifier for tracking transactions on the blockchain.
* This identifier includes hashed metadata such as the project name, platform, tool, and tool version.
*
* @param {Object} params - An object containing the metadata for generating the on-chain identifier.
* @param {string} params.project - The name of the project initiating the transaction.
* @param {string} [params.platform='Web'] - The platform from which the transaction originates (e.g., "Web", "Mobile", "Safe App", "Widget"...).
* @param {string} params.tool - The tool used to generate the transaction (e.g., "protocol-kit").
* @param {string} params.toolVersion - The version of the tool used to generate the transaction.
* @returns {string} A string representing the on-chain identifier, composed of multiple hashed segments.
*
* @example
* const identifier = generateOnChainIdentifier({
* project: 'MyProject',
* platform: 'Mobile',
* tool: 'protocol-kit',
* toolVersion: '4.0.0'
* })
*/
declare function generateOnChainIdentifier({ project, platform, tool, toolVersion }: OnChainIdentifierParamsType): string;
export default generateOnChainIdentifier;
//# sourceMappingURL=generateOnChainIdentifier.d.ts.map