@alephium/web3 0.5.0-rc.0 → 0.5.0-rc.10
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 +1 -1
- package/dist/alephium-web3.min.js.LICENSE.txt +2 -0
- package/dist/alephium-web3.min.js.map +1 -1
- package/dist/src/api/api-alephium.d.ts +57 -20
- package/dist/src/api/api-alephium.js +57 -15
- package/dist/src/api/index.d.ts +1 -0
- package/dist/src/api/index.js +1 -0
- package/dist/src/api/types.d.ts +1 -1
- package/dist/src/api/types.js +6 -2
- package/dist/src/constants.d.ts +1 -0
- package/dist/src/constants.js +2 -1
- package/dist/src/contract/contract.d.ts +37 -17
- package/dist/src/contract/contract.js +167 -19
- package/dist/src/signer/signer.d.ts +29 -30
- package/dist/src/signer/signer.js +34 -25
- package/dist/src/signer/tx-builder.d.ts +2 -7
- package/dist/src/signer/tx-builder.js +10 -7
- package/dist/src/signer/types.d.ts +8 -0
- package/dist/src/transaction/sign-verify.d.ts +3 -2
- package/dist/src/transaction/sign-verify.js +4 -14
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/index.js +1 -0
- package/dist/src/utils/sign.d.ts +3 -0
- package/dist/src/utils/sign.js +89 -0
- package/dist/src/utils/utils.d.ts +5 -3
- package/dist/src/utils/utils.js +25 -10
- package/package.json +3 -2
- package/src/api/api-alephium.ts +88 -32
- package/src/api/index.ts +2 -0
- package/src/api/types.ts +12 -2
- package/src/constants.ts +1 -0
- package/src/contract/contract.ts +288 -38
- package/src/signer/signer.ts +69 -55
- package/src/signer/tx-builder.ts +13 -7
- package/src/signer/types.ts +10 -2
- package/src/transaction/sign-verify.ts +10 -15
- package/src/utils/index.ts +1 -0
- package/src/utils/sign.ts +66 -0
- package/src/utils/utils.ts +27 -10
|
@@ -145,9 +145,11 @@ export interface BrokerInfo {
|
|
|
145
145
|
};
|
|
146
146
|
}
|
|
147
147
|
export interface BuildDeployContractTx {
|
|
148
|
-
/** @format
|
|
148
|
+
/** @format hex-string */
|
|
149
149
|
fromPublicKey: string;
|
|
150
150
|
/** @format hex-string */
|
|
151
|
+
fromPublicKeyType?: string;
|
|
152
|
+
/** @format hex-string */
|
|
151
153
|
bytecode: string;
|
|
152
154
|
/** @format uint256 */
|
|
153
155
|
initialAttoAlphAmount?: string;
|
|
@@ -177,9 +179,11 @@ export interface BuildDeployContractTxResult {
|
|
|
177
179
|
contractAddress: string;
|
|
178
180
|
}
|
|
179
181
|
export interface BuildExecuteScriptTx {
|
|
180
|
-
/** @format
|
|
182
|
+
/** @format hex-string */
|
|
181
183
|
fromPublicKey: string;
|
|
182
184
|
/** @format hex-string */
|
|
185
|
+
fromPublicKeyType?: string;
|
|
186
|
+
/** @format hex-string */
|
|
183
187
|
bytecode: string;
|
|
184
188
|
/** @format uint256 */
|
|
185
189
|
attoAlphAmount?: string;
|
|
@@ -249,8 +253,10 @@ export interface BuildSweepAddressTransactionsResult {
|
|
|
249
253
|
toGroup: number;
|
|
250
254
|
}
|
|
251
255
|
export interface BuildTransaction {
|
|
252
|
-
/** @format
|
|
256
|
+
/** @format hex-string */
|
|
253
257
|
fromPublicKey: string;
|
|
258
|
+
/** @format hex-string */
|
|
259
|
+
fromPublicKeyType?: string;
|
|
254
260
|
destinations: Destination[];
|
|
255
261
|
utxos?: OutputRef[];
|
|
256
262
|
/** @format gas */
|
|
@@ -519,6 +525,13 @@ export interface InternalServerError {
|
|
|
519
525
|
export interface MemPooled {
|
|
520
526
|
type: string;
|
|
521
527
|
}
|
|
528
|
+
export interface MempoolTransactions {
|
|
529
|
+
/** @format int32 */
|
|
530
|
+
fromGroup: number;
|
|
531
|
+
/** @format int32 */
|
|
532
|
+
toGroup: number;
|
|
533
|
+
transactions: TransactionTemplate[];
|
|
534
|
+
}
|
|
522
535
|
export interface MinerAddresses {
|
|
523
536
|
addresses: string[];
|
|
524
537
|
}
|
|
@@ -756,13 +769,6 @@ export interface Unban {
|
|
|
756
769
|
peers: string[];
|
|
757
770
|
type: string;
|
|
758
771
|
}
|
|
759
|
-
export interface UnconfirmedTransactions {
|
|
760
|
-
/** @format int32 */
|
|
761
|
-
fromGroup: number;
|
|
762
|
-
/** @format int32 */
|
|
763
|
-
toGroup: number;
|
|
764
|
-
unconfirmedTransactions: TransactionTemplate[];
|
|
765
|
-
}
|
|
766
772
|
export interface Unreachable {
|
|
767
773
|
peers: string[];
|
|
768
774
|
type: string;
|
|
@@ -910,7 +916,7 @@ export declare class HttpClient<SecurityDataType = unknown> {
|
|
|
910
916
|
}
|
|
911
917
|
/**
|
|
912
918
|
* @title Alephium API
|
|
913
|
-
* @version 1.7.
|
|
919
|
+
* @version 1.7.1
|
|
914
920
|
* @baseUrl ../
|
|
915
921
|
*/
|
|
916
922
|
export declare class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDataType> {
|
|
@@ -1323,15 +1329,6 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1323
1329
|
getAddressesAddressGroup: (address: string, params?: RequestParams) => Promise<Group>;
|
|
1324
1330
|
};
|
|
1325
1331
|
transactions: {
|
|
1326
|
-
/**
|
|
1327
|
-
* No description
|
|
1328
|
-
*
|
|
1329
|
-
* @tags Transactions
|
|
1330
|
-
* @name GetTransactionsUnconfirmed
|
|
1331
|
-
* @summary List unconfirmed transactions
|
|
1332
|
-
* @request GET:/transactions/unconfirmed
|
|
1333
|
-
*/
|
|
1334
|
-
getTransactionsUnconfirmed: (params?: RequestParams) => Promise<UnconfirmedTransactions[]>;
|
|
1335
1332
|
/**
|
|
1336
1333
|
* No description
|
|
1337
1334
|
*
|
|
@@ -1394,6 +1391,46 @@ export declare class Api<SecurityDataType extends unknown> extends HttpClient<Se
|
|
|
1394
1391
|
toGroup?: number;
|
|
1395
1392
|
}, params?: RequestParams) => Promise<Confirmed | MemPooled | TxNotFound>;
|
|
1396
1393
|
};
|
|
1394
|
+
mempool: {
|
|
1395
|
+
/**
|
|
1396
|
+
* No description
|
|
1397
|
+
*
|
|
1398
|
+
* @tags Mempool
|
|
1399
|
+
* @name GetMempoolTransactions
|
|
1400
|
+
* @summary List mempool transactions
|
|
1401
|
+
* @request GET:/mempool/transactions
|
|
1402
|
+
*/
|
|
1403
|
+
getMempoolTransactions: (params?: RequestParams) => Promise<MempoolTransactions[]>;
|
|
1404
|
+
/**
|
|
1405
|
+
* No description
|
|
1406
|
+
*
|
|
1407
|
+
* @tags Mempool
|
|
1408
|
+
* @name DeleteMempoolTransactions
|
|
1409
|
+
* @summary Remove all transactions from mempool
|
|
1410
|
+
* @request DELETE:/mempool/transactions
|
|
1411
|
+
*/
|
|
1412
|
+
deleteMempoolTransactions: (params?: RequestParams) => Promise<void>;
|
|
1413
|
+
/**
|
|
1414
|
+
* No description
|
|
1415
|
+
*
|
|
1416
|
+
* @tags Mempool
|
|
1417
|
+
* @name PutMempoolTransactionsRebroadcast
|
|
1418
|
+
* @summary Rebroadcase a mempool transaction to the network
|
|
1419
|
+
* @request PUT:/mempool/transactions/rebroadcast
|
|
1420
|
+
*/
|
|
1421
|
+
putMempoolTransactionsRebroadcast: (query: {
|
|
1422
|
+
txId: string;
|
|
1423
|
+
}, params?: RequestParams) => Promise<void>;
|
|
1424
|
+
/**
|
|
1425
|
+
* No description
|
|
1426
|
+
*
|
|
1427
|
+
* @tags Mempool
|
|
1428
|
+
* @name PutMempoolTransactionsValidate
|
|
1429
|
+
* @summary Validate all mempool transactions and remove invalid ones
|
|
1430
|
+
* @request PUT:/mempool/transactions/validate
|
|
1431
|
+
*/
|
|
1432
|
+
putMempoolTransactionsValidate: (params?: RequestParams) => Promise<void>;
|
|
1433
|
+
};
|
|
1397
1434
|
contracts: {
|
|
1398
1435
|
/**
|
|
1399
1436
|
* No description
|
|
@@ -149,7 +149,7 @@ class HttpClient {
|
|
|
149
149
|
exports.HttpClient = HttpClient;
|
|
150
150
|
/**
|
|
151
151
|
* @title Alephium API
|
|
152
|
-
* @version 1.7.
|
|
152
|
+
* @version 1.7.1
|
|
153
153
|
* @baseUrl ../
|
|
154
154
|
*/
|
|
155
155
|
class Api extends HttpClient {
|
|
@@ -778,20 +778,6 @@ class Api extends HttpClient {
|
|
|
778
778
|
}).then(utils_1.convertHttpResponse)
|
|
779
779
|
};
|
|
780
780
|
this.transactions = {
|
|
781
|
-
/**
|
|
782
|
-
* No description
|
|
783
|
-
*
|
|
784
|
-
* @tags Transactions
|
|
785
|
-
* @name GetTransactionsUnconfirmed
|
|
786
|
-
* @summary List unconfirmed transactions
|
|
787
|
-
* @request GET:/transactions/unconfirmed
|
|
788
|
-
*/
|
|
789
|
-
getTransactionsUnconfirmed: (params = {}) => this.request({
|
|
790
|
-
path: `/transactions/unconfirmed`,
|
|
791
|
-
method: 'GET',
|
|
792
|
-
format: 'json',
|
|
793
|
-
...params
|
|
794
|
-
}).then(utils_1.convertHttpResponse),
|
|
795
781
|
/**
|
|
796
782
|
* No description
|
|
797
783
|
*
|
|
@@ -887,6 +873,62 @@ class Api extends HttpClient {
|
|
|
887
873
|
...params
|
|
888
874
|
}).then(utils_1.convertHttpResponse)
|
|
889
875
|
};
|
|
876
|
+
this.mempool = {
|
|
877
|
+
/**
|
|
878
|
+
* No description
|
|
879
|
+
*
|
|
880
|
+
* @tags Mempool
|
|
881
|
+
* @name GetMempoolTransactions
|
|
882
|
+
* @summary List mempool transactions
|
|
883
|
+
* @request GET:/mempool/transactions
|
|
884
|
+
*/
|
|
885
|
+
getMempoolTransactions: (params = {}) => this.request({
|
|
886
|
+
path: `/mempool/transactions`,
|
|
887
|
+
method: 'GET',
|
|
888
|
+
format: 'json',
|
|
889
|
+
...params
|
|
890
|
+
}).then(utils_1.convertHttpResponse),
|
|
891
|
+
/**
|
|
892
|
+
* No description
|
|
893
|
+
*
|
|
894
|
+
* @tags Mempool
|
|
895
|
+
* @name DeleteMempoolTransactions
|
|
896
|
+
* @summary Remove all transactions from mempool
|
|
897
|
+
* @request DELETE:/mempool/transactions
|
|
898
|
+
*/
|
|
899
|
+
deleteMempoolTransactions: (params = {}) => this.request({
|
|
900
|
+
path: `/mempool/transactions`,
|
|
901
|
+
method: 'DELETE',
|
|
902
|
+
...params
|
|
903
|
+
}).then(utils_1.convertHttpResponse),
|
|
904
|
+
/**
|
|
905
|
+
* No description
|
|
906
|
+
*
|
|
907
|
+
* @tags Mempool
|
|
908
|
+
* @name PutMempoolTransactionsRebroadcast
|
|
909
|
+
* @summary Rebroadcase a mempool transaction to the network
|
|
910
|
+
* @request PUT:/mempool/transactions/rebroadcast
|
|
911
|
+
*/
|
|
912
|
+
putMempoolTransactionsRebroadcast: (query, params = {}) => this.request({
|
|
913
|
+
path: `/mempool/transactions/rebroadcast`,
|
|
914
|
+
method: 'PUT',
|
|
915
|
+
query: query,
|
|
916
|
+
...params
|
|
917
|
+
}).then(utils_1.convertHttpResponse),
|
|
918
|
+
/**
|
|
919
|
+
* No description
|
|
920
|
+
*
|
|
921
|
+
* @tags Mempool
|
|
922
|
+
* @name PutMempoolTransactionsValidate
|
|
923
|
+
* @summary Validate all mempool transactions and remove invalid ones
|
|
924
|
+
* @request PUT:/mempool/transactions/validate
|
|
925
|
+
*/
|
|
926
|
+
putMempoolTransactionsValidate: (params = {}) => this.request({
|
|
927
|
+
path: `/mempool/transactions/validate`,
|
|
928
|
+
method: 'PUT',
|
|
929
|
+
...params
|
|
930
|
+
}).then(utils_1.convertHttpResponse)
|
|
931
|
+
};
|
|
890
932
|
this.contracts = {
|
|
891
933
|
/**
|
|
892
934
|
* No description
|
package/dist/src/api/index.d.ts
CHANGED
|
@@ -11,6 +11,7 @@ export declare class NodeProvider {
|
|
|
11
11
|
readonly blockflow: NodeApi<string>['blockflow'];
|
|
12
12
|
readonly addresses: NodeApi<string>['addresses'];
|
|
13
13
|
readonly transactions: NodeApi<string>['transactions'];
|
|
14
|
+
readonly mempool: NodeApi<string>['mempool'];
|
|
14
15
|
readonly contracts: NodeApi<string>['contracts'];
|
|
15
16
|
readonly multisig: NodeApi<string>['multisig'];
|
|
16
17
|
readonly utils: NodeApi<string>['utils'];
|
package/dist/src/api/index.js
CHANGED
|
@@ -90,6 +90,7 @@ class NodeProvider {
|
|
|
90
90
|
this.blockflow = { ...nodeApi.blockflow };
|
|
91
91
|
this.addresses = { ...nodeApi.addresses };
|
|
92
92
|
this.transactions = { ...nodeApi.transactions };
|
|
93
|
+
this.mempool = { ...nodeApi.mempool };
|
|
93
94
|
this.contracts = { ...nodeApi.contracts };
|
|
94
95
|
this.multisig = { ...nodeApi.multisig };
|
|
95
96
|
this.utils = { ...nodeApi.utils };
|
package/dist/src/api/types.d.ts
CHANGED
|
@@ -18,7 +18,7 @@ export declare function toApiByteVec(v: Val): string;
|
|
|
18
18
|
export declare function toApiAddress(v: Val): string;
|
|
19
19
|
export declare function toApiArray(tpe: string, v: Val): node.Val;
|
|
20
20
|
export declare function toApiVal(v: Val, tpe: string): node.Val;
|
|
21
|
-
export declare function fromApiVals(vals: node.Val[], names: string[], types: string[]): NamedVals;
|
|
21
|
+
export declare function fromApiVals(vals: node.Val[], names: string[], types: string[], optionalNames?: string[], optionalTypes?: string[]): NamedVals;
|
|
22
22
|
export declare function fromApiArray(vals: node.Val[], types: string[]): Val[];
|
|
23
23
|
export declare function fromApiVal(v: node.Val, tpe: string): Val;
|
|
24
24
|
export declare function typeLength(tpe: string): number;
|
package/dist/src/api/types.js
CHANGED
|
@@ -165,7 +165,7 @@ function _fromApiVal(vals, valIndex, tpe) {
|
|
|
165
165
|
}
|
|
166
166
|
}
|
|
167
167
|
}
|
|
168
|
-
function fromApiVals(vals, names, types) {
|
|
168
|
+
function fromApiVals(vals, names, types, optionalNames = [], optionalTypes = []) {
|
|
169
169
|
let valIndex = 0;
|
|
170
170
|
const result = {};
|
|
171
171
|
types.forEach((currentType, index) => {
|
|
@@ -174,7 +174,11 @@ function fromApiVals(vals, names, types) {
|
|
|
174
174
|
valIndex = nextIndex;
|
|
175
175
|
result[`${currentName}`] = val;
|
|
176
176
|
});
|
|
177
|
-
|
|
177
|
+
if (valIndex === vals.length) {
|
|
178
|
+
return result;
|
|
179
|
+
}
|
|
180
|
+
const optionalFields = fromApiVals(vals.slice(valIndex), optionalNames, optionalTypes);
|
|
181
|
+
return { ...result, ...optionalFields };
|
|
178
182
|
}
|
|
179
183
|
exports.fromApiVals = fromApiVals;
|
|
180
184
|
function fromApiArray(vals, types) {
|
package/dist/src/constants.d.ts
CHANGED
package/dist/src/constants.js
CHANGED
|
@@ -17,8 +17,9 @@ You should have received a copy of the GNU Lesser General Public License
|
|
|
17
17
|
along with the library. If not, see <http://www.gnu.org/licenses/>.
|
|
18
18
|
*/
|
|
19
19
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
20
|
-
exports.ONE_ALPH = exports.ALPH_TOKEN_ID = exports.MIN_UTXO_SET_AMOUNT = exports.TOTAL_NUMBER_OF_GROUPS = void 0;
|
|
20
|
+
exports.DUST_AMOUNT = exports.ONE_ALPH = exports.ALPH_TOKEN_ID = exports.MIN_UTXO_SET_AMOUNT = exports.TOTAL_NUMBER_OF_GROUPS = void 0;
|
|
21
21
|
exports.TOTAL_NUMBER_OF_GROUPS = 4;
|
|
22
22
|
exports.MIN_UTXO_SET_AMOUNT = BigInt(1000000000000);
|
|
23
23
|
exports.ALPH_TOKEN_ID = ''.padStart(64, '0');
|
|
24
24
|
exports.ONE_ALPH = 10n ** 18n;
|
|
25
|
+
exports.DUST_AMOUNT = 10n ** 15n;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { NamedVals, node, Number256, Token
|
|
2
|
-
import { SignDeployContractTxParams, SignDeployContractTxResult, SignExecuteScriptTxParams, SignerProvider } from '../signer';
|
|
3
|
-
import { SubscribeOptions } from '../utils';
|
|
1
|
+
import { NamedVals, node, Number256, Token } from '../api';
|
|
2
|
+
import { SignDeployContractTxParams, SignDeployContractTxResult, SignExecuteScriptTxParams, SignerProvider, Address } from '../signer';
|
|
3
|
+
import { SubscribeOptions, Optional } from '../utils';
|
|
4
4
|
import { EventSubscription } from './events';
|
|
5
5
|
export declare type FieldsSig = node.FieldsSig;
|
|
6
6
|
export declare type EventSig = node.EventSig;
|
|
@@ -123,16 +123,16 @@ export declare class Contract extends Artifact {
|
|
|
123
123
|
fromApiContractState(state: node.ContractState): ContractState<Fields>;
|
|
124
124
|
static fromApiContractState(state: node.ContractState): ContractState;
|
|
125
125
|
static ContractCreatedEventIndex: number;
|
|
126
|
-
static ContractCreatedEvent:
|
|
126
|
+
static ContractCreatedEvent: SystemEventSig;
|
|
127
127
|
static ContractDestroyedEventIndex: number;
|
|
128
|
-
static ContractDestroyedEvent:
|
|
128
|
+
static ContractDestroyedEvent: SystemEventSig;
|
|
129
129
|
static fromApiEvent(event: node.ContractEventByTxId, codeHash: string | undefined, txId: string): ContractEvent;
|
|
130
|
-
fromApiTestContractResult(
|
|
130
|
+
fromApiTestContractResult(methodName: string, result: node.TestContractResult, txId: string): TestContractResult<unknown>;
|
|
131
131
|
txParamsForDeployment<P extends Fields>(signer: SignerProvider, params: DeployContractParams<P>): Promise<SignDeployContractTxParams>;
|
|
132
132
|
buildByteCodeToDeploy(initialFields: Fields): string;
|
|
133
133
|
static fromApiEvents(events: node.ContractEventByTxId[], addressToCodeHash: Map<string, string>, txId: string): ContractEvent[];
|
|
134
134
|
toApiCallContract<T extends Arguments>(params: CallContractParams<T>, groupIndex: number, contractAddress: string, methodIndex: number): node.CallContract;
|
|
135
|
-
fromApiCallContractResult(result: node.CallContractResult, txId: string, methodIndex: number): CallContractResult
|
|
135
|
+
fromApiCallContractResult(result: node.CallContractResult, txId: string, methodIndex: number): CallContractResult<unknown>;
|
|
136
136
|
}
|
|
137
137
|
export declare class Script extends Artifact {
|
|
138
138
|
readonly bytecodeTemplate: string;
|
|
@@ -185,10 +185,10 @@ export interface ContractEvent<T extends Fields = Fields> {
|
|
|
185
185
|
fields: T;
|
|
186
186
|
}
|
|
187
187
|
export declare type DebugMessage = node.DebugMessage;
|
|
188
|
-
export interface TestContractResult {
|
|
188
|
+
export interface TestContractResult<R> {
|
|
189
189
|
contractId: string;
|
|
190
190
|
contractAddress: string;
|
|
191
|
-
returns:
|
|
191
|
+
returns: R;
|
|
192
192
|
gasUsed: number;
|
|
193
193
|
contracts: ContractState[];
|
|
194
194
|
txOutputs: Output[];
|
|
@@ -220,11 +220,12 @@ export interface DeployContractParams<P extends Fields = Fields> {
|
|
|
220
220
|
export declare type DeployContractResult<T> = SignDeployContractTxResult & {
|
|
221
221
|
instance: T;
|
|
222
222
|
};
|
|
223
|
-
export declare abstract class ContractFactory<
|
|
223
|
+
export declare abstract class ContractFactory<I, F extends Fields = Fields> {
|
|
224
224
|
readonly contract: Contract;
|
|
225
225
|
constructor(contract: Contract);
|
|
226
|
-
|
|
227
|
-
|
|
226
|
+
abstract at(address: string): I;
|
|
227
|
+
deploy(signer: SignerProvider, deployParams: DeployContractParams<F>): Promise<DeployContractResult<I>>;
|
|
228
|
+
stateForTest(initFields: F, asset?: Asset, address?: string): ContractState<F>;
|
|
228
229
|
}
|
|
229
230
|
export interface ExecuteScriptParams<P extends Fields = Fields> {
|
|
230
231
|
initialFields: P;
|
|
@@ -248,21 +249,40 @@ export interface CallContractParams<T extends Arguments = Arguments> {
|
|
|
248
249
|
existingContracts?: string[];
|
|
249
250
|
inputAssets?: node.TestInputAsset[];
|
|
250
251
|
}
|
|
251
|
-
export interface CallContractResult {
|
|
252
|
-
returns:
|
|
252
|
+
export interface CallContractResult<R> {
|
|
253
|
+
returns: R;
|
|
253
254
|
gasUsed: number;
|
|
254
255
|
contracts: ContractState[];
|
|
255
256
|
txInputs: string[];
|
|
256
257
|
txOutputs: Output[];
|
|
257
258
|
events: ContractEvent[];
|
|
258
259
|
}
|
|
260
|
+
export interface SystemEventSig extends EventSig {
|
|
261
|
+
optionalFieldNames?: string[];
|
|
262
|
+
optionalFieldTypes?: string[];
|
|
263
|
+
}
|
|
259
264
|
export declare type ContractCreatedEvent = ContractEvent<{
|
|
260
|
-
address:
|
|
265
|
+
address: Address;
|
|
266
|
+
parentAddress?: Address;
|
|
261
267
|
}>;
|
|
262
268
|
export declare type ContractDestroyedEvent = ContractEvent<{
|
|
263
|
-
address:
|
|
269
|
+
address: Address;
|
|
264
270
|
}>;
|
|
265
271
|
export declare function decodeContractCreatedEvent(event: node.ContractEvent): Omit<ContractCreatedEvent, 'contractAddress'>;
|
|
266
272
|
export declare function decodeContractDestroyedEvent(event: node.ContractEvent): Omit<ContractDestroyedEvent, 'contractAddress'>;
|
|
267
|
-
export declare function subscribeEventsFromContract<T extends Fields
|
|
273
|
+
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;
|
|
274
|
+
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>>;
|
|
275
|
+
export declare abstract class ContractInstance {
|
|
276
|
+
readonly address: Address;
|
|
277
|
+
readonly contractId: string;
|
|
278
|
+
readonly groupIndex: number;
|
|
279
|
+
constructor(address: Address);
|
|
280
|
+
}
|
|
281
|
+
export declare function fetchContractState<F extends Fields, I extends ContractInstance>(contract: ContractFactory<I, F>, instance: ContractInstance): Promise<ContractState<F>>;
|
|
282
|
+
export declare function subscribeContractCreatedEvent(instance: ContractInstance, options: SubscribeOptions<ContractCreatedEvent>, fromCount?: number): EventSubscription;
|
|
283
|
+
export declare function subscribeContractDestroyedEvent(instance: ContractInstance, options: SubscribeOptions<ContractDestroyedEvent>, fromCount?: number): EventSubscription;
|
|
284
|
+
export declare function decodeEvent<F extends Fields, M extends ContractEvent<F>>(contract: Contract, instance: ContractInstance, event: node.ContractEvent, targetEventIndex: number): M;
|
|
285
|
+
export declare function subscribeContractEvent<F extends Fields, M extends ContractEvent<F>>(contract: Contract, instance: ContractInstance, options: SubscribeOptions<M>, eventName: string, fromCount?: number): EventSubscription;
|
|
286
|
+
export declare function subscribeAllEvents(contract: Contract, instance: ContractInstance, options: SubscribeOptions<ContractEvent<any>>, fromCount?: number): EventSubscription;
|
|
287
|
+
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>>;
|
|
268
288
|
export {};
|