XRPL-Labs/XUMM-SDK-PHP

Calling getPayload returns TypeError

Aless55 opened this issue · 1 comments

I have following code:

$sdk = new XummSdk(config('app.XUMM_ID'), config('app.XUMM_SECRET'));
$response = $sdk->getPayload($payload);

The payload, as well as the credentials are fine. But I get the following error:

TypeError: Xrpl\XummSdkPhp\Payload\CustomMeta::__construct(): Argument #3 ($blob) must be of type array, null given

The constructor of the Payload/CustomMeta.php file looks like this:

  public function __construct(
        public readonly ?string $identifier,
        public readonly ?string $instruction,
        public readonly array $blob = [],
    ) {
    }

I added ? before array and now everything works fine. I did not try or test this with the other functions.

I would appreciate it if someone could take a look at it.

Edit:
The api response returns: (testet with Postman)

{
....
    "custom_meta": {
        "identifier": null,
        "blob": null,
        "instruction": null
    }
}

Therefore the deserializer will try to construct the CustomMeta with all null values.

Thanks for catching this! Made a quick fix + minor release so you can keep going.