@flarenetwork/flare-periphery-contract-artifacts 0.1.5 → 0.1.7
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/coston/StateConnector/configs/AddressValidity.json +326 -0
- package/coston/StateConnector/configs/BalanceDecreasingTransaction.json +379 -0
- package/coston/StateConnector/configs/ConfirmedBlockHeightExists.json +363 -0
- package/coston/StateConnector/configs/EVMTransaction.json +600 -0
- package/coston/StateConnector/configs/Payment.json +512 -0
- package/coston/StateConnector/configs/ReferencedPaymentNonexistence.json +431 -0
- package/coston/StateConnector/configs/TypeTemplate.json +555 -0
- package/dist/coston/StateConnector/libs/ts/AttestationDefinitionStore.d.ts +63 -0
- package/dist/coston/StateConnector/libs/ts/AttestationDefinitionStore.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/AttestationDefinitionStore.js +159 -0
- package/dist/coston/StateConnector/libs/ts/AttestationDefinitionStore.js.map +1 -0
- package/dist/coston/StateConnector/libs/ts/AttestationResponse.d.ts +33 -0
- package/dist/coston/StateConnector/libs/ts/AttestationResponse.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/AttestationResponse.js +30 -0
- package/dist/coston/StateConnector/libs/ts/AttestationResponse.js.map +1 -0
- package/dist/coston/StateConnector/libs/ts/MerkleTree.d.ts +103 -0
- package/dist/coston/StateConnector/libs/ts/MerkleTree.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/MerkleTree.js +212 -0
- package/dist/coston/StateConnector/libs/ts/MerkleTree.js.map +1 -0
- package/dist/coston/StateConnector/libs/ts/config-types.d.ts +143 -0
- package/dist/coston/StateConnector/libs/ts/config-types.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/config-types.js +3 -0
- package/dist/coston/StateConnector/libs/ts/config-types.js.map +1 -0
- package/dist/coston/StateConnector/libs/ts/interfaces.d.ts +32 -0
- package/dist/coston/StateConnector/libs/ts/interfaces.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/interfaces.js +3 -0
- package/dist/coston/StateConnector/libs/ts/interfaces.js.map +1 -0
- package/dist/coston/StateConnector/libs/ts/random.d.ts +9 -0
- package/dist/coston/StateConnector/libs/ts/random.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/random.js +70 -0
- package/dist/coston/StateConnector/libs/ts/random.js.map +1 -0
- package/dist/coston/StateConnector/libs/ts/utils.d.ts +66 -0
- package/dist/coston/StateConnector/libs/ts/utils.d.ts.map +1 -0
- package/dist/coston/StateConnector/libs/ts/utils.js +2838 -0
- package/dist/coston/StateConnector/libs/ts/utils.js.map +1 -0
- package/dist/coston/StateConnector/typescript/AddressValidity.d.ts +95 -0
- package/dist/coston/StateConnector/typescript/AddressValidity.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/AddressValidity.js +9 -0
- package/dist/coston/StateConnector/typescript/AddressValidity.js.map +1 -0
- package/dist/coston/StateConnector/typescript/BalanceDecreasingTransaction.d.ts +107 -0
- package/dist/coston/StateConnector/typescript/BalanceDecreasingTransaction.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/BalanceDecreasingTransaction.js +9 -0
- package/dist/coston/StateConnector/typescript/BalanceDecreasingTransaction.js.map +1 -0
- package/dist/coston/StateConnector/typescript/ConfirmedBlockHeightExists.d.ts +103 -0
- package/dist/coston/StateConnector/typescript/ConfirmedBlockHeightExists.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/ConfirmedBlockHeightExists.js +9 -0
- package/dist/coston/StateConnector/typescript/ConfirmedBlockHeightExists.js.map +1 -0
- package/dist/coston/StateConnector/typescript/EVMTransaction.d.ts +160 -0
- package/dist/coston/StateConnector/typescript/EVMTransaction.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/EVMTransaction.js +9 -0
- package/dist/coston/StateConnector/typescript/EVMTransaction.js.map +1 -0
- package/dist/coston/StateConnector/typescript/Payment.d.ts +139 -0
- package/dist/coston/StateConnector/typescript/Payment.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/Payment.js +9 -0
- package/dist/coston/StateConnector/typescript/Payment.js.map +1 -0
- package/dist/coston/StateConnector/typescript/ReferencedPaymentNonexistence.d.ts +115 -0
- package/dist/coston/StateConnector/typescript/ReferencedPaymentNonexistence.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/ReferencedPaymentNonexistence.js +9 -0
- package/dist/coston/StateConnector/typescript/ReferencedPaymentNonexistence.js.map +1 -0
- package/dist/coston/StateConnector/typescript/TypeTemplate.d.ts +146 -0
- package/dist/coston/StateConnector/typescript/TypeTemplate.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/TypeTemplate.js +9 -0
- package/dist/coston/StateConnector/typescript/TypeTemplate.js.map +1 -0
- package/dist/coston/StateConnector/typescript/data-sources/data-sources.d.ts +29 -0
- package/dist/coston/StateConnector/typescript/data-sources/data-sources.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/data-sources/data-sources.js +33 -0
- package/dist/coston/StateConnector/typescript/data-sources/data-sources.js.map +1 -0
- package/dist/coston/StateConnector/typescript/index.d.ts +9 -0
- package/dist/coston/StateConnector/typescript/index.d.ts.map +1 -0
- package/dist/coston/StateConnector/typescript/index.js +25 -0
- package/dist/coston/StateConnector/typescript/index.js.map +1 -0
- package/dist/coston/deploys/contracts.json +231 -231
- package/dist/coston2/deploys/contracts.json +270 -270
- package/dist/flare/deploys/contracts.json +270 -270
- package/dist/songbird/deploys/contracts.json +200 -200
- package/package.json +1 -1
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* ABI definition fields for request, response and proof of an attestation type.
|
|
3
|
+
*/
|
|
4
|
+
export interface ABIDefinitions {
|
|
5
|
+
/**
|
|
6
|
+
* JSON ABI definition for attestation type request
|
|
7
|
+
*/
|
|
8
|
+
requestAbi: any;
|
|
9
|
+
/**
|
|
10
|
+
* JSON ABI definition for attestation type response
|
|
11
|
+
*/
|
|
12
|
+
responseAbi: any;
|
|
13
|
+
/**
|
|
14
|
+
* JSON ABI definition for attestation type proof
|
|
15
|
+
*/
|
|
16
|
+
proofAbi: any;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Metadata for basic and ABI configs for an attestation type.
|
|
20
|
+
*/
|
|
21
|
+
export interface TypeRecord extends ABIDefinitions {
|
|
22
|
+
/**
|
|
23
|
+
* Attestation type name. Must be unique and in PascalCase (also known as UpperCamelCase, hence CamelCase with the first letter capitalized).
|
|
24
|
+
*/
|
|
25
|
+
name: string;
|
|
26
|
+
/**
|
|
27
|
+
* Full comment for the attestation type as provided in the Solidity definition.
|
|
28
|
+
*/
|
|
29
|
+
fullComment: string;
|
|
30
|
+
/**
|
|
31
|
+
* Description of the attestation type. Used also in the generated documentation.
|
|
32
|
+
*/
|
|
33
|
+
description: string;
|
|
34
|
+
/**
|
|
35
|
+
* Comma separated list of supported sources for the attestation type. The strings defining types are community defined.
|
|
36
|
+
* Currently, the following are supported: BTC, DOGE, XRP, ETH
|
|
37
|
+
*/
|
|
38
|
+
supported: string[];
|
|
39
|
+
/**
|
|
40
|
+
* Text describing the attestation type verification rules. In Markdown format.
|
|
41
|
+
*/
|
|
42
|
+
verification: string;
|
|
43
|
+
/**
|
|
44
|
+
* The description of how lowest used timestamp is obtained from the attestation response.
|
|
45
|
+
* Usually a field name.
|
|
46
|
+
*/
|
|
47
|
+
lut: string;
|
|
48
|
+
/**
|
|
49
|
+
* Metadata about the struct describing attestation request.
|
|
50
|
+
*/
|
|
51
|
+
request: StructRecord;
|
|
52
|
+
/**
|
|
53
|
+
* Metadata about the struct describing attestation response.
|
|
54
|
+
*/
|
|
55
|
+
response: StructRecord;
|
|
56
|
+
/**
|
|
57
|
+
* Metadata about the struct describing attestation proof.
|
|
58
|
+
*/
|
|
59
|
+
proof: StructRecord;
|
|
60
|
+
/**
|
|
61
|
+
* Metadata about the struct describing attestation request body.
|
|
62
|
+
*/
|
|
63
|
+
requestBody: StructRecord;
|
|
64
|
+
/**
|
|
65
|
+
* Metadata about the struct describing attestation response body.
|
|
66
|
+
*/
|
|
67
|
+
responseBody: StructRecord;
|
|
68
|
+
/**
|
|
69
|
+
* List of metadata objects describing structs used in attestation request.
|
|
70
|
+
*/
|
|
71
|
+
requestStructs: StructRecord[];
|
|
72
|
+
/**
|
|
73
|
+
* List of metadata objects describing structs used in attestation response.
|
|
74
|
+
*/
|
|
75
|
+
responseStructs: StructRecord[];
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Metadata for a struct parameter from a Solidity definition of attestation types.
|
|
79
|
+
*/
|
|
80
|
+
export interface ParamRecord {
|
|
81
|
+
/**
|
|
82
|
+
* Field name.
|
|
83
|
+
*/
|
|
84
|
+
name: string;
|
|
85
|
+
/**
|
|
86
|
+
* Field type as defined in Solidity.
|
|
87
|
+
*/
|
|
88
|
+
type: string;
|
|
89
|
+
/**
|
|
90
|
+
* Short field type (omitting position prefixes for structs)
|
|
91
|
+
*/
|
|
92
|
+
typeSimple?: string;
|
|
93
|
+
/**
|
|
94
|
+
* Field description. Possibly multiline.
|
|
95
|
+
*/
|
|
96
|
+
comment: string;
|
|
97
|
+
}
|
|
98
|
+
/**
|
|
99
|
+
* Metadata for a struct from a Solidity definition of attestation types.
|
|
100
|
+
*/
|
|
101
|
+
export interface StructRecord {
|
|
102
|
+
/**
|
|
103
|
+
* Struct name.
|
|
104
|
+
*/
|
|
105
|
+
name: string;
|
|
106
|
+
/**
|
|
107
|
+
* Full comment for the struct as provided in the Solidity definition.
|
|
108
|
+
*/
|
|
109
|
+
fullComment: string;
|
|
110
|
+
/**
|
|
111
|
+
* Struct description. Possibly multiline, can use Markdown.
|
|
112
|
+
*/
|
|
113
|
+
description: string;
|
|
114
|
+
/**
|
|
115
|
+
* Additional markdown text to be used above the struct fields description in documentation.
|
|
116
|
+
*/
|
|
117
|
+
above?: string;
|
|
118
|
+
/**
|
|
119
|
+
* Additional markdown text to be used below the struct fields description in documentation.
|
|
120
|
+
*/
|
|
121
|
+
below?: string;
|
|
122
|
+
/**
|
|
123
|
+
* List of metadata objects describing struct fields.
|
|
124
|
+
*/
|
|
125
|
+
params: ParamRecord[];
|
|
126
|
+
}
|
|
127
|
+
export interface DataSource {
|
|
128
|
+
name: string;
|
|
129
|
+
description: string;
|
|
130
|
+
}
|
|
131
|
+
export interface Protocol {
|
|
132
|
+
name: string;
|
|
133
|
+
description: string;
|
|
134
|
+
}
|
|
135
|
+
export interface AttestationTypeProtocolSupport {
|
|
136
|
+
attestationType: string;
|
|
137
|
+
supportedDataSources: string[];
|
|
138
|
+
}
|
|
139
|
+
export interface ProtocolSupport {
|
|
140
|
+
protocol: string;
|
|
141
|
+
supported: AttestationTypeProtocolSupport[];
|
|
142
|
+
}
|
|
143
|
+
//# sourceMappingURL=config-types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-types.d.ts","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/config-types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,cAAc;IAC3B;;OAEG;IACH,UAAU,EAAE,GAAG,CAAC;IAChB;;OAEG;IACH,WAAW,EAAE,GAAG,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,GAAG,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,UAAW,SAAQ,cAAc;IAC9C;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;;OAGG;IACH,SAAS,EAAE,MAAM,EAAE,CAAC;IACpB;;OAEG;IACH,YAAY,EAAE,MAAM,CAAC;IACrB;;;OAGG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,OAAO,EAAE,YAAY,CAAC;IACtB;;OAEG;IACH,QAAQ,EAAE,YAAY,CAAC;IACvB;;OAEG;IACH,KAAK,EAAE,YAAY,CAAC;IACpB;;OAEG;IACH,WAAW,EAAE,YAAY,CAAC;IAC1B;;OAEG;IACH,YAAY,EAAE,YAAY,CAAC;IAC3B;;OAEG;IACH,cAAc,EAAE,YAAY,EAAE,CAAC;IAC/B;;OAEG;IACH,eAAe,EAAE,YAAY,EAAE,CAAC;CACnC;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,OAAO,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,WAAW,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,MAAM,EAAE,WAAW,EAAE,CAAC;CACzB;AAED,MAAM,WAAW,UAAU;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,QAAQ;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,WAAW,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,8BAA8B;IAC3C,eAAe,EAAE,MAAM,CAAC;IACxB,oBAAoB,EAAE,MAAM,EAAE,CAAC;CAClC;AACD,MAAM,WAAW,eAAe;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,EAAE,8BAA8B,EAAE,CAAC;CAC/C"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-types.js","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/config-types.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Generic interface for the request of an attestation request.
|
|
3
|
+
*/
|
|
4
|
+
export interface ARBase {
|
|
5
|
+
attestationType: string;
|
|
6
|
+
sourceId: string;
|
|
7
|
+
messageIntegrityCode?: string;
|
|
8
|
+
requestBody: any;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* Generic interface for the response of an attestation request.
|
|
12
|
+
*/
|
|
13
|
+
export interface ARESBase {
|
|
14
|
+
attestationType: string;
|
|
15
|
+
sourceId: string;
|
|
16
|
+
votingRound: string;
|
|
17
|
+
lowestUsedTimestamp: string;
|
|
18
|
+
requestBody: any;
|
|
19
|
+
responseBody: any;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Generic interface for example data usually randomly generated for testing purposes and examples.
|
|
23
|
+
*/
|
|
24
|
+
export interface ExampleData<RNM, REQ, RES> {
|
|
25
|
+
requestNoMic: RNM;
|
|
26
|
+
request: REQ;
|
|
27
|
+
response: RES;
|
|
28
|
+
messageIntegrityCode: string;
|
|
29
|
+
encodedRequestZeroMic: string;
|
|
30
|
+
encodedRequest: string;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=interfaces.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.d.ts","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/interfaces.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,MAAM;IACnB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,EAAE,GAAG,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,QAAQ;IACrB,eAAe,EAAE,MAAM,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,mBAAmB,EAAE,MAAM,CAAC;IAC5B,WAAW,EAAE,GAAG,CAAC;IACjB,YAAY,EAAE,GAAG,CAAC;CACrB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG;IACtC,YAAY,EAAE,GAAG,CAAC;IAClB,OAAO,EAAE,GAAG,CAAC;IACb,QAAQ,EAAE,GAAG,CAAC;IACd,oBAAoB,EAAE,MAAM,CAAC;IAC7B,qBAAqB,EAAE,MAAM,CAAC;IAC9B,cAAc,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"interfaces.js","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/interfaces.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare function seededRandHex(n: number, seed?: string): string;
|
|
2
|
+
/**
|
|
3
|
+
* Helper random value generator for Solidity type values used in in randomized attestation requests or responses.
|
|
4
|
+
* Primarily used for testing
|
|
5
|
+
* @param typeName solidity type (e.g. uint256)
|
|
6
|
+
* @returns
|
|
7
|
+
*/
|
|
8
|
+
export declare function randSol(typeName: string, seed?: string): string | boolean;
|
|
9
|
+
//# sourceMappingURL=random.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random.d.ts","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/random.ts"],"names":[],"mappings":"AAEA,wBAAgB,aAAa,CAAC,CAAC,EAAE,MAAM,EAAE,IAAI,SAAM,UAElD;AAED;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,QAAQ,EAAE,MAAM,EAAE,IAAI,SAAM,GAAG,MAAM,GAAG,OAAO,CAyDtE"}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.randSol = exports.seededRandHex = void 0;
|
|
4
|
+
const ethers_1 = require("ethers");
|
|
5
|
+
function seededRandHex(n, seed = "0") {
|
|
6
|
+
return ethers_1.ethers.keccak256(ethers_1.ethers.toUtf8Bytes(seed)).slice(0, 2 + 2 * n);
|
|
7
|
+
}
|
|
8
|
+
exports.seededRandHex = seededRandHex;
|
|
9
|
+
/**
|
|
10
|
+
* Helper random value generator for Solidity type values used in in randomized attestation requests or responses.
|
|
11
|
+
* Primarily used for testing
|
|
12
|
+
* @param typeName solidity type (e.g. uint256)
|
|
13
|
+
* @returns
|
|
14
|
+
*/
|
|
15
|
+
function randSol(typeName, seed = "0") {
|
|
16
|
+
let match = typeName.match(/^.+(\[(\d*)\])$/);
|
|
17
|
+
if (match) {
|
|
18
|
+
const brackets = match[1];
|
|
19
|
+
const value = parseInt(match[2]);
|
|
20
|
+
const typeOfArray = typeName.slice(0, -brackets.length);
|
|
21
|
+
if (!isNaN(value) || value === 0) {
|
|
22
|
+
return ("[" +
|
|
23
|
+
Array(value)
|
|
24
|
+
.fill(0)
|
|
25
|
+
.map(() => randSol(typeOfArray, seed))
|
|
26
|
+
.join(", ") +
|
|
27
|
+
"]");
|
|
28
|
+
}
|
|
29
|
+
else {
|
|
30
|
+
const length = 3; // fixed length
|
|
31
|
+
return ("[" +
|
|
32
|
+
Array(length)
|
|
33
|
+
.fill(0)
|
|
34
|
+
.map(() => randSol(typeOfArray, seed))
|
|
35
|
+
.join(", ") +
|
|
36
|
+
"]");
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
match = typeName.match(/^uint(\d+)$/);
|
|
40
|
+
if (match) {
|
|
41
|
+
return BigInt(seededRandHex(parseInt(match[1]) / 8, seed)).toString();
|
|
42
|
+
}
|
|
43
|
+
match = typeName.match(/^int(\d+)$/);
|
|
44
|
+
if (match) {
|
|
45
|
+
const val = seededRandHex(parseInt(match[1]) / 8, seed);
|
|
46
|
+
return BigInt("0x0" + val.slice(3)).toString();
|
|
47
|
+
}
|
|
48
|
+
if (typeName.match(/^bool$/)) {
|
|
49
|
+
return true;
|
|
50
|
+
}
|
|
51
|
+
match = typeName.match(/^bytes(\d+)$/);
|
|
52
|
+
if (match) {
|
|
53
|
+
return seededRandHex(parseInt(match[1]), seed);
|
|
54
|
+
}
|
|
55
|
+
if (typeName.match(/^address$/)) {
|
|
56
|
+
return seededRandHex(20, seed);
|
|
57
|
+
}
|
|
58
|
+
if (typeName.match(/^string$/)) {
|
|
59
|
+
return "Random string";
|
|
60
|
+
}
|
|
61
|
+
if (typeName.match(/^byte$/)) {
|
|
62
|
+
return seededRandHex(1, seed);
|
|
63
|
+
}
|
|
64
|
+
if (typeName.match(/^bytes$/)) {
|
|
65
|
+
return seededRandHex(30, seed);
|
|
66
|
+
}
|
|
67
|
+
throw new Error(`Unsupported type ${typeName}`);
|
|
68
|
+
}
|
|
69
|
+
exports.randSol = randSol;
|
|
70
|
+
//# sourceMappingURL=random.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"random.js","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/random.ts"],"names":[],"mappings":"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"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { TypeRecord } from "./config-types";
|
|
2
|
+
/**
|
|
3
|
+
* ABIFragment is a subset of ethers ABIFragment. It is used to define the ABI fragments
|
|
4
|
+
*/
|
|
5
|
+
export interface ABIFragment {
|
|
6
|
+
components?: ABIFragment[];
|
|
7
|
+
internalType: string;
|
|
8
|
+
name: string;
|
|
9
|
+
type: string;
|
|
10
|
+
}
|
|
11
|
+
export declare const MIC_SALT = "Flare";
|
|
12
|
+
export declare const ZERO_BYTES_32: string;
|
|
13
|
+
export declare const ZERO_BYTES_20: string;
|
|
14
|
+
/**
|
|
15
|
+
* Checks if the type is one of the supported Solidity type names.
|
|
16
|
+
* Note: the checks for supported numbers N in 'intN', 'uintN' and 'bytesN' is not implemented. The function is safe only under assumption
|
|
17
|
+
* that the correct types supported by the Solidity compiler are used.
|
|
18
|
+
* @param type
|
|
19
|
+
* @returns
|
|
20
|
+
*/
|
|
21
|
+
export declare function isSupportedBasicSolidityType(type: string): boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Encodes attestation type name or source id as a 32-byte hex string.
|
|
24
|
+
* It takes the UTF-8 bytes of the name and pads them with zeros to 32 bytes.
|
|
25
|
+
* @param attestationTypeName
|
|
26
|
+
* @returns '0x'-prefixed hex string representing 32-bytes
|
|
27
|
+
*/
|
|
28
|
+
export declare function encodeAttestationName(attestationTypeName: string): string;
|
|
29
|
+
/**
|
|
30
|
+
* Decodes attestation type name or source id from a 32-byte hex string.
|
|
31
|
+
* @param encoded Should be a '0x'-prefixed hex string representing exactly 32-bytes.
|
|
32
|
+
* @returns
|
|
33
|
+
*/
|
|
34
|
+
export declare function decodeAttestationName(encoded: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Given a ABI decoded object (with tuples) based on the provided JSON ABI definition,
|
|
37
|
+
* it creates a possibly nested Javascript object compatible with the ABI definitions.
|
|
38
|
+
* The function assumes that the decoded objects matches the ABI. If this is not the case,
|
|
39
|
+
* function may behave in strange ways.
|
|
40
|
+
* This is auxiliary function not intended to be used directly.
|
|
41
|
+
* @param decoded
|
|
42
|
+
* @param abi
|
|
43
|
+
* @param ignoreArray parameter for recursion call when handling of arrays are needed.
|
|
44
|
+
* @returns
|
|
45
|
+
*/
|
|
46
|
+
export declare function remapABIParsedToObjects(decoded: any, abi: ABIFragment, ignoreArray?: boolean): any;
|
|
47
|
+
/**
|
|
48
|
+
* Checks whether the struct objects are deep equal. Objects should match the ABI definition.
|
|
49
|
+
* @param struct1
|
|
50
|
+
* @param struct2
|
|
51
|
+
* @param abi
|
|
52
|
+
* @returns
|
|
53
|
+
*/
|
|
54
|
+
export declare function structsDeepEqual(struct1: any, struct2: any, abi: ABIFragment): boolean;
|
|
55
|
+
/**
|
|
56
|
+
* Loader of the attestation type definition configs
|
|
57
|
+
* @returns a map from attestation types to definition configs
|
|
58
|
+
*/
|
|
59
|
+
export declare function readAttestationTypeConfigs(): Map<string, TypeRecord>;
|
|
60
|
+
/**
|
|
61
|
+
* Helper function serializing bigints to strings recursively.
|
|
62
|
+
* @param obj
|
|
63
|
+
* @returns
|
|
64
|
+
*/
|
|
65
|
+
export declare function serializeBigInts(obj: any): any;
|
|
66
|
+
//# sourceMappingURL=utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../../../coston/StateConnector/libs/ts/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,MAAM,gBAAgB,CAAC;AAG5C;;GAEG;AACH,MAAM,WAAW,WAAW;IACxB,UAAU,CAAC,EAAE,WAAW,EAAE,CAAC;IAC3B,YAAY,EAAE,MAAM,CAAC;IACrB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CAChB;AAGD,eAAO,MAAM,QAAQ,UAAU,CAAC;AAChC,eAAO,MAAM,aAAa,QAAgC,CAAC;AAC3D,eAAO,MAAM,aAAa,QAAgC,CAAC;AA+C3D;;;;;;GAMG;AACH,wBAAgB,4BAA4B,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAUlE;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CAAC,mBAAmB,EAAE,MAAM,UAYhE;AAED;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,MAAM,UAUpD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,EAAE,WAAW,UAAQ,GAAG,GAAG,CA8BhG;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GAAG,EAAE,GAAG,EAAE,WAAW,GAAG,OAAO,CA2DtF;AACD;;;GAGG;AACH,wBAAgB,0BAA0B,IAAI,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAwkFpE;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,GAAG,OAOxC"}
|