@dedot/contracts 0.9.0 → 0.9.1
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.
- package/cjs/utils.js +13 -0
- package/package.json +6 -6
- package/types/shared.d.ts +9 -0
- package/utils.js +13 -0
package/cjs/utils.js
CHANGED
|
@@ -61,6 +61,19 @@ const normalizeContractTypeDef = (def) => {
|
|
|
61
61
|
typeParam: def.array.type,
|
|
62
62
|
};
|
|
63
63
|
}
|
|
64
|
+
else if (def.compact) {
|
|
65
|
+
type = 'Compact';
|
|
66
|
+
value = {
|
|
67
|
+
typeParam: def.compact.type,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
else if (def.bitsequence) {
|
|
71
|
+
type = 'BitSequence';
|
|
72
|
+
value = {
|
|
73
|
+
bitOrderType: def.bitsequence.bit_order_type,
|
|
74
|
+
bitStoreType: def.bitsequence.bit_store_type,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
64
77
|
else {
|
|
65
78
|
throw Error(`Invalid contract type def: ${JSON.stringify(def)}`);
|
|
66
79
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dedot/contracts",
|
|
3
|
-
"version": "0.9.
|
|
3
|
+
"version": "0.9.1",
|
|
4
4
|
"description": "Delightful ink! Contract APIs",
|
|
5
5
|
"author": "Tung Vu <tung@coongcrafts.io>",
|
|
6
6
|
"homepage": "https://github.com/dedotdev/dedot/tree/main/packages/contracts",
|
|
@@ -18,10 +18,10 @@
|
|
|
18
18
|
"test": "npx vitest --watch=false"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@dedot/api": "0.9.
|
|
22
|
-
"@dedot/codecs": "0.9.
|
|
23
|
-
"@dedot/types": "0.9.
|
|
24
|
-
"@dedot/utils": "0.9.
|
|
21
|
+
"@dedot/api": "0.9.1",
|
|
22
|
+
"@dedot/codecs": "0.9.1",
|
|
23
|
+
"@dedot/types": "0.9.1",
|
|
24
|
+
"@dedot/utils": "0.9.1"
|
|
25
25
|
},
|
|
26
26
|
"publishConfig": {
|
|
27
27
|
"access": "public",
|
|
@@ -31,7 +31,7 @@
|
|
|
31
31
|
"node": ">=18"
|
|
32
32
|
},
|
|
33
33
|
"license": "Apache-2.0",
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "9329cadcd2062d0f10dc1d8f700d8ade25214199",
|
|
35
35
|
"module": "./index.js",
|
|
36
36
|
"types": "./index.d.ts",
|
|
37
37
|
"exports": {
|
package/types/shared.d.ts
CHANGED
|
@@ -57,6 +57,15 @@ export interface ContractTypeDef {
|
|
|
57
57
|
sequence?: SequenceType;
|
|
58
58
|
variant?: VariantType;
|
|
59
59
|
tuple?: number[];
|
|
60
|
+
compact?: CompactType;
|
|
61
|
+
bitsequence?: BitSequenceType;
|
|
62
|
+
}
|
|
63
|
+
export interface BitSequenceType {
|
|
64
|
+
bit_order_type: number;
|
|
65
|
+
bit_store_type: number;
|
|
66
|
+
}
|
|
67
|
+
export interface CompactType {
|
|
68
|
+
type: number;
|
|
60
69
|
}
|
|
61
70
|
export interface CompositeType {
|
|
62
71
|
fields?: {
|
package/utils.js
CHANGED
|
@@ -57,6 +57,19 @@ export const normalizeContractTypeDef = (def) => {
|
|
|
57
57
|
typeParam: def.array.type,
|
|
58
58
|
};
|
|
59
59
|
}
|
|
60
|
+
else if (def.compact) {
|
|
61
|
+
type = 'Compact';
|
|
62
|
+
value = {
|
|
63
|
+
typeParam: def.compact.type,
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
else if (def.bitsequence) {
|
|
67
|
+
type = 'BitSequence';
|
|
68
|
+
value = {
|
|
69
|
+
bitOrderType: def.bitsequence.bit_order_type,
|
|
70
|
+
bitStoreType: def.bitsequence.bit_store_type,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
60
73
|
else {
|
|
61
74
|
throw Error(`Invalid contract type def: ${JSON.stringify(def)}`);
|
|
62
75
|
}
|