-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
index.ts
95 lines (78 loc) · 2.32 KB
/
index.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
/* eslint-disable @typescript-eslint/no-explicit-any */
/* eslint-disable max-classes-per-file */
/**
* @privateRemarks
*
* TODO: Consider re-distritubing interfaces near their original packages
*/
// #region bech32-1
export type Bech32Address = `fuel${string}`;
// #endregion bech32-1
export type B256Address = string;
export type B256AddressEvm = `0x000000000000000000000000${string}`;
export type Bytes = Uint8Array | number[];
export type RawSlice = Uint8Array | number[];
export type BytesLike = Uint8Array | string;
/**
* @prop bits - A 256 bit hash string with the first 12 bytes cleared
*/
export type EvmAddress = {
bits: B256AddressEvm;
};
/**
* @prop bits - A wrapped 256 bit hash string
*/
export type AssetId = {
bits: B256Address;
};
export type StdString = string;
/**
* @hidden
*/
export abstract class AbstractScriptRequest<T> {
abstract bytes: Uint8Array;
abstract encodeScriptData: (data: T) => Uint8Array;
}
// #region address-1
export abstract class AbstractAddress {
abstract toJSON(): string;
abstract toString(): string;
abstract toAddress(): Bech32Address;
abstract toB256(): B256Address;
abstract toHexString(): string;
abstract toBytes(): Uint8Array;
abstract equals(other: AbstractAddress): boolean;
}
// #endregion address-1
export abstract class AbstractAccount {
abstract address: AbstractAddress;
abstract provider: unknown;
abstract getResourcesToSpend(quantities: any[], options?: any): any;
abstract sendTransaction(transactionRequest: any, options?: any): any;
abstract simulateTransaction(transactionRequest: any, options?: any): any;
abstract fund(transactionRequest: any, quantities: any, fee: any): Promise<void>;
}
/**
* @hidden
*/
export abstract class AbstractProgram {
abstract account: AbstractAccount | null;
abstract interface: {
readonly jsonAbi: any;
};
abstract provider: {
sendTransaction(transactionRequest: any, options?: any): any;
} | null;
}
export abstract class AbstractContract extends AbstractProgram {
abstract id: AbstractAddress;
}
/**
* @hidden
*/
export abstract class AbstractScript extends AbstractProgram {
abstract bytes: Uint8Array;
}
/** A simple type alias defined using the `type` keyword. */
export type AddressLike = AbstractAddress | AbstractAccount;
export type ContractIdLike = AbstractAddress | AbstractContract;