envio 3.6.0 → 3.6.1-subgraph

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.
Files changed (43) hide show
  1. package/package.json +6 -6
  2. package/src/ChainState.res +10 -4
  3. package/src/ChainState.res.mjs +5 -1
  4. package/src/Config.res +12 -0
  5. package/src/Config.res.mjs +8 -2
  6. package/src/Core.res +15 -0
  7. package/src/Core.res.mjs +11 -0
  8. package/src/EventProcessing.res +6 -6
  9. package/src/EventProcessing.res.mjs +8 -6
  10. package/src/HandlerLoader.res +20 -8
  11. package/src/HandlerLoader.res.mjs +11 -2
  12. package/src/Metrics.res +5 -5
  13. package/src/Metrics.res.mjs +5 -1
  14. package/src/UserContext.res +358 -51
  15. package/src/UserContext.res.mjs +271 -35
  16. package/src/sources/SourceManager.res +6 -12
  17. package/src/sources/SourceManager.res.mjs +8 -5
  18. package/src/subgraph/blocks.ts +176 -0
  19. package/src/subgraph/calls.ts +213 -0
  20. package/src/subgraph/conformance.ts +99 -0
  21. package/src/subgraph/division.ts +100 -0
  22. package/src/subgraph/errors.ts +90 -0
  23. package/src/subgraph/graph-ts-types/VERSION +2 -0
  24. package/src/subgraph/graph-ts-types/chain/arweave.d.ts +70 -0
  25. package/src/subgraph/graph-ts-types/chain/cosmos.d.ts +327 -0
  26. package/src/subgraph/graph-ts-types/chain/ethereum.d.ts +233 -0
  27. package/src/subgraph/graph-ts-types/chain/near.d.ts +253 -0
  28. package/src/subgraph/graph-ts-types/chain/starknet.d.ts +32 -0
  29. package/src/subgraph/graph-ts-types/common/collections.d.ts +136 -0
  30. package/src/subgraph/graph-ts-types/common/conversion.d.ts +11 -0
  31. package/src/subgraph/graph-ts-types/common/datasource.d.ts +30 -0
  32. package/src/subgraph/graph-ts-types/common/eager-offset.d.ts +0 -0
  33. package/src/subgraph/graph-ts-types/common/json.d.ts +17 -0
  34. package/src/subgraph/graph-ts-types/common/numbers.d.ts +120 -0
  35. package/src/subgraph/graph-ts-types/common/value.d.ts +120 -0
  36. package/src/subgraph/graph-ts-types/common/yaml.d.ts +90 -0
  37. package/src/subgraph/graph-ts-types/global/global.d.ts +194 -0
  38. package/src/subgraph/graph-ts-types/helper-functions.d.ts +22 -0
  39. package/src/subgraph/graph-ts-types/index.d.ts +102 -0
  40. package/src/subgraph/graph-ts.ts +1695 -0
  41. package/src/subgraph/hosts.ts +148 -0
  42. package/src/subgraph/runtime.ts +827 -0
  43. package/src/subgraph/scope.ts +63 -0
@@ -0,0 +1,253 @@
1
+ import '../common/eager-offset';
2
+ import { Bytes } from '../common/collections';
3
+ import { BigInt } from '../common/numbers';
4
+ export declare namespace near {
5
+ type CryptoHash = Bytes;
6
+ type Account = string;
7
+ type BlockHeight = bigint;
8
+ type Balance = BigInt;
9
+ type Gas = bigint;
10
+ type ShardId = bigint;
11
+ type NumBlocks = bigint;
12
+ type ProtocolVersion = number;
13
+ type Payload = bigint;
14
+ enum CurveKind {
15
+ ED25519 = 0,
16
+ SECP256K1 = 1
17
+ }
18
+ class Signature {
19
+ kind: CurveKind;
20
+ bytes: Bytes;
21
+ constructor(kind: CurveKind, bytes: Bytes);
22
+ }
23
+ class PublicKey {
24
+ kind: CurveKind;
25
+ bytes: Bytes;
26
+ constructor(kind: CurveKind, bytes: Bytes);
27
+ }
28
+ enum AccessKeyPermissionKind {
29
+ FUNCTION_CALL = 0,
30
+ FULL_ACCESS = 1
31
+ }
32
+ class FunctionCallPermission {
33
+ allowance: BigInt;
34
+ receiverId: string;
35
+ methodNames: Array<string>;
36
+ constructor(allowance: BigInt, receiverId: string, methodNames: Array<string>);
37
+ }
38
+ class FullAccessPermission {
39
+ }
40
+ class AccessKeyPermissionValue {
41
+ kind: AccessKeyPermissionKind;
42
+ data: Payload;
43
+ constructor(kind: AccessKeyPermissionKind, data: Payload);
44
+ toFunctionCall(): FunctionCallPermission;
45
+ toFullAccess(): FullAccessPermission;
46
+ static fromFunctionCall(input: FunctionCallPermission): AccessKeyPermissionValue;
47
+ static fromFullAccess(input: FullAccessPermission): AccessKeyPermissionValue;
48
+ }
49
+ class AccessKey {
50
+ nonce: bigint;
51
+ permission: AccessKeyPermissionValue;
52
+ constructor(nonce: bigint, permission: AccessKeyPermissionValue);
53
+ }
54
+ class DataReceiver {
55
+ dataId: CryptoHash;
56
+ receiverId: string;
57
+ constructor(dataId: CryptoHash, receiverId: string);
58
+ }
59
+ enum ActionKind {
60
+ CREATE_ACCOUNT = 0,
61
+ DEPLOY_CONTRACT = 1,
62
+ FUNCTION_CALL = 2,
63
+ TRANSFER = 3,
64
+ STAKE = 4,
65
+ ADD_KEY = 5,
66
+ DELETE_KEY = 6,
67
+ DELETE_ACCOUNT = 7
68
+ }
69
+ class CreateAccountAction {
70
+ }
71
+ class DeployContractAction {
72
+ codeHash: Bytes;
73
+ constructor(codeHash: Bytes);
74
+ }
75
+ class FunctionCallAction {
76
+ methodName: string;
77
+ args: Bytes;
78
+ gas: bigint;
79
+ deposit: BigInt;
80
+ constructor(methodName: string, args: Bytes, gas: bigint, deposit: BigInt);
81
+ }
82
+ class TransferAction {
83
+ deposit: BigInt;
84
+ constructor(deposit: BigInt);
85
+ }
86
+ class StakeAction {
87
+ stake: Balance;
88
+ publicKey: PublicKey;
89
+ constructor(stake: Balance, publicKey: PublicKey);
90
+ }
91
+ class AddKeyAction {
92
+ publicKey: PublicKey;
93
+ accessKey: AccessKey;
94
+ constructor(publicKey: PublicKey, accessKey: AccessKey);
95
+ }
96
+ class DeleteKeyAction {
97
+ publicKey: PublicKey;
98
+ constructor(publicKey: PublicKey);
99
+ }
100
+ class DeleteAccountAction {
101
+ beneficiaryId: Account;
102
+ constructor(beneficiaryId: Account);
103
+ }
104
+ class ActionValue {
105
+ kind: ActionKind;
106
+ data: Payload;
107
+ constructor(kind: ActionKind, data: Payload);
108
+ toCreateAccount(): CreateAccountAction;
109
+ toDeployContract(): DeployContractAction;
110
+ toFunctionCall(): FunctionCallAction;
111
+ toTransfer(): TransferAction;
112
+ toStake(): StakeAction;
113
+ toAddKey(): AddKeyAction;
114
+ toDeleteKey(): DeleteKeyAction;
115
+ toDeleteAccount(): DeleteAccountAction;
116
+ static fromCreateAccount(input: CreateAccountAction): ActionValue;
117
+ static fromDeployContract(input: DeployContractAction): ActionValue;
118
+ static fromFunctionCall(input: FunctionCallAction): ActionValue;
119
+ static fromTransfer(input: TransferAction): ActionValue;
120
+ static fromStake(input: StakeAction): ActionValue;
121
+ static fromAddKey(input: AddKeyAction): ActionValue;
122
+ static fromDeleteKey(input: DeleteKeyAction): ActionValue;
123
+ static fromDeleteAccount(input: DeleteAccountAction): ActionValue;
124
+ }
125
+ class ActionReceipt {
126
+ predecessorId: string;
127
+ receiverId: string;
128
+ id: CryptoHash;
129
+ signerId: string;
130
+ signerPublicKey: PublicKey;
131
+ gasPrice: BigInt;
132
+ outputDataReceivers: Array<DataReceiver>;
133
+ inputDataIds: Array<CryptoHash>;
134
+ actions: Array<ActionValue>;
135
+ constructor(predecessorId: string, receiverId: string, id: CryptoHash, signerId: string, signerPublicKey: PublicKey, gasPrice: BigInt, outputDataReceivers: Array<DataReceiver>, inputDataIds: Array<CryptoHash>, actions: Array<ActionValue>);
136
+ }
137
+ enum SuccessStatusKind {
138
+ VALUE = 0,
139
+ RECEIPT_ID = 1
140
+ }
141
+ class SuccessStatus {
142
+ kind: SuccessStatusKind;
143
+ data: Payload;
144
+ constructor(kind: SuccessStatusKind, data: Payload);
145
+ toValue(): Bytes;
146
+ toReceiptId(): CryptoHash;
147
+ static fromValue(input: Bytes): SuccessStatus;
148
+ static fromReceiptId(input: CryptoHash): SuccessStatus;
149
+ }
150
+ enum Direction {
151
+ LEFT = 0,
152
+ RIGHT = 1
153
+ }
154
+ class MerklePathItem {
155
+ hash: CryptoHash;
156
+ direction: Direction;
157
+ constructor(hash: CryptoHash, direction: Direction);
158
+ lt(_: MerklePathItem): boolean;
159
+ gt(_: MerklePathItem): boolean;
160
+ toString(): string;
161
+ }
162
+ class MerklePath extends Array<MerklePathItem> {
163
+ }
164
+ class ExecutionOutcome {
165
+ gasBurnt: bigint;
166
+ proof: MerklePath;
167
+ blockHash: CryptoHash;
168
+ id: CryptoHash;
169
+ logs: Array<string>;
170
+ receiptIds: Array<CryptoHash>;
171
+ tokensBurnt: BigInt;
172
+ executorId: string;
173
+ status: SuccessStatus;
174
+ constructor(gasBurnt: bigint, proof: MerklePath, blockHash: CryptoHash, id: CryptoHash, logs: Array<string>, receiptIds: Array<CryptoHash>, tokensBurnt: BigInt, executorId: string, status: SuccessStatus);
175
+ }
176
+ class SlashedValidator {
177
+ account: Account;
178
+ isDoubleSign: boolean;
179
+ constructor(account: Account, isDoubleSign: boolean);
180
+ }
181
+ class BlockHeader {
182
+ height: BlockHeight;
183
+ prevHeight: BlockHeight;
184
+ blockOrdinal: NumBlocks;
185
+ epochId: CryptoHash;
186
+ nextEpochId: CryptoHash;
187
+ chunksIncluded: bigint;
188
+ hash: CryptoHash;
189
+ prevHash: CryptoHash;
190
+ timestampNanosec: bigint;
191
+ prevStateRoot: CryptoHash;
192
+ chunkReceiptsRoot: CryptoHash;
193
+ chunkHeadersRoot: CryptoHash;
194
+ chunkTxRoot: CryptoHash;
195
+ outcomeRoot: CryptoHash;
196
+ challengesRoot: CryptoHash;
197
+ randomValue: CryptoHash;
198
+ validatorProposals: Array<ValidatorStake>;
199
+ chunkMask: Array<boolean>;
200
+ gasPrice: Balance;
201
+ totalSupply: Balance;
202
+ challengesResult: Array<SlashedValidator>;
203
+ lastFinalBlock: CryptoHash;
204
+ lastDsFinalBlock: CryptoHash;
205
+ nextBpHash: CryptoHash;
206
+ blockMerkleRoot: CryptoHash;
207
+ epochSyncDataHash: CryptoHash;
208
+ approvals: Array<Signature>;
209
+ signature: Signature;
210
+ latestProtocolVersion: ProtocolVersion;
211
+ constructor(height: BlockHeight, prevHeight: BlockHeight, // Always zero when version < V3
212
+ blockOrdinal: NumBlocks, // Always zero when version < V3
213
+ epochId: CryptoHash, nextEpochId: CryptoHash, chunksIncluded: bigint, hash: CryptoHash, prevHash: CryptoHash, timestampNanosec: bigint, prevStateRoot: CryptoHash, chunkReceiptsRoot: CryptoHash, chunkHeadersRoot: CryptoHash, chunkTxRoot: CryptoHash, outcomeRoot: CryptoHash, challengesRoot: CryptoHash, randomValue: CryptoHash, validatorProposals: Array<ValidatorStake>, chunkMask: Array<boolean>, gasPrice: Balance, totalSupply: Balance, challengesResult: Array<SlashedValidator>, lastFinalBlock: CryptoHash, lastDsFinalBlock: CryptoHash, nextBpHash: CryptoHash, blockMerkleRoot: CryptoHash, epochSyncDataHash: CryptoHash, // Always empty when version < V3
214
+ approvals: Array<Signature>, // Array<Option<Signature>>
215
+ signature: Signature, latestProtocolVersion: ProtocolVersion);
216
+ }
217
+ class ValidatorStake {
218
+ account: Account;
219
+ publicKey: PublicKey;
220
+ stake: Balance;
221
+ constructor(account: Account, publicKey: PublicKey, stake: Balance);
222
+ }
223
+ class ChunkHeader {
224
+ encodedLength: bigint;
225
+ gasUsed: Gas;
226
+ gasLimit: Gas;
227
+ shardId: ShardId;
228
+ heightCreated: BlockHeight;
229
+ heightIncluded: BlockHeight;
230
+ chunkHash: CryptoHash;
231
+ signature: Signature;
232
+ prevBlockHash: CryptoHash;
233
+ prevStateRoot: CryptoHash;
234
+ encodedMerkleRoot: CryptoHash;
235
+ balanceBurnt: Balance;
236
+ outgoingReceiptsRoot: CryptoHash;
237
+ txRoot: CryptoHash;
238
+ validatorProposals: Array<ValidatorStake>;
239
+ constructor(encodedLength: bigint, gasUsed: Gas, gasLimit: Gas, shardId: ShardId, heightCreated: BlockHeight, heightIncluded: BlockHeight, chunkHash: CryptoHash, signature: Signature, prevBlockHash: CryptoHash, prevStateRoot: CryptoHash, encodedMerkleRoot: CryptoHash, balanceBurnt: Balance, outgoingReceiptsRoot: CryptoHash, txRoot: CryptoHash, validatorProposals: Array<ValidatorStake>);
240
+ }
241
+ class Block {
242
+ author: Account;
243
+ header: BlockHeader;
244
+ chunks: Array<ChunkHeader>;
245
+ constructor(author: Account, header: BlockHeader, chunks: Array<ChunkHeader>);
246
+ }
247
+ class ReceiptWithOutcome {
248
+ outcome: ExecutionOutcome;
249
+ receipt: ActionReceipt;
250
+ block: Block;
251
+ constructor(outcome: ExecutionOutcome, receipt: ActionReceipt, block: Block);
252
+ }
253
+ }
@@ -0,0 +1,32 @@
1
+ import '../common/eager-offset';
2
+ import { Bytes } from '../common/collections';
3
+ import { BigInt } from '../common/numbers';
4
+ export declare namespace starknet {
5
+ class Block {
6
+ number: BigInt;
7
+ hash: Bytes;
8
+ prevHash: Bytes;
9
+ timestamp: BigInt;
10
+ constructor(number: BigInt, hash: Bytes, prevHash: Bytes, timestamp: BigInt);
11
+ }
12
+ class Transaction {
13
+ type: TransactionType;
14
+ hash: Bytes;
15
+ constructor(type: TransactionType, hash: Bytes);
16
+ }
17
+ enum TransactionType {
18
+ DEPLOY = 0,
19
+ INVOKE_FUNCTION = 1,
20
+ DECLARE = 2,
21
+ L1_HANDLER = 3,
22
+ DEPLOY_ACCOUNT = 4
23
+ }
24
+ class Event {
25
+ fromAddr: Bytes;
26
+ keys: Array<Bytes>;
27
+ data: Array<Bytes>;
28
+ block: Block;
29
+ transaction: Transaction;
30
+ constructor(fromAddr: Bytes, keys: Array<Bytes>, data: Array<Bytes>, block: Block, transaction: Transaction);
31
+ }
32
+ }
@@ -0,0 +1,136 @@
1
+ import { BigDecimal, BigInt } from './numbers';
2
+ import { Value } from './value';
3
+ /**
4
+ * Byte array
5
+ */
6
+ export declare class ByteArray extends Uint8Array {
7
+ /**
8
+ * Returns bytes in little-endian order.
9
+ */
10
+ static fromI32(x: number): ByteArray;
11
+ /**
12
+ * Returns bytes in little-endian order.
13
+ */
14
+ static fromU32(x: number): ByteArray;
15
+ /**
16
+ * Returns bytes in little-endian order.
17
+ */
18
+ static fromI64(x: bigint): ByteArray;
19
+ /**
20
+ * Returns bytes in little-endian order.
21
+ */
22
+ static fromU64(x: bigint): ByteArray;
23
+ static empty(): ByteArray;
24
+ /**
25
+ * Convert the string `hex` which must consist of an even number of
26
+ * hexadecimal digits to a `ByteArray`. The string `hex` can optionally
27
+ * start with '0x'
28
+ */
29
+ static fromHexString(hex: string): ByteArray;
30
+ static fromUTF8(str: string): ByteArray;
31
+ static fromBigInt(bigInt: BigInt): ByteArray;
32
+ toHex(): string;
33
+ toHexString(): string;
34
+ toString(): string;
35
+ toBase58(): string;
36
+ /**
37
+ * Interprets the byte array as a little-endian U32.
38
+ * Throws in case of overflow.
39
+ */
40
+ toU32(): number;
41
+ /**
42
+ * Interprets the byte array as a little-endian I32.
43
+ * Throws in case of overflow.
44
+ */
45
+ toI32(): number;
46
+ /** Create a new `ByteArray` that consist of `this` directly followed by
47
+ * the bytes from `other` */
48
+ concat(other: ByteArray): ByteArray;
49
+ /** Create a new `ByteArray` that consists of `this` directly followed by
50
+ * the representation of `other` as bytes */
51
+ concatI32(other: number): ByteArray;
52
+ /**
53
+ * Interprets the byte array as a little-endian I64.
54
+ * Throws in case of overflow.
55
+ */
56
+ toI64(): bigint;
57
+ /**
58
+ * Interprets the byte array as a little-endian U64.
59
+ * Throws in case of overflow.
60
+ */
61
+ toU64(): bigint;
62
+ equals(other: ByteArray): boolean;
63
+ notEqual(other: ByteArray): boolean;
64
+ }
65
+ /** A dynamically-sized byte array. */
66
+ export declare class Bytes extends ByteArray {
67
+ static fromByteArray(byteArray: ByteArray): Bytes;
68
+ static fromUint8Array(uint8Array: Uint8Array): Bytes;
69
+ /**
70
+ * Convert the string `hex` which must consist of an even number of
71
+ * hexadecimal digits to a `ByteArray`. The string `hex` can optionally
72
+ * start with '0x'
73
+ */
74
+ static fromHexString(str: string): Bytes;
75
+ static fromUTF8(str: string): Bytes;
76
+ static fromI32(i: number): Bytes;
77
+ static empty(): Bytes;
78
+ concat(other: Bytes): Bytes;
79
+ concatI32(other: number): Bytes;
80
+ }
81
+ /**
82
+ * TypedMap entry.
83
+ */
84
+ export declare class TypedMapEntry<K, V> {
85
+ key: K;
86
+ value: V;
87
+ constructor(key: K, value: V);
88
+ }
89
+ /** Typed map */
90
+ export declare class TypedMap<K, V> {
91
+ entries: Array<TypedMapEntry<K, V>>;
92
+ constructor();
93
+ set(key: K, value: V): void;
94
+ getEntry(key: K): TypedMapEntry<K, V> | null;
95
+ mustGetEntry(key: K): TypedMapEntry<K, V>;
96
+ get(key: K): V | null;
97
+ mustGet(key: K): V;
98
+ isSet(key: K): boolean;
99
+ }
100
+ /**
101
+ * Common representation for entity data, storing entity attributes
102
+ * as `string` keys and the attribute values as dynamically-typed
103
+ * `Value` objects.
104
+ */
105
+ export declare class Entity extends TypedMap<string, Value> {
106
+ unset(key: string): void;
107
+ /** Assigns properties from sources to this Entity in right-to-left order */
108
+ merge(sources: Array<Entity>): Entity;
109
+ setString(key: string, value: string): void;
110
+ setI32(key: string, value: number): void;
111
+ setBigInt(key: string, value: BigInt): void;
112
+ setBytes(key: string, value: Bytes): void;
113
+ setBoolean(key: string, value: boolean): void;
114
+ setBigDecimal(key: string, value: BigDecimal): void;
115
+ getString(key: string): string;
116
+ getI32(key: string): number;
117
+ getBigInt(key: string): BigInt;
118
+ getBytes(key: string): Bytes;
119
+ getBoolean(key: string): boolean;
120
+ getBigDecimal(key: string): BigDecimal;
121
+ }
122
+ /**
123
+ * The result of an operation, with a corresponding value and error type.
124
+ */
125
+ export declare class Result<V, E> {
126
+ _value: Wrapped<V> | null;
127
+ _error: Wrapped<E> | null;
128
+ get isOk(): boolean;
129
+ get isError(): boolean;
130
+ get value(): V;
131
+ get error(): E;
132
+ }
133
+ export declare class Wrapped<T> {
134
+ inner: T;
135
+ constructor(inner: T);
136
+ }
@@ -0,0 +1,11 @@
1
+ import './eager-offset';
2
+ import { Bytes } from './collections';
3
+ /** Host type conversion interface */
4
+ export declare namespace typeConversion {
5
+ function bytesToString(bytes: Uint8Array): string;
6
+ function bytesToHex(bytes: Uint8Array): string;
7
+ function bigIntToString(bigInt: Uint8Array): string;
8
+ function bigIntToHex(bigInt: Uint8Array): string;
9
+ function stringToH160(s: string): Bytes;
10
+ function bytesToBase58(n: Uint8Array): string;
11
+ }
@@ -0,0 +1,30 @@
1
+ import './eager-offset';
2
+ import { Entity } from './collections';
3
+ import { Address } from './numbers';
4
+ /** Host interface for managing data sources */
5
+ export declare namespace dataSource {
6
+ function create(name: string, params: Array<string>): void;
7
+ function createWithContext(name: string, params: Array<string>, context: DataSourceContext): void;
8
+ function address(): Address;
9
+ function network(): string;
10
+ function context(): DataSourceContext;
11
+ }
12
+ export declare namespace dataSource {
13
+ function stringParam(): string;
14
+ }
15
+ /** Context for dynamic data sources */
16
+ export declare class DataSourceContext extends Entity {
17
+ }
18
+ /**
19
+ * Base class for data source templates. Allows to dynamically create
20
+ * data sources from templates at runtime.
21
+ */
22
+ export declare class DataSourceTemplate {
23
+ /**
24
+ * Dynamically creates a data source from the template with the
25
+ * given name, using the parameter strings to configure the new
26
+ * data source.
27
+ */
28
+ static create(name: string, params: Array<string>): void;
29
+ static createWithContext(name: string, params: Array<string>, context: DataSourceContext): void;
30
+ }
@@ -0,0 +1,17 @@
1
+ import './eager-offset';
2
+ import { Bytes, Result } from './collections';
3
+ import { BigInt } from './numbers';
4
+ import { JSONValue } from './value';
5
+ /** Host JSON interface */
6
+ export declare namespace json {
7
+ function fromBytes(data: Bytes): JSONValue;
8
+ function try_fromBytes(data: Bytes): Result<JSONValue, boolean>;
9
+ function toI64(decimal: string): bigint;
10
+ function toU64(decimal: string): bigint;
11
+ function toF64(decimal: string): number;
12
+ function toBigInt(decimal: string): BigInt;
13
+ }
14
+ export declare namespace json {
15
+ function fromString(data: string): JSONValue;
16
+ function try_fromString(data: string): Result<JSONValue, boolean>;
17
+ }
@@ -0,0 +1,120 @@
1
+ import './eager-offset';
2
+ import { ByteArray, Bytes } from './collections';
3
+ /** Host interface for BigInt arithmetic */
4
+ export declare namespace bigInt {
5
+ function plus(x: BigInt, y: BigInt): BigInt;
6
+ function minus(x: BigInt, y: BigInt): BigInt;
7
+ function times(x: BigInt, y: BigInt): BigInt;
8
+ function dividedBy(x: BigInt, y: BigInt): BigInt;
9
+ function dividedByDecimal(x: BigInt, y: BigDecimal): BigDecimal;
10
+ function mod(x: BigInt, y: BigInt): BigInt;
11
+ function pow(x: BigInt, exp: number): BigInt;
12
+ function fromString(s: string): BigInt;
13
+ function bitOr(x: BigInt, y: BigInt): BigInt;
14
+ function bitAnd(x: BigInt, y: BigInt): BigInt;
15
+ function leftShift(x: BigInt, bits: number): BigInt;
16
+ function rightShift(x: BigInt, bits: number): BigInt;
17
+ }
18
+ /** Host interface for BigDecimal */
19
+ export declare namespace bigDecimal {
20
+ function plus(x: BigDecimal, y: BigDecimal): BigDecimal;
21
+ function minus(x: BigDecimal, y: BigDecimal): BigDecimal;
22
+ function times(x: BigDecimal, y: BigDecimal): BigDecimal;
23
+ function dividedBy(x: BigDecimal, y: BigDecimal): BigDecimal;
24
+ function equals(x: BigDecimal, y: BigDecimal): boolean;
25
+ function toString(bigDecimal: BigDecimal): string;
26
+ function fromString(s: string): BigDecimal;
27
+ }
28
+ export type Int8 = bigint;
29
+ export type Timestamp = bigint;
30
+ /** An Ethereum address (20 bytes). */
31
+ export declare class Address extends Bytes {
32
+ static fromString(s: string): Address;
33
+ /** Convert `Bytes` that must be exactly 20 bytes long to an address.
34
+ * Passing in a value with fewer or more bytes will result in an error */
35
+ static fromBytes(b: Bytes): Address;
36
+ static zero(): Address;
37
+ }
38
+ /** An arbitrary size integer represented as an array of bytes. */
39
+ export declare class BigInt extends Uint8Array {
40
+ static fromI32(x: number): BigInt;
41
+ static fromU32(x: number): BigInt;
42
+ static fromI64(x: bigint): BigInt;
43
+ static fromU64(x: bigint): BigInt;
44
+ static zero(): BigInt;
45
+ /**
46
+ * `bytes` assumed to be little-endian. If your input is big-endian, call `.reverse()` first.
47
+ */
48
+ static fromSignedBytes(bytes: Bytes): BigInt;
49
+ static fromByteArray(byteArray: ByteArray): BigInt;
50
+ /**
51
+ * `bytes` assumed to be little-endian. If your input is big-endian, call `.reverse()` first.
52
+ */
53
+ static fromUnsignedBytes(bytes: ByteArray): BigInt;
54
+ toHex(): string;
55
+ toHexString(): string;
56
+ toString(): string;
57
+ static fromString(s: string): BigInt;
58
+ toI32(): number;
59
+ toU32(): number;
60
+ toI64(): bigint;
61
+ toU64(): bigint;
62
+ toBigDecimal(): BigDecimal;
63
+ isZero(): boolean;
64
+ isI32(): boolean;
65
+ abs(): BigInt;
66
+ sqrt(): BigInt;
67
+ plus(other: BigInt): BigInt;
68
+ minus(other: BigInt): BigInt;
69
+ times(other: BigInt): BigInt;
70
+ div(other: BigInt): BigInt;
71
+ divDecimal(other: BigDecimal): BigDecimal;
72
+ mod(other: BigInt): BigInt;
73
+ equals(other: BigInt): boolean;
74
+ notEqual(other: BigInt): boolean;
75
+ lt(other: BigInt): boolean;
76
+ gt(other: BigInt): boolean;
77
+ le(other: BigInt): boolean;
78
+ ge(other: BigInt): boolean;
79
+ neg(): BigInt;
80
+ bitOr(other: BigInt): BigInt;
81
+ bitAnd(other: BigInt): BigInt;
82
+ leftShift(bits: number): BigInt;
83
+ rightShift(bits: number): BigInt;
84
+ pow(exp: number): BigInt;
85
+ /**
86
+ * Returns −1 if a < b, 1 if a > b, and 0 if A == B
87
+ */
88
+ static compare(a: BigInt, b: BigInt): number;
89
+ }
90
+ export declare class BigDecimal {
91
+ digits: BigInt;
92
+ exp: BigInt;
93
+ constructor(bigInt: BigInt);
94
+ static fromString(s: string): BigDecimal;
95
+ static zero(): BigDecimal;
96
+ toString(): string;
97
+ truncate(decimals: number): BigDecimal;
98
+ plus(other: BigDecimal): BigDecimal;
99
+ minus(other: BigDecimal): BigDecimal;
100
+ times(other: BigDecimal): BigDecimal;
101
+ div(other: BigDecimal): BigDecimal;
102
+ equals(other: BigDecimal): boolean;
103
+ notEqual(other: BigDecimal): boolean;
104
+ lt(other: BigDecimal): boolean;
105
+ gt(other: BigDecimal): boolean;
106
+ le(other: BigDecimal): boolean;
107
+ ge(other: BigDecimal): boolean;
108
+ neg(): BigDecimal;
109
+ /**
110
+ * Returns −1 if a < b, 1 if a > b, and 0 if A == B
111
+ */
112
+ static compare(a: BigDecimal, b: BigDecimal): number;
113
+ }
114
+ /** A type representing Starknet's field element type. */
115
+ export declare class Felt extends Bytes {
116
+ /**
117
+ * Modifies and transforms the object IN-PLACE into `BigInt`.
118
+ */
119
+ intoBigInt(): BigInt;
120
+ }