@guardian-network/shared 0.3.2
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/README.md +2 -0
- package/dist/arbitrary-data-artifact/MinArbitraryDataArtifactFactory.d.ts +63 -0
- package/dist/arbitrary-data-artifact/MinArbitraryDataArtifactFactory.d.ts.map +1 -0
- package/dist/arbitrary-data-artifact/MinArbitraryDataArtifactFactory.js +87 -0
- package/dist/arbitrary-data-artifact/MinArbitraryDataArtifactFactory.js.map +1 -0
- package/dist/arbitrary-data-artifact/index.d.ts +3 -0
- package/dist/arbitrary-data-artifact/index.d.ts.map +1 -0
- package/dist/arbitrary-data-artifact/index.js +6 -0
- package/dist/arbitrary-data-artifact/index.js.map +1 -0
- package/dist/arbitrary-data-artifact/method-mutability.types.d.ts +9 -0
- package/dist/arbitrary-data-artifact/method-mutability.types.d.ts.map +1 -0
- package/dist/arbitrary-data-artifact/method-mutability.types.js +3 -0
- package/dist/arbitrary-data-artifact/method-mutability.types.js.map +1 -0
- package/dist/arbitrary-data-artifact/min-arbitrary-data-artifact.interface.d.ts +27 -0
- package/dist/arbitrary-data-artifact/min-arbitrary-data-artifact.interface.d.ts.map +1 -0
- package/dist/arbitrary-data-artifact/min-arbitrary-data-artifact.interface.js +3 -0
- package/dist/arbitrary-data-artifact/min-arbitrary-data-artifact.interface.js.map +1 -0
- package/dist/arbitrary-data-artifact/typed-contract-method.interface.d.ts +21 -0
- package/dist/arbitrary-data-artifact/typed-contract-method.interface.d.ts.map +1 -0
- package/dist/arbitrary-data-artifact/typed-contract-method.interface.js +3 -0
- package/dist/arbitrary-data-artifact/typed-contract-method.interface.js.map +1 -0
- package/dist/errors/BaseError.d.ts +5 -0
- package/dist/errors/BaseError.d.ts.map +1 -0
- package/dist/errors/BaseError.js +13 -0
- package/dist/errors/BaseError.js.map +1 -0
- package/dist/errors/index.d.ts +2 -0
- package/dist/errors/index.d.ts.map +1 -0
- package/dist/errors/index.js +18 -0
- package/dist/errors/index.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +23 -0
- package/dist/index.js.map +1 -0
- package/dist/misc-utils/data-structure-transformation.helper.d.ts +2 -0
- package/dist/misc-utils/data-structure-transformation.helper.d.ts.map +1 -0
- package/dist/misc-utils/data-structure-transformation.helper.js +8 -0
- package/dist/misc-utils/data-structure-transformation.helper.js.map +1 -0
- package/dist/misc-utils/find-cycle-node.helper.d.ts +3 -0
- package/dist/misc-utils/find-cycle-node.helper.d.ts.map +1 -0
- package/dist/misc-utils/find-cycle-node.helper.js +40 -0
- package/dist/misc-utils/find-cycle-node.helper.js.map +1 -0
- package/dist/misc-utils/index.d.ts +4 -0
- package/dist/misc-utils/index.d.ts.map +1 -0
- package/dist/misc-utils/index.js +20 -0
- package/dist/misc-utils/index.js.map +1 -0
- package/dist/misc-utils/node-id-tooling.d.ts +5 -0
- package/dist/misc-utils/node-id-tooling.d.ts.map +1 -0
- package/dist/misc-utils/node-id-tooling.js +14 -0
- package/dist/misc-utils/node-id-tooling.js.map +1 -0
- package/dist/solidity-encode-decode/decode.helper.d.ts +8 -0
- package/dist/solidity-encode-decode/decode.helper.d.ts.map +1 -0
- package/dist/solidity-encode-decode/decode.helper.js +33 -0
- package/dist/solidity-encode-decode/decode.helper.js.map +1 -0
- package/dist/solidity-encode-decode/encode.helper.d.ts +17 -0
- package/dist/solidity-encode-decode/encode.helper.d.ts.map +1 -0
- package/dist/solidity-encode-decode/encode.helper.js +73 -0
- package/dist/solidity-encode-decode/encode.helper.js.map +1 -0
- package/dist/solidity-encode-decode/index.d.ts +5 -0
- package/dist/solidity-encode-decode/index.d.ts.map +1 -0
- package/dist/solidity-encode-decode/index.js +14 -0
- package/dist/solidity-encode-decode/index.js.map +1 -0
- package/dist/solidity-types/base/SolidityType.d.ts +11 -0
- package/dist/solidity-types/base/SolidityType.d.ts.map +1 -0
- package/dist/solidity-types/base/SolidityType.js +23 -0
- package/dist/solidity-types/base/SolidityType.js.map +1 -0
- package/dist/solidity-types/base/index.d.ts +2 -0
- package/dist/solidity-types/base/index.d.ts.map +1 -0
- package/dist/solidity-types/base/index.js +18 -0
- package/dist/solidity-types/base/index.js.map +1 -0
- package/dist/solidity-types/constants.d.ts +10 -0
- package/dist/solidity-types/constants.d.ts.map +1 -0
- package/dist/solidity-types/constants.js +21 -0
- package/dist/solidity-types/constants.js.map +1 -0
- package/dist/solidity-types/index.d.ts +5 -0
- package/dist/solidity-types/index.d.ts.map +1 -0
- package/dist/solidity-types/index.js +21 -0
- package/dist/solidity-types/index.js.map +1 -0
- package/dist/solidity-types/native-types/SolidityAddressType.d.ts +6 -0
- package/dist/solidity-types/native-types/SolidityAddressType.d.ts.map +1 -0
- package/dist/solidity-types/native-types/SolidityAddressType.js +15 -0
- package/dist/solidity-types/native-types/SolidityAddressType.js.map +1 -0
- package/dist/solidity-types/native-types/SolidityBytesType.d.ts +6 -0
- package/dist/solidity-types/native-types/SolidityBytesType.d.ts.map +1 -0
- package/dist/solidity-types/native-types/SolidityBytesType.js +15 -0
- package/dist/solidity-types/native-types/SolidityBytesType.js.map +1 -0
- package/dist/solidity-types/native-types/index.d.ts +3 -0
- package/dist/solidity-types/native-types/index.d.ts.map +1 -0
- package/dist/solidity-types/native-types/index.js +19 -0
- package/dist/solidity-types/native-types/index.js.map +1 -0
- package/dist/solidity-types/solidity-types-packing.helper.d.ts +2 -0
- package/dist/solidity-types/solidity-types-packing.helper.d.ts.map +1 -0
- package/dist/solidity-types/solidity-types-packing.helper.js +13 -0
- package/dist/solidity-types/solidity-types-packing.helper.js.map +1 -0
- package/dist/solidity-types/solidity-types-verification.helper.d.ts +6 -0
- package/dist/solidity-types/solidity-types-verification.helper.d.ts.map +1 -0
- package/dist/solidity-types/solidity-types-verification.helper.js +42 -0
- package/dist/solidity-types/solidity-types-verification.helper.js.map +1 -0
- package/dist/solidity-types/synthetic-types/SolidityAddressListPacked.d.ts +5 -0
- package/dist/solidity-types/synthetic-types/SolidityAddressListPacked.d.ts.map +1 -0
- package/dist/solidity-types/synthetic-types/SolidityAddressListPacked.js +15 -0
- package/dist/solidity-types/synthetic-types/SolidityAddressListPacked.js.map +1 -0
- package/dist/solidity-types/synthetic-types/SolidityBytes32Packed.d.ts +5 -0
- package/dist/solidity-types/synthetic-types/SolidityBytes32Packed.d.ts.map +1 -0
- package/dist/solidity-types/synthetic-types/SolidityBytes32Packed.js +15 -0
- package/dist/solidity-types/synthetic-types/SolidityBytes32Packed.js.map +1 -0
- package/dist/solidity-types/synthetic-types/SolidityBytesListPacked.d.ts +5 -0
- package/dist/solidity-types/synthetic-types/SolidityBytesListPacked.d.ts.map +1 -0
- package/dist/solidity-types/synthetic-types/SolidityBytesListPacked.js +15 -0
- package/dist/solidity-types/synthetic-types/SolidityBytesListPacked.js.map +1 -0
- package/dist/solidity-types/synthetic-types/SolidityUint24ListTypePacked.d.ts +7 -0
- package/dist/solidity-types/synthetic-types/SolidityUint24ListTypePacked.d.ts.map +1 -0
- package/dist/solidity-types/synthetic-types/SolidityUint24ListTypePacked.js +27 -0
- package/dist/solidity-types/synthetic-types/SolidityUint24ListTypePacked.js.map +1 -0
- package/dist/solidity-types/synthetic-types/index.d.ts +5 -0
- package/dist/solidity-types/synthetic-types/index.d.ts.map +1 -0
- package/dist/solidity-types/synthetic-types/index.js +21 -0
- package/dist/solidity-types/synthetic-types/index.js.map +1 -0
- package/dist/types/compiler.types.d.ts +11 -0
- package/dist/types/compiler.types.d.ts.map +1 -0
- package/dist/types/compiler.types.js +3 -0
- package/dist/types/compiler.types.js.map +1 -0
- package/dist/types/contracts.types.d.ts +52 -0
- package/dist/types/contracts.types.d.ts.map +1 -0
- package/dist/types/contracts.types.js +3 -0
- package/dist/types/contracts.types.js.map +1 -0
- package/dist/types/dsl.types.d.ts +32 -0
- package/dist/types/dsl.types.d.ts.map +1 -0
- package/dist/types/dsl.types.js +3 -0
- package/dist/types/dsl.types.js.map +1 -0
- package/dist/types/index.d.ts +7 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +23 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/intermediate-representation.types.d.ts +18 -0
- package/dist/types/intermediate-representation.types.d.ts.map +1 -0
- package/dist/types/intermediate-representation.types.js +19 -0
- package/dist/types/intermediate-representation.types.js.map +1 -0
- package/dist/types/solidity-decode.types.d.ts +2 -0
- package/dist/types/solidity-decode.types.d.ts.map +1 -0
- package/dist/types/solidity-decode.types.js +3 -0
- package/dist/types/solidity-decode.types.js.map +1 -0
- package/dist/types/solidity-encode.types.d.ts +5 -0
- package/dist/types/solidity-encode.types.d.ts.map +1 -0
- package/dist/types/solidity-encode.types.js +3 -0
- package/dist/types/solidity-encode.types.js.map +1 -0
- package/package.json +67 -0
- package/src/arbitrary-data-artifact/MinArbitraryDataArtifactFactory.ts +97 -0
- package/src/arbitrary-data-artifact/index.ts +2 -0
- package/src/arbitrary-data-artifact/method-mutability.types.ts +24 -0
- package/src/arbitrary-data-artifact/min-arbitrary-data-artifact.interface.ts +32 -0
- package/src/arbitrary-data-artifact/typed-contract-method.interface.ts +57 -0
- package/src/errors/BaseError.ts +12 -0
- package/src/errors/index.ts +1 -0
- package/src/index.ts +6 -0
- package/src/misc-utils/data-structure-transformation.helper.ts +3 -0
- package/src/misc-utils/find-cycle-node.helper.ts +53 -0
- package/src/misc-utils/index.ts +3 -0
- package/src/misc-utils/node-id-tooling.ts +15 -0
- package/src/solidity-encode-decode/decode.helper.ts +57 -0
- package/src/solidity-encode-decode/encode.helper.ts +133 -0
- package/src/solidity-encode-decode/index.ts +10 -0
- package/src/solidity-types/base/SolidityType.ts +26 -0
- package/src/solidity-types/base/index.ts +1 -0
- package/src/solidity-types/constants.ts +23 -0
- package/src/solidity-types/index.ts +4 -0
- package/src/solidity-types/native-types/SolidityAddressType.ts +13 -0
- package/src/solidity-types/native-types/SolidityBytesType.ts +15 -0
- package/src/solidity-types/native-types/index.ts +2 -0
- package/src/solidity-types/solidity-types-packing.helper.ts +13 -0
- package/src/solidity-types/solidity-types-verification.helper.ts +52 -0
- package/src/solidity-types/synthetic-types/SolidityAddressListPacked.ts +13 -0
- package/src/solidity-types/synthetic-types/SolidityBytes32Packed.ts +13 -0
- package/src/solidity-types/synthetic-types/SolidityBytesListPacked.ts +13 -0
- package/src/solidity-types/synthetic-types/SolidityUint24ListTypePacked.ts +31 -0
- package/src/solidity-types/synthetic-types/index.ts +4 -0
- package/src/types/compiler.types.ts +12 -0
- package/src/types/contracts.types.ts +58 -0
- package/src/types/dsl.types.ts +39 -0
- package/src/types/index.ts +6 -0
- package/src/types/intermediate-representation.types.ts +18 -0
- package/src/types/solidity-decode.types.ts +5 -0
- package/src/types/solidity-encode.types.ts +14 -0
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./SolidityAddressListPacked"), exports);
|
|
18
|
+
__exportStar(require("./SolidityBytes32Packed"), exports);
|
|
19
|
+
__exportStar(require("./SolidityBytesListPacked"), exports);
|
|
20
|
+
__exportStar(require("./SolidityUint24ListTypePacked"), exports);
|
|
21
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/solidity-types/synthetic-types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,8DAA4C;AAC5C,0DAAwC;AACxC,4DAA0C;AAC1C,iEAA+C"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ContractRunner } from 'ethers';
|
|
2
|
+
import { OnchainPresentation } from './contracts.types';
|
|
3
|
+
export type ICompiler = {
|
|
4
|
+
compile(): Promise<OnchainPresentation>;
|
|
5
|
+
};
|
|
6
|
+
export interface LacLangCompilerOptions {
|
|
7
|
+
checkTypesAgainstOnchainDescriptors?: boolean;
|
|
8
|
+
checkTypesAgainstDslDeclarations?: boolean;
|
|
9
|
+
provider?: ContractRunner;
|
|
10
|
+
}
|
|
11
|
+
//# sourceMappingURL=compiler.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.types.d.ts","sourceRoot":"","sources":["../../src/types/compiler.types.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,mBAAmB,EAAE,MAAM,mBAAmB,CAAC;AAExD,MAAM,MAAM,SAAS,GAAG;IACtB,OAAO,IAAI,OAAO,CAAC,mBAAmB,CAAC,CAAC;CACzC,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,mCAAmC,CAAC,EAAE,OAAO,CAAC;IAC9C,gCAAgC,CAAC,EAAE,OAAO,CAAC;IAC3C,QAAQ,CAAC,EAAE,cAAc,CAAC;CAC3B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compiler.types.js","sourceRoot":"","sources":["../../src/types/compiler.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { AddressLike, BigNumberish, BytesLike } from 'ethers';
|
|
2
|
+
type InjectionMetadataStruct = {
|
|
3
|
+
value: string;
|
|
4
|
+
index: BigNumberish;
|
|
5
|
+
};
|
|
6
|
+
type SubstitutionArgumentStruct = {
|
|
7
|
+
supplierNodeId: BytesLike;
|
|
8
|
+
index: BigNumberish;
|
|
9
|
+
};
|
|
10
|
+
type ConstantArgumentStruct = {
|
|
11
|
+
value: BytesLike;
|
|
12
|
+
index: BigNumberish;
|
|
13
|
+
};
|
|
14
|
+
export type VariablesStruct = {
|
|
15
|
+
nodeId: BytesLike;
|
|
16
|
+
values: BytesLike[];
|
|
17
|
+
};
|
|
18
|
+
export type NodeInitDataStruct = {
|
|
19
|
+
id: BytesLike;
|
|
20
|
+
initData: BytesLike;
|
|
21
|
+
needsInitialization: boolean;
|
|
22
|
+
artifactAddress: AddressLike;
|
|
23
|
+
argsCount: BigNumberish;
|
|
24
|
+
constantExecArgs: ConstantArgumentStruct[];
|
|
25
|
+
substitutedExecArgs: SubstitutionArgumentStruct[];
|
|
26
|
+
variableExecArgs: BigNumberish[];
|
|
27
|
+
injections: InjectionMetadataStruct[];
|
|
28
|
+
};
|
|
29
|
+
type GraphInitParamsStruct = {
|
|
30
|
+
rootNode: BytesLike;
|
|
31
|
+
nodes: NodeInitDataStruct[];
|
|
32
|
+
};
|
|
33
|
+
export type OnchainPresentation = GraphInitParamsStruct;
|
|
34
|
+
export type NodeTreeInitData = NodeInitDataStruct;
|
|
35
|
+
type ExecVarsMetadataStructOutputBase = {
|
|
36
|
+
nodeId: string;
|
|
37
|
+
nodeIndex: bigint;
|
|
38
|
+
artifactAddress: string;
|
|
39
|
+
descriptions: ArgumentDescriptionStructOutput[];
|
|
40
|
+
injections: StringAndIndexStructOutput[];
|
|
41
|
+
};
|
|
42
|
+
export type OnchainVariablesDescription = ExecVarsMetadataStructOutputBase;
|
|
43
|
+
type ArgumentDescriptionStructOutput = {
|
|
44
|
+
name: string;
|
|
45
|
+
typename: string;
|
|
46
|
+
};
|
|
47
|
+
export type StringAndIndexStructOutput = {
|
|
48
|
+
value: string;
|
|
49
|
+
index: bigint;
|
|
50
|
+
};
|
|
51
|
+
export {};
|
|
52
|
+
//# sourceMappingURL=contracts.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.types.d.ts","sourceRoot":"","sources":["../../src/types/contracts.types.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,WAAW,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAE9D,KAAK,uBAAuB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,YAAY,CAAA;CAAE,CAAC;AAEtE,KAAK,0BAA0B,GAAG;IAChC,cAAc,EAAE,SAAS,CAAC;IAC1B,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF,KAAK,sBAAsB,GAAG;IAC5B,KAAK,EAAE,SAAS,CAAC;IACjB,KAAK,EAAE,YAAY,CAAC;CACrB,CAAC;AAEF,MAAM,MAAM,eAAe,GAAG;IAAE,MAAM,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,SAAS,EAAE,CAAA;CAAE,CAAC;AAEzE,MAAM,MAAM,kBAAkB,GAAG;IAC/B,EAAE,EAAE,SAAS,CAAC;IACd,QAAQ,EAAE,SAAS,CAAC;IACpB,mBAAmB,EAAE,OAAO,CAAC;IAC7B,eAAe,EAAE,WAAW,CAAC;IAC7B,SAAS,EAAE,YAAY,CAAC;IACxB,gBAAgB,EAAE,sBAAsB,EAAE,CAAC;IAC3C,mBAAmB,EAAE,0BAA0B,EAAE,CAAC;IAClD,gBAAgB,EAAE,YAAY,EAAE,CAAC;IACjC,UAAU,EAAE,uBAAuB,EAAE,CAAC;CACvC,CAAC;AAEF,KAAK,qBAAqB,GAAG;IAC3B,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,kBAAkB,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,CAAC;AAExD,MAAM,MAAM,gBAAgB,GAAG,kBAAkB,CAAC;AAGlD,KAAK,gCAAgC,GAAG;IACtC,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,eAAe,EAAE,MAAM,CAAC;IACxB,YAAY,EAAE,+BAA+B,EAAE,CAAC;IAChD,UAAU,EAAE,0BAA0B,EAAE,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG,gCAAgC,CAAC;AAE3E,KAAK,+BAA+B,GAAG;IACrC,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,0BAA0B,GAAG;IACvC,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"contracts.types.js","sourceRoot":"","sources":["../../src/types/contracts.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
export type MinTypedValue = {
|
|
2
|
+
type: string;
|
|
3
|
+
value: string;
|
|
4
|
+
};
|
|
5
|
+
export interface DslNode {
|
|
6
|
+
id: string;
|
|
7
|
+
references: string[];
|
|
8
|
+
}
|
|
9
|
+
export type TypedValue = MinTypedValue & {
|
|
10
|
+
substitution?: boolean;
|
|
11
|
+
constant?: boolean;
|
|
12
|
+
};
|
|
13
|
+
export type InstanceConfigArgumentsOnly = {
|
|
14
|
+
execArguments: TypedValue[];
|
|
15
|
+
initArguments: TypedValue[];
|
|
16
|
+
};
|
|
17
|
+
export type InstanceConfigNameAndAddressOnly = {
|
|
18
|
+
name?: string;
|
|
19
|
+
artifactAddress: string;
|
|
20
|
+
needsInitialization: boolean;
|
|
21
|
+
};
|
|
22
|
+
export type InstanceConfig = InstanceConfigArgumentsOnly & InstanceConfigNameAndAddressOnly;
|
|
23
|
+
export type TranspilerOutput = {
|
|
24
|
+
ir: string;
|
|
25
|
+
rootNode: string;
|
|
26
|
+
typings: InstanceConfig[];
|
|
27
|
+
};
|
|
28
|
+
export type NodeWithReference = {
|
|
29
|
+
nodeId: string;
|
|
30
|
+
parentNodeId: string;
|
|
31
|
+
};
|
|
32
|
+
//# sourceMappingURL=dsl.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dsl.types.d.ts","sourceRoot":"","sources":["../../src/types/dsl.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,aAAa,GAAG;IAC1B,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,MAAM,WAAW,OAAO;IACtB,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,EAAE,CAAC;CACtB;AAED,MAAM,MAAM,UAAU,GAAG,aAAa,GAAG;IACvC,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,CAAC;AAEF,MAAM,MAAM,2BAA2B,GAAG;IACxC,aAAa,EAAE,UAAU,EAAE,CAAC;IAC5B,aAAa,EAAE,UAAU,EAAE,CAAC;CAC7B,CAAC;AAEF,MAAM,MAAM,gCAAgC,GAAG;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,eAAe,EAAE,MAAM,CAAC;IACxB,mBAAmB,EAAE,OAAO,CAAC;CAC9B,CAAC;AAEF,MAAM,MAAM,cAAc,GAAG,2BAA2B,GACtD,gCAAgC,CAAC;AAEnC,MAAM,MAAM,gBAAgB,GAAG;IAC7B,EAAE,EAAE,MAAM,CAAC;IACX,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,cAAc,EAAE,CAAC;CAC3B,CAAC;AAEF,MAAM,MAAM,iBAAiB,GAAG;IAC9B,MAAM,EAAE,MAAM,CAAC;IACf,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dsl.types.js","sourceRoot":"","sources":["../../src/types/dsl.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export * from './compiler.types';
|
|
2
|
+
export * from './contracts.types';
|
|
3
|
+
export * from './dsl.types';
|
|
4
|
+
export * from './intermediate-representation.types';
|
|
5
|
+
export * from './solidity-decode.types';
|
|
6
|
+
export * from './solidity-encode.types';
|
|
7
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,aAAa,CAAC;AAC5B,cAAc,qCAAqC,CAAC;AACpD,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __exportStar = (this && this.__exportStar) || function(m, exports) {
|
|
14
|
+
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
|
15
|
+
};
|
|
16
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
17
|
+
__exportStar(require("./compiler.types"), exports);
|
|
18
|
+
__exportStar(require("./contracts.types"), exports);
|
|
19
|
+
__exportStar(require("./dsl.types"), exports);
|
|
20
|
+
__exportStar(require("./intermediate-representation.types"), exports);
|
|
21
|
+
__exportStar(require("./solidity-decode.types"), exports);
|
|
22
|
+
__exportStar(require("./solidity-encode.types"), exports);
|
|
23
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;AAAA,mDAAiC;AACjC,oDAAkC;AAClC,8CAA4B;AAC5B,sEAAoD;AACpD,0DAAwC;AACxC,0DAAwC"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
declare enum SupportedSolidityTypesEnum {
|
|
2
|
+
Uint256 = "uint256",
|
|
3
|
+
String = "string",
|
|
4
|
+
Bool = "bool",
|
|
5
|
+
Bytes = "bytes",
|
|
6
|
+
Address = "address"
|
|
7
|
+
}
|
|
8
|
+
declare enum DSLTypesEnum {
|
|
9
|
+
Number = "number",
|
|
10
|
+
String = "string",
|
|
11
|
+
Bool = "bool",
|
|
12
|
+
Bytes = "bytes",
|
|
13
|
+
Address = "address"
|
|
14
|
+
}
|
|
15
|
+
export type SupportedSolidityType = `${SupportedSolidityTypesEnum}`;
|
|
16
|
+
export type DSLType = `${DSLTypesEnum}`;
|
|
17
|
+
export {};
|
|
18
|
+
//# sourceMappingURL=intermediate-representation.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intermediate-representation.types.d.ts","sourceRoot":"","sources":["../../src/types/intermediate-representation.types.ts"],"names":[],"mappings":"AAAA,aAAK,0BAA0B;IAC7B,OAAO,YAAY;IACnB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,aAAK,YAAY;IACf,MAAM,WAAW;IACjB,MAAM,WAAW;IACjB,IAAI,SAAS;IACb,KAAK,UAAU;IACf,OAAO,YAAY;CACpB;AAED,MAAM,MAAM,qBAAqB,GAAG,GAAG,0BAA0B,EAAE,CAAC;AACpE,MAAM,MAAM,OAAO,GAAG,GAAG,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
var SupportedSolidityTypesEnum;
|
|
4
|
+
(function (SupportedSolidityTypesEnum) {
|
|
5
|
+
SupportedSolidityTypesEnum["Uint256"] = "uint256";
|
|
6
|
+
SupportedSolidityTypesEnum["String"] = "string";
|
|
7
|
+
SupportedSolidityTypesEnum["Bool"] = "bool";
|
|
8
|
+
SupportedSolidityTypesEnum["Bytes"] = "bytes";
|
|
9
|
+
SupportedSolidityTypesEnum["Address"] = "address";
|
|
10
|
+
})(SupportedSolidityTypesEnum || (SupportedSolidityTypesEnum = {}));
|
|
11
|
+
var DSLTypesEnum;
|
|
12
|
+
(function (DSLTypesEnum) {
|
|
13
|
+
DSLTypesEnum["Number"] = "number";
|
|
14
|
+
DSLTypesEnum["String"] = "string";
|
|
15
|
+
DSLTypesEnum["Bool"] = "bool";
|
|
16
|
+
DSLTypesEnum["Bytes"] = "bytes";
|
|
17
|
+
DSLTypesEnum["Address"] = "address";
|
|
18
|
+
})(DSLTypesEnum || (DSLTypesEnum = {}));
|
|
19
|
+
//# sourceMappingURL=intermediate-representation.types.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"intermediate-representation.types.js","sourceRoot":"","sources":["../../src/types/intermediate-representation.types.ts"],"names":[],"mappings":";;AAAA,IAAK,0BAMJ;AAND,WAAK,0BAA0B;IAC7B,iDAAmB,CAAA;IACnB,+CAAiB,CAAA;IACjB,2CAAa,CAAA;IACb,6CAAe,CAAA;IACf,iDAAmB,CAAA;AACrB,CAAC,EANI,0BAA0B,KAA1B,0BAA0B,QAM9B;AAED,IAAK,YAMJ;AAND,WAAK,YAAY;IACf,iCAAiB,CAAA;IACjB,iCAAiB,CAAA;IACjB,6BAAa,CAAA;IACb,+BAAe,CAAA;IACf,mCAAmB,CAAA;AACrB,CAAC,EANI,YAAY,KAAZ,YAAY,QAMhB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solidity-decode.types.d.ts","sourceRoot":"","sources":["../../src/types/solidity-decode.types.ts"],"names":[],"mappings":"AAAA,MAAM,MAAM,gBAAgB,GACxB,QAAQ,GACR,MAAM,GACN,SAAS,GACT,OAAO,CAAmB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solidity-decode.types.js","sourceRoot":"","sources":["../../src/types/solidity-decode.types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { SolidityAddressType, SolidityBytesType } from '../solidity-types/native-types';
|
|
2
|
+
export type PrimitiveEncodeParamTypes = string | boolean | number;
|
|
3
|
+
export type ObjectEncodeParamTypes = SolidityAddressType | SolidityBytesType;
|
|
4
|
+
export type EncodedParamType = PrimitiveEncodeParamTypes | ObjectEncodeParamTypes;
|
|
5
|
+
//# sourceMappingURL=solidity-encode.types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solidity-encode.types.d.ts","sourceRoot":"","sources":["../../src/types/solidity-encode.types.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,mBAAmB,EACnB,iBAAiB,EAClB,MAAM,gCAAgC,CAAC;AAExC,MAAM,MAAM,yBAAyB,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,CAAC;AAGlE,MAAM,MAAM,sBAAsB,GAAG,mBAAmB,GAAG,iBAAiB,CAAC;AAG7E,MAAM,MAAM,gBAAgB,GACxB,yBAAyB,GACzB,sBAAsB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"solidity-encode.types.js","sourceRoot":"","sources":["../../src/types/solidity-encode.types.ts"],"names":[],"mappings":""}
|
package/package.json
ADDED
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@guardian-network/shared",
|
|
3
|
+
"author": "v.grabovski@lacero.io, vpriadko@lacero.io",
|
|
4
|
+
"description": "A shared tools, types, interfaces of Policy SDK",
|
|
5
|
+
"version": "0.3.2",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"types": "./dist/index.d.ts",
|
|
8
|
+
"files": [
|
|
9
|
+
"dist",
|
|
10
|
+
"src"
|
|
11
|
+
],
|
|
12
|
+
"engines": {
|
|
13
|
+
"node": ">=18.20.4"
|
|
14
|
+
},
|
|
15
|
+
"publishConfig": {
|
|
16
|
+
"registry": "https://registry.npmjs.org",
|
|
17
|
+
"access": "public"
|
|
18
|
+
},
|
|
19
|
+
"keywords": [],
|
|
20
|
+
"devDependencies": {
|
|
21
|
+
"@eslint/eslintrc": "^3.1.0",
|
|
22
|
+
"@eslint/js": "^9.13.0",
|
|
23
|
+
"@istanbuljs/nyc-config-typescript": "^1.0.2",
|
|
24
|
+
"@types/mocha": "^10.0.9",
|
|
25
|
+
"@types/node": "^22.8.0",
|
|
26
|
+
"@typescript-eslint/eslint-plugin": "^8.61.1",
|
|
27
|
+
"@typescript-eslint/parser": "^8.8.0",
|
|
28
|
+
"copyfiles": "^2.4.1",
|
|
29
|
+
"eslint": "^9.11.1",
|
|
30
|
+
"eslint-config-prettier": "^9.1.0",
|
|
31
|
+
"eslint-import-resolver-typescript": "^3.6.3",
|
|
32
|
+
"eslint-plugin-import": "^2.31.0",
|
|
33
|
+
"eslint-plugin-mocha": "^10.5.0",
|
|
34
|
+
"eslint-plugin-n": "^17.10.3",
|
|
35
|
+
"eslint-plugin-prettier": "^5.2.1",
|
|
36
|
+
"eslint-plugin-promise": "^7.1.0",
|
|
37
|
+
"eslint-plugin-unused-imports": "^4.1.4",
|
|
38
|
+
"globals": "^15.11.0",
|
|
39
|
+
"mocha": "^10.8.2",
|
|
40
|
+
"nyc": "^18.0.0",
|
|
41
|
+
"prettier": "^3.3.3",
|
|
42
|
+
"prettier-plugin-organize-imports": "^4.1.0",
|
|
43
|
+
"rimraf": "^6.0.1"
|
|
44
|
+
},
|
|
45
|
+
"dependencies": {
|
|
46
|
+
"dotenv": "^16.4.5",
|
|
47
|
+
"ethers": "^6.16.0",
|
|
48
|
+
"typescript": "^5.6.2"
|
|
49
|
+
},
|
|
50
|
+
"scripts": {
|
|
51
|
+
"build": "pnpm format:all:fix && tsc -p tsconfig-prod.json && pnpm copy-dts",
|
|
52
|
+
"check": "pnpm lint:ts && pnpm check:ts",
|
|
53
|
+
"check:ts": "tsc -p tsconfig-prod.json --noEmit",
|
|
54
|
+
"check:ts:dev": "tsc -p tsconfig.json --noEmit",
|
|
55
|
+
"clean": "pnpm remove:dist",
|
|
56
|
+
"copy-dts": "copyfiles -u 1 \"src/**/*.d.ts\" dist",
|
|
57
|
+
"format:all:fix": "pnpm format:ts:fix",
|
|
58
|
+
"format:ts:fix": "prettier -w -c \"src/**/*.ts\"",
|
|
59
|
+
"lint:ts": "eslint",
|
|
60
|
+
"lint:ts:fix": "eslint --fix",
|
|
61
|
+
"publish-package": "pnpm publish --no-git-checks",
|
|
62
|
+
"remove:dist": "npx rimraf dist",
|
|
63
|
+
"test": "mocha",
|
|
64
|
+
"tests:coverage:ts": "nyc pnpm test",
|
|
65
|
+
"version": "pnpm version"
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
import { Contract, type ContractRunner } from 'ethers';
|
|
6
|
+
import type { IMinArbitraryDataArtifact } from './min-arbitrary-data-artifact.interface';
|
|
7
|
+
|
|
8
|
+
const _abi = [
|
|
9
|
+
{
|
|
10
|
+
inputs: [
|
|
11
|
+
{
|
|
12
|
+
internalType: 'bytes[]',
|
|
13
|
+
name: 'data',
|
|
14
|
+
type: 'bytes[]',
|
|
15
|
+
},
|
|
16
|
+
],
|
|
17
|
+
name: 'exec',
|
|
18
|
+
outputs: [
|
|
19
|
+
{
|
|
20
|
+
internalType: 'bytes',
|
|
21
|
+
name: '',
|
|
22
|
+
type: 'bytes',
|
|
23
|
+
},
|
|
24
|
+
],
|
|
25
|
+
stateMutability: 'nonpayable',
|
|
26
|
+
type: 'function',
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
inputs: [],
|
|
30
|
+
name: 'getExecDescriptor',
|
|
31
|
+
outputs: [
|
|
32
|
+
{
|
|
33
|
+
internalType: 'string[]',
|
|
34
|
+
name: 'argsNames',
|
|
35
|
+
type: 'string[]',
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
internalType: 'string[]',
|
|
39
|
+
name: 'argsTypes',
|
|
40
|
+
type: 'string[]',
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
internalType: 'string',
|
|
44
|
+
name: 'returnType',
|
|
45
|
+
type: 'string',
|
|
46
|
+
},
|
|
47
|
+
],
|
|
48
|
+
stateMutability: 'pure',
|
|
49
|
+
type: 'function',
|
|
50
|
+
},
|
|
51
|
+
{
|
|
52
|
+
inputs: [],
|
|
53
|
+
name: 'getInitDescriptor',
|
|
54
|
+
outputs: [
|
|
55
|
+
{
|
|
56
|
+
internalType: 'string[]',
|
|
57
|
+
name: 'argsNames',
|
|
58
|
+
type: 'string[]',
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
internalType: 'string[]',
|
|
62
|
+
name: 'argsTypes',
|
|
63
|
+
type: 'string[]',
|
|
64
|
+
},
|
|
65
|
+
],
|
|
66
|
+
stateMutability: 'pure',
|
|
67
|
+
type: 'function',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
inputs: [
|
|
71
|
+
{
|
|
72
|
+
internalType: 'bytes',
|
|
73
|
+
name: 'data',
|
|
74
|
+
type: 'bytes',
|
|
75
|
+
},
|
|
76
|
+
],
|
|
77
|
+
name: 'init',
|
|
78
|
+
outputs: [],
|
|
79
|
+
stateMutability: 'nonpayable',
|
|
80
|
+
type: 'function',
|
|
81
|
+
},
|
|
82
|
+
] as const;
|
|
83
|
+
|
|
84
|
+
export class MinArbitraryDataArtifactFactory {
|
|
85
|
+
static readonly abi = _abi;
|
|
86
|
+
|
|
87
|
+
static connect(
|
|
88
|
+
address: string,
|
|
89
|
+
runner?: ContractRunner | null,
|
|
90
|
+
): IMinArbitraryDataArtifact {
|
|
91
|
+
return new Contract(
|
|
92
|
+
address,
|
|
93
|
+
_abi,
|
|
94
|
+
runner,
|
|
95
|
+
) as unknown as IMinArbitraryDataArtifact;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
import type { TransactionRequest } from 'ethers';
|
|
6
|
+
|
|
7
|
+
type BaseOverrides = Omit<TransactionRequest, 'to' | 'data'>;
|
|
8
|
+
|
|
9
|
+
type NonPayableOverrides = Omit<
|
|
10
|
+
BaseOverrides,
|
|
11
|
+
'value' | 'blockTag' | 'enableCcipRead'
|
|
12
|
+
>;
|
|
13
|
+
|
|
14
|
+
type PayableOverrides = Omit<BaseOverrides, 'blockTag' | 'enableCcipRead'>;
|
|
15
|
+
|
|
16
|
+
type ViewOverrides = Omit<TransactionRequest, 'to' | 'data'>;
|
|
17
|
+
|
|
18
|
+
export type Overrides<S extends StateMutability> = S extends 'nonpayable'
|
|
19
|
+
? NonPayableOverrides
|
|
20
|
+
: S extends 'payable'
|
|
21
|
+
? PayableOverrides
|
|
22
|
+
: ViewOverrides;
|
|
23
|
+
|
|
24
|
+
export type StateMutability = 'nonpayable' | 'payable' | 'view';
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
import type { BaseContract, BytesLike, ContractRunner } from 'ethers';
|
|
6
|
+
import { TypedContractMethod } from './typed-contract-method.interface';
|
|
7
|
+
|
|
8
|
+
export interface IMinArbitraryDataArtifact extends BaseContract {
|
|
9
|
+
connect(runner?: ContractRunner | null): IMinArbitraryDataArtifact;
|
|
10
|
+
|
|
11
|
+
exec: TypedContractMethod<[data: BytesLike[]], [string], 'nonpayable'>;
|
|
12
|
+
|
|
13
|
+
getExecDescriptor: TypedContractMethod<
|
|
14
|
+
[],
|
|
15
|
+
[
|
|
16
|
+
[string[], string[], string] & {
|
|
17
|
+
argsNames: string[];
|
|
18
|
+
argsTypes: string[];
|
|
19
|
+
returnType: string;
|
|
20
|
+
},
|
|
21
|
+
],
|
|
22
|
+
'view'
|
|
23
|
+
>;
|
|
24
|
+
|
|
25
|
+
getInitDescriptor: TypedContractMethod<
|
|
26
|
+
[],
|
|
27
|
+
[[string[], string[]] & { argsNames: string[]; argsTypes: string[] }],
|
|
28
|
+
'view'
|
|
29
|
+
>;
|
|
30
|
+
|
|
31
|
+
init: TypedContractMethod<[data: BytesLike], [void], 'nonpayable'>;
|
|
32
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
/* Autogenerated file. Do not edit manually. */
|
|
2
|
+
/* tslint:disable */
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
|
|
5
|
+
import type {
|
|
6
|
+
ContractTransaction,
|
|
7
|
+
ContractTransactionResponse,
|
|
8
|
+
FunctionFragment,
|
|
9
|
+
Typed,
|
|
10
|
+
} from 'ethers';
|
|
11
|
+
import { Overrides, StateMutability } from './method-mutability.types';
|
|
12
|
+
|
|
13
|
+
type PostfixOverrides<A extends Array<any>, S extends StateMutability> =
|
|
14
|
+
| A
|
|
15
|
+
| [...A, Overrides<S>];
|
|
16
|
+
|
|
17
|
+
type ContractMethodArgs<
|
|
18
|
+
Args extends Array<any>,
|
|
19
|
+
State extends StateMutability,
|
|
20
|
+
> = PostfixOverrides<{ [I in keyof Args]-?: Args[I] | Typed }, State>;
|
|
21
|
+
|
|
22
|
+
type DefaultReturnType<R> = R extends Array<any> ? R[0] : R;
|
|
23
|
+
|
|
24
|
+
type GetReturnType<T extends StateMutability, K> = T extends 'view'
|
|
25
|
+
? Promise<DefaultReturnType<K>>
|
|
26
|
+
: Promise<ContractTransactionResponse>;
|
|
27
|
+
|
|
28
|
+
// export interface ContractMethod<A extends Array<any> = Array<any>, R = any, D extends R | ContractTransactionResponse = R | ContractTransactionResponse> {
|
|
29
|
+
export interface TypedContractMethod<
|
|
30
|
+
Args extends Array<any> = Array<any>,
|
|
31
|
+
Returns = any,
|
|
32
|
+
State extends StateMutability = 'payable',
|
|
33
|
+
> {
|
|
34
|
+
(...args: ContractMethodArgs<Args, State>): GetReturnType<State, Returns>;
|
|
35
|
+
|
|
36
|
+
name: string;
|
|
37
|
+
|
|
38
|
+
fragment: FunctionFragment;
|
|
39
|
+
|
|
40
|
+
getFragment(...args: ContractMethodArgs<Args, State>): FunctionFragment;
|
|
41
|
+
|
|
42
|
+
populateTransaction(
|
|
43
|
+
...args: ContractMethodArgs<Args, State>
|
|
44
|
+
): Promise<ContractTransaction>;
|
|
45
|
+
|
|
46
|
+
staticCall(
|
|
47
|
+
...args: ContractMethodArgs<Args, 'view'>
|
|
48
|
+
): Promise<DefaultReturnType<Returns>>;
|
|
49
|
+
|
|
50
|
+
send(
|
|
51
|
+
...args: ContractMethodArgs<Args, State>
|
|
52
|
+
): Promise<ContractTransactionResponse>;
|
|
53
|
+
|
|
54
|
+
estimateGas(...args: ContractMethodArgs<Args, State>): Promise<bigint>;
|
|
55
|
+
|
|
56
|
+
staticCallResult(...args: ContractMethodArgs<Args, 'view'>): Promise<Returns>;
|
|
57
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from './BaseError';
|
package/src/index.ts
ADDED