-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtypes.d.ts
153 lines (113 loc) · 2.68 KB
/
types.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
interface stateOptions {
size?: int;
type: "preImage" | "offChain";
}
export global {
/*~ Here, export things that go in the global namespace, or augment
*~ existing declarations in the global namespace
*/
// interface String {
// fancyFormat(opts: StringFormatOptions): string;
// }
export const OpCode = {
OP_DUP: 1,
OP_HASH160: 1,
OP_EQUALVERIFY: 1,
OP_CHECKSIG: 1,
};
export type Ripemd160 = bytes;
export type Sha256 = bytes;
export type auto = any;
export type PubKey = bytes;
export type PrivKey = bytes;
export type Sig = bytes;
// export type byte = any;
export type bytes = any;
// export class bytes {
// valueOf(): number {
// return 123;
// }
// slice(a, b) {}
// }
export class byte {}
export type int = number;
export type bool = boolean;
export type SigHashPreimage = bytes;
export function SigHashPreimage(a: any): SigHashPreimage {}
export type SigHashType = bytes;
export function SigHashType(a: any): SigHashType {}
export function b(a: any): bytes {}
export function pack(a: any): bytes {}
export function ripemd160(a: any): bytes {
// return function (fn) {};
}
export function loop(times: number) {
return function (fn) {};
}
export function asm<ReturnType>(code): ReturnType {
return {} as ReturnType;
}
export function assert(...args: any) {}
export function num2bin(a: any, b: any): bytes {}
export function hash256(a: any): bytes {
return [];
}
export function len(a: any): int {
return Math.random();
}
export function unpack(a: any): int {
return 1;
}
export function hash160(input: any): bytes {
return "";
}
export function checkSig(a: any, b: any): boolean {
return true;
}
export function sha256(a: any): bytes {
return "";
}
export function contract() {
return function (constructor: Function) {
// return Reflect.metadata(modelSymbol, {});
};
}
export class HashPuzzleSha256 {
constructor(a: any) {}
spend(a: any): boolean {
return true;
}
}
export class P2PKH {
constructor(a: any) {}
spend(a: any, b: any): boolean {
return true;
}
}
export class Tx {
static checkPreimage(a: any) {}
static checkPreimageAdvanced(...a: any): bool {
return true;
}
}
// export class FOOOO {
// valueOf() {
// return 123
// }
// }
const formatMetadataKey = Symbol("state");
export function state(options?: stateOptions | stateOptions["type"]) {
return Reflect.metadata(formatMetadataKey, {});
}
export function PubKey(a: any): PubKey {}
export function PrivKey(a: any): PrivKey {}
export const SigHash = {
ANYONECANPAY: 1,
ALL: 1,
FORKID: 1,
};
}
export type Ripemd160 = string;
export {};
// let a = new FOOOO();
// a = a + 123;