@prosopo/types-database 0.2.13 → 0.2.14

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.
@@ -1,79 +0,0 @@
1
- "use strict";
2
- const apiContract = require("@polkadot/api-contract");
3
- const captcha = require("../contract-info/captcha.cjs");
4
- const captcha$2 = require("../build-extrinsic/captcha.cjs");
5
- const captcha$5 = require("../events/captcha.cjs");
6
- const captcha$4 = require("../mixed-methods/captcha.cjs");
7
- const captcha$1 = require("../query/captcha.cjs");
8
- const captcha$3 = require("../tx-sign-and-send/captcha.cjs");
9
- class Contract {
10
- /**
11
- * @constructor
12
-
13
- * @param address - The address of the contract.
14
- * @param signer - The signer to use for signing transactions.
15
- * @param nativeAPI - The API instance to use for queries.
16
- */
17
- constructor(address, signer, nativeAPI) {
18
- this.address = address;
19
- this.nativeContract = new apiContract.ContractPromise(nativeAPI, captcha.ContractAbi, address);
20
- this.nativeAPI = nativeAPI;
21
- this.signer = signer;
22
- this.contractAbi = new apiContract.Abi(captcha.ContractAbi);
23
- this.query = new captcha$1(this.nativeContract, this.nativeAPI, signer.address);
24
- this.buildExtrinsic = new captcha$2(this.nativeContract, this.nativeAPI);
25
- this.tx = new captcha$3(nativeAPI, this.nativeContract, signer);
26
- this.methods = new captcha$4(nativeAPI, this.nativeContract, signer);
27
- this.events = new captcha$5(this.nativeContract, nativeAPI);
28
- }
29
- /**
30
- * name
31
- *
32
- * @returns The name of the contract.
33
- */
34
- get name() {
35
- return this.nativeContract.abi.info.contract.name.toString();
36
- }
37
- /**
38
- * abi
39
- *
40
- * @returns The abi of the contract.
41
- */
42
- get abi() {
43
- return this.contractAbi;
44
- }
45
- /**
46
- * withSigner
47
- *
48
- * @param signer - The signer to use for signing transactions.
49
- * @returns New instance of the contract class with new signer.
50
- * @example
51
- * ```typescript
52
- * const contract = new Contract(address, signerAlice, api);
53
- * await contract.mint(signerBob.address, 100);
54
- * await contract.withSigner(signerBob).transfer(signerAlice.address, 100);
55
- * ```
56
- */
57
- withSigner(signer) {
58
- return new Contract(this.address, signer, this.nativeAPI);
59
- }
60
- /**
61
- * withAddress
62
- *
63
- * @param address - The address of the contract.
64
- * @returns New instance of the contract class to interact with new contract.
65
- */
66
- withAddress(address) {
67
- return new Contract(address, this.signer, this.nativeAPI);
68
- }
69
- /**
70
- * withAPI
71
- *
72
- * @param api - The API instance to use for queries.
73
- * @returns New instance of the contract class to interact with new API.
74
- */
75
- withAPI(api) {
76
- return new Contract(this.address, this.signer, api);
77
- }
78
- }
79
- module.exports = Contract;