incubed
Version:
Typescript-version of the incubed client
43 lines (42 loc) • 1.75 kB
TypeScript
/**
* calc the storrage array key
*/
export declare function getStorageArrayKey(pos: number, arrayIndex?: number, structSize?: number, structPos?: number): any;
/**
* calcs the storage Map key.
* @param pos position of the map in the contract
* @param key key to search for
* @param structPos if the value is a struct - the position in the struct
*/
export declare function getStorageMapKey(pos: number, key: string, structPos?: number): any;
/**
* creates a string from storage.
* @param data the data of the frst slot.
* @param storageKey the key.
* if the length is bigger than 32, this function will return the keys needed in order to create the value, otherwise the string is returned.
*/
export declare function getStringValue(data: Buffer, storageKey: Buffer): string | {
len: number;
storageKeys: Buffer[];
};
/**
* concats the storage values to a string.
* @param values
* @param len
*/
export declare function getStringValueFromList(values: Buffer[], len: number): string;
/**
* converts any value to BN
*/
export declare const toBN: (val: any) => any;
/**
* get a storage value from the server
* @param rpc url of the client
* @param contract address of the contract
* @param pos position in the contract
* @param type type of the value
* @param keyOrIndex if number this is in the index in the array if hex, this is the key in the map
* @param structSize size if the value in the array of map
* @param structPos position in the struct-value in the array of map
*/
export declare function getStorageValue(rpc: string, contract: string, pos: number, type: 'address' | 'bytes32' | 'bytes16' | 'bytes4' | 'int' | 'string', keyOrIndex?: number | string, structSize?: number, structPos?: number): Promise<any>;