Skip to content

Commit

Permalink
CheckMetadataHash extrinsic ext support
Browse files Browse the repository at this point in the history
  • Loading branch information
gmajor-encrypt committed Aug 5, 2024
1 parent a3c7a12 commit d1bd001
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
3 changes: 3 additions & 0 deletions src/Codec/Types/Extrinsic.php
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,9 @@ function encode ($param): string
if (array_key_exists("tip", $param)) {
$value = $value . $this->createTypeByTypeString("Compact<Balance>")->encode($param["tip"]);
}
if (array_key_exists("CheckMetadataHash", $param)) {
$value = $value . $this->createTypeByTypeString("bool")->encode(false);
}
// encode sign extrinsic
}
foreach ($this->metadata["call_index"] as $call_index => $call) {
Expand Down
12 changes: 6 additions & 6 deletions src/Codec/Types/metadataV14.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ class metadataV14 extends Struct
*
* @param Generator $generator
*/
public function __construct (Generator $generator)
public function __construct(Generator $generator)
{
parent::__construct($generator);
$this->typeStruct = [
Expand All @@ -48,7 +48,7 @@ public function __construct (Generator $generator)
];
}

public function decode (): array
public function decode(): array
{
$metadataRaw = parent::decode();

Expand Down Expand Up @@ -88,7 +88,7 @@ public function decode (): array
foreach ($variant["fields"] as $v) {
$args[] = ["name" => $v["name"], "type" => $this->registeredSiType[$v["type"]]];
}
$calls[] = ["name" => $variant["name"], "args" => $args, "docs" => $variant["docs"]];
$calls[] = ["name" => $variant["name"], "args" => $args, "docs" => $variant["docs"], "lookup_index" => $variant["index"]];
}
}

Expand All @@ -106,8 +106,8 @@ public function decode (): array
}

// call lookup
foreach ($calls as $callIndex => $call) {
$lookup = Utils::padLeft(dechex($pallet["index"]), 2) . Utils::padLeft(dechex($callIndex), 2);
foreach ($calls as $call) {
$lookup = Utils::padLeft(dechex($pallet["index"]), 2) . Utils::padLeft(dechex($call["lookup_index"]), 2);
$metadataRaw["call_index"][$lookup] = ["module" => ["name" => $pallet["name"]], "call" => $call];
}
// event lookup
Expand Down Expand Up @@ -139,7 +139,7 @@ public function decode (): array
* @param $param
* @return \InvalidArgumentException|string
*/
public function encode ($param): \InvalidArgumentException|string
public function encode($param): \InvalidArgumentException|string
{
return parent::encode($param);
}
Expand Down

0 comments on commit d1bd001

Please sign in to comment.