@alephium/web3 0.9.0-rc.0 → 0.9.0-rc.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/dist/alephium-web3.min.js +3 -0
- package/dist/alephium-web3.min.js.LICENSE.txt +12 -0
- package/dist/alephium-web3.min.js.map +1 -0
- package/dist/scripts/check-versions.d.ts +1 -0
- package/dist/scripts/check-versions.js +39 -0
- package/dist/scripts/header.d.ts +0 -0
- package/dist/scripts/header.js +18 -0
- package/dist/src/api/api-alephium.d.ts +1717 -0
- package/dist/src/api/api-alephium.js +1284 -0
- package/dist/src/api/api-explorer.d.ts +923 -0
- package/dist/src/api/api-explorer.js +711 -0
- package/dist/src/api/explorer-provider.d.ts +20 -0
- package/dist/src/api/explorer-provider.js +69 -0
- package/dist/src/api/index.d.ts +6 -0
- package/dist/src/api/index.js +52 -0
- package/dist/src/api/node-provider.d.ts +38 -0
- package/dist/src/api/node-provider.js +99 -0
- package/dist/src/api/types.d.ts +38 -0
- package/dist/src/api/types.js +259 -0
- package/dist/src/api/utils.d.ts +12 -0
- package/dist/src/api/utils.js +59 -0
- package/dist/src/constants.d.ts +6 -0
- package/dist/src/constants.js +26 -0
- package/dist/src/contract/contract.d.ts +297 -0
- package/dist/src/contract/contract.js +1097 -0
- package/dist/src/contract/events.d.ts +11 -0
- package/dist/src/contract/events.js +65 -0
- package/dist/src/contract/index.d.ts +3 -0
- package/dist/src/contract/index.js +36 -0
- package/dist/src/contract/ralph.d.ts +13 -0
- package/dist/src/contract/ralph.js +397 -0
- package/dist/src/global.d.ts +7 -0
- package/dist/src/global.js +54 -0
- package/dist/src/index.d.ts +9 -0
- package/dist/src/index.js +58 -0
- package/dist/src/signer/index.d.ts +3 -0
- package/dist/src/signer/index.js +36 -0
- package/dist/src/signer/signer.d.ts +60 -0
- package/dist/src/signer/signer.js +236 -0
- package/dist/src/signer/tx-builder.d.ts +12 -0
- package/dist/src/signer/tx-builder.js +96 -0
- package/dist/src/signer/types.d.ts +115 -0
- package/dist/src/signer/types.js +30 -0
- package/dist/src/token/index.d.ts +1 -0
- package/dist/src/token/index.js +34 -0
- package/dist/src/token/nft.d.ts +10 -0
- package/dist/src/token/nft.js +19 -0
- package/dist/src/transaction/index.d.ts +2 -0
- package/dist/src/transaction/index.js +35 -0
- package/dist/src/transaction/sign-verify.d.ts +3 -0
- package/dist/src/transaction/sign-verify.js +52 -0
- package/dist/src/transaction/status.d.ts +11 -0
- package/dist/src/transaction/status.js +49 -0
- package/dist/src/utils/address.d.ts +1 -0
- package/dist/src/utils/address.js +42 -0
- package/dist/src/utils/bs58.d.ts +5 -0
- package/dist/src/utils/bs58.js +40 -0
- package/dist/src/utils/djb2.d.ts +1 -0
- package/dist/src/utils/djb2.js +27 -0
- package/dist/src/utils/index.d.ts +7 -0
- package/dist/src/utils/index.js +40 -0
- package/dist/src/utils/number.d.ts +18 -0
- package/dist/src/utils/number.fixture.d.ts +12 -0
- package/dist/src/utils/number.fixture.js +189 -0
- package/dist/src/utils/number.js +149 -0
- package/dist/src/utils/sign.d.ts +3 -0
- package/dist/src/utils/sign.js +89 -0
- package/dist/src/utils/subscription.d.ts +21 -0
- package/dist/src/utils/subscription.js +51 -0
- package/dist/src/utils/utils.d.ts +40 -0
- package/dist/src/utils/utils.js +244 -0
- package/package.json +1 -1
- package/LICENSE +0 -165
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/*
|
|
3
|
+
Copyright 2018 - 2022 The Alephium Authors
|
|
4
|
+
This file is part of the alephium project.
|
|
5
|
+
|
|
6
|
+
The library is free software: you can redistribute it and/or modify
|
|
7
|
+
it under the terms of the GNU Lesser General Public License as published by
|
|
8
|
+
the Free Software Foundation, either version 3 of the License, or
|
|
9
|
+
(at your option) any later version.
|
|
10
|
+
|
|
11
|
+
The library is distributed in the hope that it will be useful,
|
|
12
|
+
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
13
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
14
|
+
GNU Lesser General Public License for more details.
|
|
15
|
+
|
|
16
|
+
You should have received a copy of the GNU Lesser General Public License
|
|
17
|
+
along with the library. If not, see <http://www.gnu.org/licenses/>.
|
|
18
|
+
*/
|
|
19
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
+
exports.DUST_AMOUNT = exports.ONE_ALPH = exports.ALPH_TOKEN_ID = exports.MIN_UTXO_SET_AMOUNT = exports.TOTAL_NUMBER_OF_CHAINS = exports.TOTAL_NUMBER_OF_GROUPS = void 0;
|
|
21
|
+
exports.TOTAL_NUMBER_OF_GROUPS = 4;
|
|
22
|
+
exports.TOTAL_NUMBER_OF_CHAINS = exports.TOTAL_NUMBER_OF_GROUPS * exports.TOTAL_NUMBER_OF_GROUPS;
|
|
23
|
+
exports.MIN_UTXO_SET_AMOUNT = BigInt(1000000000000);
|
|
24
|
+
exports.ALPH_TOKEN_ID = ''.padStart(64, '0');
|
|
25
|
+
exports.ONE_ALPH = 10n ** 18n;
|
|
26
|
+
exports.DUST_AMOUNT = 10n ** 15n;
|
|
@@ -0,0 +1,297 @@
|
|
|
1
|
+
import { NamedVals, node, Number256, Token } from '../api';
|
|
2
|
+
import { SignDeployContractTxParams, SignDeployContractTxResult, SignExecuteScriptTxParams, SignerProvider, Address } from '../signer';
|
|
3
|
+
import { SubscribeOptions, Optional } from '../utils';
|
|
4
|
+
import { EventSubscription } from './events';
|
|
5
|
+
export type FieldsSig = node.FieldsSig;
|
|
6
|
+
export type EventSig = node.EventSig;
|
|
7
|
+
export type FunctionSig = node.FunctionSig;
|
|
8
|
+
export type Fields = NamedVals;
|
|
9
|
+
export type Arguments = NamedVals;
|
|
10
|
+
export type HexString = string;
|
|
11
|
+
export declare const StdIdFieldName = "__stdInterfaceId";
|
|
12
|
+
declare enum SourceKind {
|
|
13
|
+
Contract = 0,
|
|
14
|
+
Script = 1,
|
|
15
|
+
AbstractContract = 2,
|
|
16
|
+
Interface = 3
|
|
17
|
+
}
|
|
18
|
+
export type CompilerOptions = node.CompilerOptions & {
|
|
19
|
+
errorOnWarnings: boolean;
|
|
20
|
+
};
|
|
21
|
+
export declare const DEFAULT_NODE_COMPILER_OPTIONS: node.CompilerOptions;
|
|
22
|
+
export declare const DEFAULT_COMPILER_OPTIONS: CompilerOptions;
|
|
23
|
+
declare class TypedMatcher<T extends SourceKind> {
|
|
24
|
+
matcher: RegExp;
|
|
25
|
+
type: T;
|
|
26
|
+
constructor(pattern: string, type: T);
|
|
27
|
+
}
|
|
28
|
+
declare class SourceInfo {
|
|
29
|
+
type: SourceKind;
|
|
30
|
+
name: string;
|
|
31
|
+
contractRelativePath: string;
|
|
32
|
+
sourceCode: string;
|
|
33
|
+
sourceCodeHash: string;
|
|
34
|
+
isExternal: boolean;
|
|
35
|
+
getArtifactPath(artifactsRootDir: string): string;
|
|
36
|
+
constructor(type: SourceKind, name: string, sourceCode: string, sourceCodeHash: string, contractRelativePath: string, isExternal: boolean);
|
|
37
|
+
static from(type: SourceKind, name: string, sourceCode: string, contractRelativePath: string, isExternal: boolean): Promise<SourceInfo>;
|
|
38
|
+
}
|
|
39
|
+
declare class Compiled<T extends Artifact> {
|
|
40
|
+
sourceInfo: SourceInfo;
|
|
41
|
+
artifact: T;
|
|
42
|
+
warnings: string[];
|
|
43
|
+
constructor(sourceInfo: SourceInfo, artifact: T, warnings: string[]);
|
|
44
|
+
}
|
|
45
|
+
type CodeInfo = {
|
|
46
|
+
sourceFile: string;
|
|
47
|
+
sourceCodeHash: string;
|
|
48
|
+
bytecodeDebugPatch: string;
|
|
49
|
+
codeHashDebug: string;
|
|
50
|
+
warnings: string[];
|
|
51
|
+
};
|
|
52
|
+
declare class ProjectArtifact {
|
|
53
|
+
static readonly artifactFileName = ".project.json";
|
|
54
|
+
compilerOptionsUsed: node.CompilerOptions;
|
|
55
|
+
infos: Map<string, CodeInfo>;
|
|
56
|
+
static checkCompilerOptionsParameter(compilerOptions: node.CompilerOptions): void;
|
|
57
|
+
constructor(compilerOptionsUsed: node.CompilerOptions, infos: Map<string, CodeInfo>);
|
|
58
|
+
saveToFile(rootPath: string): Promise<void>;
|
|
59
|
+
needToReCompile(compilerOptions: node.CompilerOptions, sourceInfos: SourceInfo[]): boolean;
|
|
60
|
+
static from(rootPath: string): Promise<ProjectArtifact | undefined>;
|
|
61
|
+
}
|
|
62
|
+
export declare class Project {
|
|
63
|
+
sourceInfos: SourceInfo[];
|
|
64
|
+
contracts: Map<string, Compiled<Contract>>;
|
|
65
|
+
scripts: Map<string, Compiled<Script>>;
|
|
66
|
+
projectArtifact: ProjectArtifact;
|
|
67
|
+
readonly contractsRootDir: string;
|
|
68
|
+
readonly artifactsRootDir: string;
|
|
69
|
+
static currentProject: Project;
|
|
70
|
+
static readonly importRegex: RegExp;
|
|
71
|
+
static readonly abstractContractMatcher: TypedMatcher<SourceKind>;
|
|
72
|
+
static readonly contractMatcher: TypedMatcher<SourceKind.Contract>;
|
|
73
|
+
static readonly interfaceMatcher: TypedMatcher<SourceKind.Interface>;
|
|
74
|
+
static readonly scriptMatcher: TypedMatcher<SourceKind.Script>;
|
|
75
|
+
static readonly matchers: TypedMatcher<SourceKind>[];
|
|
76
|
+
static buildProjectArtifact(sourceInfos: SourceInfo[], contracts: Map<string, Compiled<Contract>>, scripts: Map<string, Compiled<Script>>, compilerOptions: node.CompilerOptions): ProjectArtifact;
|
|
77
|
+
private constructor();
|
|
78
|
+
static checkCompilerWarnings(warnings: string[], errorOnWarnings: boolean): void;
|
|
79
|
+
static contract(name: string): Contract;
|
|
80
|
+
static script(name: string): Script;
|
|
81
|
+
private saveArtifactsToFile;
|
|
82
|
+
contractByCodeHash(codeHash: string): Contract;
|
|
83
|
+
private static compile;
|
|
84
|
+
private static loadArtifacts;
|
|
85
|
+
private static getImportSourcePath;
|
|
86
|
+
private static handleImports;
|
|
87
|
+
private static loadSourceFile;
|
|
88
|
+
private static loadSourceFiles;
|
|
89
|
+
static readonly DEFAULT_CONTRACTS_DIR = "contracts";
|
|
90
|
+
static readonly DEFAULT_ARTIFACTS_DIR = "artifacts";
|
|
91
|
+
static build(compilerOptionsPartial?: Partial<CompilerOptions>, projectRootDir?: string, contractsRootDir?: string, artifactsRootDir?: string): Promise<void>;
|
|
92
|
+
}
|
|
93
|
+
export declare abstract class Artifact {
|
|
94
|
+
readonly version: string;
|
|
95
|
+
readonly name: string;
|
|
96
|
+
readonly functions: FunctionSig[];
|
|
97
|
+
constructor(version: string, name: string, functions: FunctionSig[]);
|
|
98
|
+
abstract buildByteCodeToDeploy(initialFields?: Fields): string;
|
|
99
|
+
publicFunctions(): string[];
|
|
100
|
+
usingPreapprovedAssetsFunctions(): string[];
|
|
101
|
+
usingAssetsInContractFunctions(): string[];
|
|
102
|
+
}
|
|
103
|
+
export declare class Contract extends Artifact {
|
|
104
|
+
readonly bytecode: string;
|
|
105
|
+
readonly bytecodeDebugPatch: string;
|
|
106
|
+
readonly codeHash: string;
|
|
107
|
+
readonly fieldsSig: FieldsSig;
|
|
108
|
+
readonly eventsSig: EventSig[];
|
|
109
|
+
readonly stdInterfaceId?: HexString;
|
|
110
|
+
readonly bytecodeDebug: string;
|
|
111
|
+
readonly codeHashDebug: string;
|
|
112
|
+
constructor(version: string, name: string, bytecode: string, bytecodeDebugPatch: string, codeHash: string, codeHashDebug: string, fieldsSig: FieldsSig, eventsSig: EventSig[], functions: FunctionSig[], stdInterfaceId?: HexString);
|
|
113
|
+
static fromJson(artifact: any, bytecodeDebugPatch?: string, codeHashDebug?: string): Contract;
|
|
114
|
+
static fromCompileResult(result: node.CompileContractResult): Contract;
|
|
115
|
+
static fromArtifactFile(path: string, bytecodeDebugPatch: string, codeHashDebug: string): Promise<Contract>;
|
|
116
|
+
toString(): string;
|
|
117
|
+
toState<T extends Fields>(fields: T, asset: Asset, address?: string): ContractState<T>;
|
|
118
|
+
static randomAddress(): string;
|
|
119
|
+
printDebugMessages(funcName: string, messages: DebugMessage[]): void;
|
|
120
|
+
toApiFields(fields?: Fields): node.Val[];
|
|
121
|
+
toApiArgs(funcName: string, args?: Arguments): node.Val[];
|
|
122
|
+
getMethodIndex(funcName: string): number;
|
|
123
|
+
toApiContractStates(states?: ContractState[]): node.ContractState[] | undefined;
|
|
124
|
+
toApiTestContractParams(funcName: string, params: TestContractParams): node.TestContract;
|
|
125
|
+
fromApiContractState(state: node.ContractState): ContractState<Fields>;
|
|
126
|
+
static fromApiContractState(state: node.ContractState): ContractState;
|
|
127
|
+
static ContractCreatedEventIndex: number;
|
|
128
|
+
static ContractCreatedEvent: EventSig;
|
|
129
|
+
static ContractDestroyedEventIndex: number;
|
|
130
|
+
static ContractDestroyedEvent: EventSig;
|
|
131
|
+
static fromApiEvent(event: node.ContractEventByTxId, codeHash: string | undefined, txId: string): ContractEvent;
|
|
132
|
+
fromApiTestContractResult(methodName: string, result: node.TestContractResult, txId: string): TestContractResult<unknown>;
|
|
133
|
+
txParamsForDeployment<P extends Fields>(signer: SignerProvider, params: DeployContractParams<P>): Promise<SignDeployContractTxParams>;
|
|
134
|
+
buildByteCodeToDeploy(initialFields: Fields): string;
|
|
135
|
+
static fromApiEvents(events: node.ContractEventByTxId[], addressToCodeHash: Map<string, string>, txId: string): ContractEvent[];
|
|
136
|
+
toApiCallContract<T extends Arguments>(params: CallContractParams<T>, groupIndex: number, contractAddress: string, methodIndex: number): node.CallContract;
|
|
137
|
+
fromApiCallContractResult(result: node.CallContractResult, txId: string, methodIndex: number): CallContractResult<unknown>;
|
|
138
|
+
}
|
|
139
|
+
export declare class Script extends Artifact {
|
|
140
|
+
readonly bytecodeTemplate: string;
|
|
141
|
+
readonly bytecodeDebugPatch: string;
|
|
142
|
+
readonly fieldsSig: FieldsSig;
|
|
143
|
+
constructor(version: string, name: string, bytecodeTemplate: string, bytecodeDebugPatch: string, fieldsSig: FieldsSig, functions: FunctionSig[]);
|
|
144
|
+
static fromCompileResult(result: node.CompileScriptResult): Script;
|
|
145
|
+
static fromJson(artifact: any, bytecodeDebugPatch?: string): Script;
|
|
146
|
+
static fromArtifactFile(path: string, bytecodeDebugPatch: string): Promise<Script>;
|
|
147
|
+
toString(): string;
|
|
148
|
+
txParamsForExecution<P extends Fields>(signer: SignerProvider, params: ExecuteScriptParams<P>): Promise<SignExecuteScriptTxParams>;
|
|
149
|
+
buildByteCodeToDeploy(initialFields: Fields): string;
|
|
150
|
+
}
|
|
151
|
+
export interface Asset {
|
|
152
|
+
alphAmount: Number256;
|
|
153
|
+
tokens?: Token[];
|
|
154
|
+
}
|
|
155
|
+
export interface InputAsset {
|
|
156
|
+
address: string;
|
|
157
|
+
asset: Asset;
|
|
158
|
+
}
|
|
159
|
+
export interface ContractState<T extends Fields = Fields> {
|
|
160
|
+
address: string;
|
|
161
|
+
contractId: string;
|
|
162
|
+
bytecode: string;
|
|
163
|
+
initialStateHash?: string;
|
|
164
|
+
codeHash: string;
|
|
165
|
+
fields: T;
|
|
166
|
+
fieldsSig: FieldsSig;
|
|
167
|
+
asset: Asset;
|
|
168
|
+
}
|
|
169
|
+
export declare function toApiVals(fields: Fields, names: string[], types: string[]): node.Val[];
|
|
170
|
+
export interface TestContractParams<F extends Fields = Fields, A extends Arguments = Arguments> {
|
|
171
|
+
group?: number;
|
|
172
|
+
address?: string;
|
|
173
|
+
blockHash?: string;
|
|
174
|
+
blockTimeStamp?: number;
|
|
175
|
+
txId?: string;
|
|
176
|
+
initialFields: F;
|
|
177
|
+
initialAsset?: Asset;
|
|
178
|
+
testArgs: A;
|
|
179
|
+
existingContracts?: ContractState[];
|
|
180
|
+
inputAssets?: InputAsset[];
|
|
181
|
+
}
|
|
182
|
+
export interface ContractEvent<T extends Fields = Fields> {
|
|
183
|
+
txId: string;
|
|
184
|
+
blockHash: string;
|
|
185
|
+
contractAddress: string;
|
|
186
|
+
eventIndex: number;
|
|
187
|
+
name: string;
|
|
188
|
+
fields: T;
|
|
189
|
+
}
|
|
190
|
+
export type DebugMessage = node.DebugMessage;
|
|
191
|
+
export interface TestContractResult<R> {
|
|
192
|
+
contractId: string;
|
|
193
|
+
contractAddress: string;
|
|
194
|
+
returns: R;
|
|
195
|
+
gasUsed: number;
|
|
196
|
+
contracts: ContractState[];
|
|
197
|
+
txOutputs: Output[];
|
|
198
|
+
events: ContractEvent[];
|
|
199
|
+
debugMessages: DebugMessage[];
|
|
200
|
+
}
|
|
201
|
+
export declare type Output = AssetOutput | ContractOutput;
|
|
202
|
+
export interface AssetOutput extends Asset {
|
|
203
|
+
type: string;
|
|
204
|
+
address: string;
|
|
205
|
+
lockTime: number;
|
|
206
|
+
message: string;
|
|
207
|
+
}
|
|
208
|
+
export interface ContractOutput {
|
|
209
|
+
type: string;
|
|
210
|
+
address: string;
|
|
211
|
+
alphAmount: Number256;
|
|
212
|
+
tokens?: Token[];
|
|
213
|
+
}
|
|
214
|
+
export declare function randomTxId(): string;
|
|
215
|
+
export interface DeployContractParams<P extends Fields = Fields> {
|
|
216
|
+
initialFields: P;
|
|
217
|
+
initialAttoAlphAmount?: Number256;
|
|
218
|
+
initialTokenAmounts?: Token[];
|
|
219
|
+
issueTokenAmount?: Number256;
|
|
220
|
+
gasAmount?: number;
|
|
221
|
+
gasPrice?: Number256;
|
|
222
|
+
}
|
|
223
|
+
export type DeployContractResult<T> = SignDeployContractTxResult & {
|
|
224
|
+
instance: T;
|
|
225
|
+
};
|
|
226
|
+
export declare abstract class ContractFactory<I, F extends Fields = Fields> {
|
|
227
|
+
readonly contract: Contract;
|
|
228
|
+
constructor(contract: Contract);
|
|
229
|
+
abstract at(address: string): I;
|
|
230
|
+
deploy(signer: SignerProvider, deployParams: DeployContractParams<F>): Promise<DeployContractResult<I>>;
|
|
231
|
+
stateForTest(initFields: F, asset?: Asset, address?: string): ContractState<F>;
|
|
232
|
+
}
|
|
233
|
+
export interface ExecuteScriptParams<P extends Fields = Fields> {
|
|
234
|
+
initialFields: P;
|
|
235
|
+
attoAlphAmount?: Number256;
|
|
236
|
+
tokens?: Token[];
|
|
237
|
+
gasAmount?: number;
|
|
238
|
+
gasPrice?: Number256;
|
|
239
|
+
}
|
|
240
|
+
export interface ExecuteScriptResult {
|
|
241
|
+
groupIndex: number;
|
|
242
|
+
unsignedTx: string;
|
|
243
|
+
txId: string;
|
|
244
|
+
signature: string;
|
|
245
|
+
gasAmount: number;
|
|
246
|
+
gasPrice: Number256;
|
|
247
|
+
}
|
|
248
|
+
export interface CallContractParams<T extends Arguments = Arguments> {
|
|
249
|
+
args: T;
|
|
250
|
+
worldStateBlockHash?: string;
|
|
251
|
+
txId?: string;
|
|
252
|
+
existingContracts?: string[];
|
|
253
|
+
inputAssets?: node.TestInputAsset[];
|
|
254
|
+
}
|
|
255
|
+
export interface CallContractResult<R> {
|
|
256
|
+
returns: R;
|
|
257
|
+
gasUsed: number;
|
|
258
|
+
contracts: ContractState[];
|
|
259
|
+
txInputs: string[];
|
|
260
|
+
txOutputs: Output[];
|
|
261
|
+
events: ContractEvent[];
|
|
262
|
+
}
|
|
263
|
+
export declare const CreateContractEventAddress: string;
|
|
264
|
+
export declare const DestroyContractEventAddress: string;
|
|
265
|
+
export type ContractCreatedEventFields = {
|
|
266
|
+
address: Address;
|
|
267
|
+
parentAddress?: Address;
|
|
268
|
+
stdInterfaceIdGuessed?: HexString;
|
|
269
|
+
};
|
|
270
|
+
export type ContractDestroyedEventFields = {
|
|
271
|
+
address: Address;
|
|
272
|
+
};
|
|
273
|
+
export type ContractCreatedEvent = ContractEvent<ContractCreatedEventFields>;
|
|
274
|
+
export type ContractDestroyedEvent = ContractEvent<ContractDestroyedEventFields>;
|
|
275
|
+
export declare function decodeContractCreatedEvent(event: node.ContractEvent): Omit<ContractCreatedEvent, 'contractAddress'>;
|
|
276
|
+
export declare function decodeContractDestroyedEvent(event: node.ContractEvent): Omit<ContractDestroyedEvent, 'contractAddress'>;
|
|
277
|
+
export declare function subscribeEventsFromContract<T extends Fields, M extends ContractEvent<T>>(options: SubscribeOptions<M>, address: string, eventIndex: number, decodeFunc: (event: node.ContractEvent) => M, fromCount?: number): EventSubscription;
|
|
278
|
+
export declare function addStdIdToFields<F extends Fields>(contract: Contract, fields: F): F | (F & {
|
|
279
|
+
__stdInterfaceId: HexString;
|
|
280
|
+
});
|
|
281
|
+
export declare function testMethod<I, F extends Fields, A extends Arguments, R>(contract: ContractFactory<I, F>, methodName: string, params: Optional<TestContractParams<F, A>, 'testArgs' | 'initialFields'>): Promise<TestContractResult<R>>;
|
|
282
|
+
export declare abstract class ContractInstance {
|
|
283
|
+
readonly address: Address;
|
|
284
|
+
readonly contractId: string;
|
|
285
|
+
readonly groupIndex: number;
|
|
286
|
+
constructor(address: Address);
|
|
287
|
+
}
|
|
288
|
+
export declare function fetchContractState<F extends Fields, I extends ContractInstance>(contract: ContractFactory<I, F>, instance: ContractInstance): Promise<ContractState<F>>;
|
|
289
|
+
export declare function subscribeContractCreatedEvent(options: SubscribeOptions<ContractCreatedEvent>, fromCount?: number): EventSubscription;
|
|
290
|
+
export declare function subscribeContractDestroyedEvent(options: SubscribeOptions<ContractDestroyedEvent>, fromCount?: number): EventSubscription;
|
|
291
|
+
export declare function decodeEvent<F extends Fields, M extends ContractEvent<F>>(contract: Contract, instance: ContractInstance, event: node.ContractEvent, targetEventIndex: number): M;
|
|
292
|
+
export declare function subscribeContractEvent<F extends Fields, M extends ContractEvent<F>>(contract: Contract, instance: ContractInstance, options: SubscribeOptions<M>, eventName: string, fromCount?: number): EventSubscription;
|
|
293
|
+
export declare function subscribeContractEvents(contract: Contract, instance: ContractInstance, options: SubscribeOptions<ContractEvent<any>>, fromCount?: number): EventSubscription;
|
|
294
|
+
export declare function callMethod<I, F extends Fields, A extends Arguments, R>(contract: ContractFactory<I, F>, instance: ContractInstance, methodName: string, params: Optional<CallContractParams<A>, 'args'>): Promise<CallContractResult<R>>;
|
|
295
|
+
export declare function multicallMethods<I, F extends Fields>(contract: ContractFactory<I, F>, instance: ContractInstance, calls: Record<string, Optional<CallContractParams<any>, 'args'>>): Promise<Record<string, CallContractResult<any>>>;
|
|
296
|
+
export declare function getContractEventsCurrentCount(contractAddress: Address): Promise<number>;
|
|
297
|
+
export {};
|