@acala-network/chopsticks-core 0.9.5-4 → 0.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -38,22 +38,34 @@ function objectToStorageItems(meta, storage) {
38
38
  const key = new _types.StorageKey(meta.registry, [
39
39
  storageEntry
40
40
  ]);
41
- const type = storageEntry.meta.modifier.isOptional ? `Option<${key.outputType}>` : key.outputType;
42
- storageItems.push([
43
- key.toHex(),
44
- storage ? meta.registry.createType(type, storage).toHex() : null
45
- ]);
41
+ if (storageEntry.meta.modifier.isOptional && storage === '0x') {
42
+ storageItems.push([
43
+ key.toHex(),
44
+ '0x'
45
+ ]);
46
+ } else {
47
+ storageItems.push([
48
+ key.toHex(),
49
+ storage ? (0, _util.u8aToHex)(meta.registry.createType(key.outputType, storage).toU8a()) : null
50
+ ]);
51
+ }
46
52
  } else {
47
53
  for (const [keys, value] of storage){
48
54
  const key = new _types.StorageKey(meta.registry, [
49
55
  storageEntry,
50
56
  keys
51
57
  ]);
52
- const type = storageEntry.meta.modifier.isOptional ? `Option<${key.outputType}>` : key.outputType;
53
- storageItems.push([
54
- key.toHex(),
55
- value ? meta.registry.createType(type, value).toHex() : null
56
- ]);
58
+ if (storageEntry.meta.modifier.isOptional && value === '0x') {
59
+ storageItems.push([
60
+ key.toHex(),
61
+ '0x'
62
+ ]);
63
+ } else {
64
+ storageItems.push([
65
+ key.toHex(),
66
+ value ? (0, _util.u8aToHex)(meta.registry.createType(key.outputType, value).toU8a()) : null
67
+ ]);
68
+ }
57
69
  }
58
70
  }
59
71
  }
@@ -28,22 +28,34 @@ function objectToStorageItems(meta, storage) {
28
28
  const key = new StorageKey(meta.registry, [
29
29
  storageEntry
30
30
  ]);
31
- const type = storageEntry.meta.modifier.isOptional ? `Option<${key.outputType}>` : key.outputType;
32
- storageItems.push([
33
- key.toHex(),
34
- storage ? meta.registry.createType(type, storage).toHex() : null
35
- ]);
31
+ if (storageEntry.meta.modifier.isOptional && storage === '0x') {
32
+ storageItems.push([
33
+ key.toHex(),
34
+ '0x'
35
+ ]);
36
+ } else {
37
+ storageItems.push([
38
+ key.toHex(),
39
+ storage ? u8aToHex(meta.registry.createType(key.outputType, storage).toU8a()) : null
40
+ ]);
41
+ }
36
42
  } else {
37
43
  for (const [keys, value] of storage){
38
44
  const key = new StorageKey(meta.registry, [
39
45
  storageEntry,
40
46
  keys
41
47
  ]);
42
- const type = storageEntry.meta.modifier.isOptional ? `Option<${key.outputType}>` : key.outputType;
43
- storageItems.push([
44
- key.toHex(),
45
- value ? meta.registry.createType(type, value).toHex() : null
46
- ]);
48
+ if (storageEntry.meta.modifier.isOptional && value === '0x') {
49
+ storageItems.push([
50
+ key.toHex(),
51
+ '0x'
52
+ ]);
53
+ } else {
54
+ storageItems.push([
55
+ key.toHex(),
56
+ value ? u8aToHex(meta.registry.createType(key.outputType, value).toU8a()) : null
57
+ ]);
58
+ }
47
59
  }
48
60
  }
49
61
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@acala-network/chopsticks-core",
3
- "version": "0.9.5-4",
3
+ "version": "0.9.5",
4
4
  "author": "Acala Developers <hello@acala.network>",
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -12,7 +12,7 @@
12
12
  "docs:prep": "typedoc"
13
13
  },
14
14
  "dependencies": {
15
- "@acala-network/chopsticks-executor": "0.9.5-4",
15
+ "@acala-network/chopsticks-executor": "0.9.5",
16
16
  "@polkadot/rpc-provider": "^10.10.1",
17
17
  "@polkadot/types": "^10.10.1",
18
18
  "@polkadot/types-codec": "^10.10.1",