aboutsummaryrefslogtreecommitdiffstats
path: root/packages/utils/src/abi_encoder/evm_data_types/pointer.ts
blob: 50f68f5ea8d9f474f4b07aa6d17f611b80956f03 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
import { DataItem } from 'ethereum-types';

import { DataType } from '../abstract_data_types/data_type';
import { DataTypeFactory } from '../abstract_data_types/interfaces';
import { AbstractPointerDataType } from '../abstract_data_types/types/pointer';

export class PointerDataType extends AbstractPointerDataType {
    constructor(destDataType: DataType, parentDataType: DataType, dataTypeFactory: DataTypeFactory) {
        const destDataItem = destDataType.getDataItem();
        const dataItem: DataItem = { name: `ptr<${destDataItem.name}>`, type: `ptr<${destDataItem.type}>` };
        super(dataItem, dataTypeFactory, destDataType, parentDataType);
    }

    public getSignatureType(): string {
        return this._destination.getSignature(false);
    }

    public getSignature(isDetailed?: boolean): string {
        return this._destination.getSignature(isDetailed);
    }

    public getDefaultValue(): any {
        const defaultValue = this._destination.getDefaultValue();
        return defaultValue;
    }
}