starknet 4.8.0 → 4.10.0

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 (107) hide show
  1. package/CHANGELOG.md +46 -0
  2. package/README.md +1 -3
  3. package/__mocks__/ERC20.json +32561 -29055
  4. package/__tests__/account.test.ts +32 -24
  5. package/__tests__/contract.test.ts +25 -14
  6. package/__tests__/defaultProvider.test.ts +91 -240
  7. package/__tests__/fixtures.ts +10 -2
  8. package/__tests__/rpcProvider.test.ts +8 -16
  9. package/__tests__/sequencerProvider.test.ts +17 -10
  10. package/__tests__/udc.test.ts +41 -0
  11. package/__tests__/utils/merkle.test.ts +98 -3
  12. package/__tests__/utils/typedData.test.ts +3 -3
  13. package/account/default.d.ts +12 -44
  14. package/account/default.js +305 -61
  15. package/account/interface.d.ts +96 -8
  16. package/constants.d.ts +8 -1
  17. package/constants.js +8 -1
  18. package/contract/default.d.ts +11 -27
  19. package/contract/default.js +105 -121
  20. package/contract/interface.d.ts +5 -2
  21. package/dist/account/default.d.ts +12 -44
  22. package/dist/account/default.js +305 -61
  23. package/dist/account/interface.d.ts +96 -8
  24. package/dist/constants.d.ts +8 -1
  25. package/dist/constants.js +8 -1
  26. package/dist/contract/default.d.ts +11 -27
  27. package/dist/contract/default.js +105 -121
  28. package/dist/contract/interface.d.ts +5 -2
  29. package/dist/provider/default.d.ts +8 -3
  30. package/dist/provider/default.js +31 -4
  31. package/dist/provider/interface.d.ts +67 -5
  32. package/dist/provider/rpc.d.ts +10 -3
  33. package/dist/provider/rpc.js +98 -10
  34. package/dist/provider/sequencer.d.ts +11 -4
  35. package/dist/provider/sequencer.js +89 -18
  36. package/dist/signer/default.d.ts +5 -2
  37. package/dist/signer/default.js +25 -3
  38. package/dist/signer/interface.d.ts +29 -2
  39. package/dist/types/api/index.d.ts +0 -6
  40. package/dist/types/api/openrpc.d.ts +24 -2
  41. package/dist/types/api/sequencer.d.ts +22 -7
  42. package/dist/types/index.d.ts +1 -1
  43. package/dist/types/lib.d.ts +36 -2
  44. package/dist/types/provider.d.ts +15 -10
  45. package/dist/types/signer.d.ts +14 -1
  46. package/dist/utils/hash.d.ts +2 -0
  47. package/dist/utils/hash.js +13 -2
  48. package/dist/utils/merkle.js +2 -4
  49. package/dist/utils/number.d.ts +1 -0
  50. package/dist/utils/number.js +3 -1
  51. package/dist/utils/responseParser/rpc.d.ts +2 -6
  52. package/dist/utils/responseParser/rpc.js +0 -11
  53. package/dist/utils/responseParser/sequencer.js +4 -14
  54. package/package.json +1 -1
  55. package/provider/default.d.ts +8 -3
  56. package/provider/default.js +31 -4
  57. package/provider/interface.d.ts +67 -5
  58. package/provider/rpc.d.ts +10 -3
  59. package/provider/rpc.js +98 -10
  60. package/provider/sequencer.d.ts +11 -4
  61. package/provider/sequencer.js +89 -18
  62. package/signer/default.d.ts +5 -2
  63. package/signer/default.js +25 -3
  64. package/signer/interface.d.ts +29 -2
  65. package/src/account/default.ts +243 -55
  66. package/src/account/interface.ts +132 -7
  67. package/src/constants.ts +8 -0
  68. package/src/contract/default.ts +124 -141
  69. package/src/contract/interface.ts +5 -2
  70. package/src/provider/default.ts +43 -5
  71. package/src/provider/interface.ts +92 -7
  72. package/src/provider/rpc.ts +93 -15
  73. package/src/provider/sequencer.ts +87 -14
  74. package/src/signer/default.ts +56 -4
  75. package/src/signer/interface.ts +33 -2
  76. package/src/types/api/index.ts +0 -4
  77. package/src/types/api/openrpc.ts +28 -2
  78. package/src/types/api/sequencer.ts +32 -9
  79. package/src/types/index.ts +1 -1
  80. package/src/types/lib.ts +43 -2
  81. package/src/types/provider.ts +27 -11
  82. package/src/types/signer.ts +18 -1
  83. package/src/utils/hash.ts +46 -1
  84. package/src/utils/merkle.ts +2 -4
  85. package/src/utils/number.ts +2 -0
  86. package/src/utils/responseParser/rpc.ts +4 -20
  87. package/src/utils/responseParser/sequencer.ts +2 -0
  88. package/types/api/index.d.ts +0 -6
  89. package/types/api/openrpc.d.ts +24 -2
  90. package/types/api/sequencer.d.ts +22 -7
  91. package/types/index.d.ts +1 -1
  92. package/types/lib.d.ts +36 -2
  93. package/types/provider.d.ts +15 -10
  94. package/types/signer.d.ts +14 -1
  95. package/utils/hash.d.ts +2 -0
  96. package/utils/hash.js +13 -2
  97. package/utils/merkle.js +2 -4
  98. package/utils/number.d.ts +1 -0
  99. package/utils/number.js +3 -1
  100. package/utils/responseParser/rpc.d.ts +2 -6
  101. package/utils/responseParser/rpc.js +0 -11
  102. package/utils/responseParser/sequencer.js +4 -14
  103. package/www/docs/API/account.md +170 -11
  104. package/www/docs/API/contract.md +39 -3
  105. package/www/docs/API/provider.md +310 -17
  106. package/www/docs/API/signer.md +56 -2
  107. package/www/guides/erc20.md +13 -7
package/utils/merkle.js CHANGED
@@ -44,7 +44,7 @@ var MerkleTree = /** @class */ (function () {
44
44
  var newLeaves = [];
45
45
  for (var i = 0; i < leaves.length; i += 2) {
46
46
  if (i + 1 === leaves.length) {
47
- newLeaves.push(leaves[i]);
47
+ newLeaves.push(MerkleTree.hash(leaves[i], '0x0'));
48
48
  }
49
49
  else {
50
50
  newLeaves.push(MerkleTree.hash(leaves[i], leaves[i + 1]));
@@ -74,9 +74,7 @@ var MerkleTree = /** @class */ (function () {
74
74
  ? -1
75
75
  : this.branches.findIndex(function (b) { return b.length === branch.length; });
76
76
  var nextBranch = (_b = this.branches[currentBranchLevelIndex + 1]) !== null && _b !== void 0 ? _b : [this.root];
77
- return this.getProof(neededBranch === '0x0'
78
- ? leaf
79
- : MerkleTree.hash(isLeft ? leaf : neededBranch, isLeft ? neededBranch : leaf), nextBranch, newHashPath);
77
+ return this.getProof(MerkleTree.hash(isLeft ? leaf : neededBranch, isLeft ? neededBranch : leaf), nextBranch, newHashPath);
80
78
  };
81
79
  return MerkleTree;
82
80
  }());
package/utils/number.d.ts CHANGED
@@ -13,3 +13,4 @@ export declare const toHexString: (value: string) => string;
13
13
  export declare function getDecimalString(value: string): string;
14
14
  export declare function getHexString(value: string): string;
15
15
  export declare function getHexStringArray(value: Array<string>): string[];
16
+ export declare const toCairoBool: (value: boolean) => string;
package/utils/number.js CHANGED
@@ -26,7 +26,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
26
26
  return (mod && mod.__esModule) ? mod : { "default": mod };
27
27
  };
28
28
  Object.defineProperty(exports, "__esModule", { value: true });
29
- exports.getHexStringArray = exports.getHexString = exports.getDecimalString = exports.toHexString = exports.isStringWholeNumber = exports.bigNumberishArrayToHexadecimalStringArray = exports.bigNumberishArrayToDecimalStringArray = exports.assertInRange = exports.toFelt = exports.hexToDecimalString = exports.toHex = exports.toBN = exports.isHex = void 0;
29
+ exports.toCairoBool = exports.getHexStringArray = exports.getHexString = exports.getDecimalString = exports.toHexString = exports.isStringWholeNumber = exports.bigNumberishArrayToHexadecimalStringArray = exports.bigNumberishArrayToDecimalStringArray = exports.assertInRange = exports.toFelt = exports.hexToDecimalString = exports.toHex = exports.toBN = exports.isHex = void 0;
30
30
  var bn_js_1 = __importStar(require("bn.js"));
31
31
  var minimalistic_assert_1 = __importDefault(require("minimalistic-assert"));
32
32
  var encode_1 = require("./encode");
@@ -108,3 +108,5 @@ function getHexStringArray(value) {
108
108
  return value.map(function (el) { return getHexString(el); });
109
109
  }
110
110
  exports.getHexStringArray = getHexStringArray;
111
+ var toCairoBool = function (value) { return (+value).toString(); };
112
+ exports.toCairoBool = toCairoBool;
@@ -2,7 +2,7 @@
2
2
  * Map RPC Response to common interface response
3
3
  * Intersection (sequencer response ∩ (∪ rpc responses))
4
4
  */
5
- import { CallContractResponse, EstimateFeeResponse, GetBlockResponse, GetTransactionReceiptResponse, GetTransactionResponse } from '../../types';
5
+ import { CallContractResponse, EstimateFeeResponse, GetBlockResponse, GetTransactionResponse } from '../../types';
6
6
  import { RPC } from '../../types/api';
7
7
  import { ResponseParser } from '.';
8
8
  declare type RpcGetBlockResponse = RPC.GetBlockWithTxHashesResponse & {
@@ -11,13 +11,9 @@ declare type RpcGetBlockResponse = RPC.GetBlockWithTxHashesResponse & {
11
11
  declare type GetTransactionByHashResponse = RPC.GetTransactionByHashResponse & {
12
12
  [key: string]: any;
13
13
  };
14
- declare type TransactionReceipt = RPC.TransactionReceipt & {
15
- [key: string]: any;
16
- };
17
- export declare class RPCResponseParser implements Omit<ResponseParser, 'parseDeclareContractResponse' | 'parseDeployContractResponse' | 'parseInvokeFunctionResponse'> {
14
+ export declare class RPCResponseParser implements Omit<ResponseParser, 'parseDeclareContractResponse' | 'parseDeployContractResponse' | 'parseInvokeFunctionResponse' | 'parseGetTransactionReceiptResponse'> {
18
15
  parseGetBlockResponse(res: RpcGetBlockResponse): GetBlockResponse;
19
16
  parseGetTransactionResponse(res: GetTransactionByHashResponse): GetTransactionResponse;
20
- parseGetTransactionReceiptResponse(res: TransactionReceipt): GetTransactionReceiptResponse;
21
17
  parseFeeEstimateResponse(res: RPC.EstimateFeeResponse): EstimateFeeResponse;
22
18
  parseCallContractResponse(res: Array<string>): CallContractResponse;
23
19
  }
@@ -27,17 +27,6 @@ var RPCResponseParser = /** @class */ (function () {
27
27
  version: res.version,
28
28
  };
29
29
  };
30
- RPCResponseParser.prototype.parseGetTransactionReceiptResponse = function (res) {
31
- return {
32
- transaction_hash: res.transaction_hash,
33
- actual_fee: res.actual_fee,
34
- status: res.status,
35
- status_data: res.status_data,
36
- messages_sent: res.messages_sent,
37
- l1_origin_message: res.l1_origin_message,
38
- events: res.events,
39
- };
40
- };
41
30
  RPCResponseParser.prototype.parseFeeEstimateResponse = function (res) {
42
31
  return {
43
32
  overall_fee: (0, number_1.toBN)(res.overall_fee),
@@ -40,25 +40,15 @@ var SequencerAPIResponseParser = /** @class */ (function (_super) {
40
40
  .filter(Boolean) });
41
41
  };
42
42
  SequencerAPIResponseParser.prototype.parseGetTransactionResponse = function (res) {
43
- return {
44
- calldata: 'calldata' in res.transaction ? res.transaction.calldata : [],
45
- contract_address: 'contract_address' in res.transaction ? res.transaction.contract_address : undefined,
46
- contract_class: 'contract_class' in res.transaction ? res.transaction.contract_class : undefined,
47
- entry_point_selector: 'entry_point_selector' in res.transaction
43
+ return __assign(__assign({}, res), { calldata: 'calldata' in res.transaction ? res.transaction.calldata : [], contract_address: 'contract_address' in res.transaction ? res.transaction.contract_address : undefined, contract_class: 'contract_class' in res.transaction ? res.transaction.contract_class : undefined, entry_point_selector: 'entry_point_selector' in res.transaction
48
44
  ? res.transaction.entry_point_selector
49
- : undefined,
50
- max_fee: 'max_fee' in res.transaction ? res.transaction.max_fee : undefined,
51
- nonce: res.transaction.nonce,
52
- sender_address: 'sender_address' in res.transaction
45
+ : undefined, max_fee: 'max_fee' in res.transaction ? res.transaction.max_fee : undefined, nonce: res.transaction.nonce, sender_address: 'sender_address' in res.transaction
53
46
  ? res.transaction.sender_address
54
- : undefined,
55
- signature: 'signature' in res.transaction ? res.transaction.signature : undefined,
56
- transaction_hash: 'transaction_hash' in res.transaction ? res.transaction.transaction_hash : undefined,
57
- version: 'version' in res.transaction ? res.transaction.version : undefined,
58
- };
47
+ : undefined, signature: 'signature' in res.transaction ? res.transaction.signature : undefined, transaction_hash: 'transaction_hash' in res.transaction ? res.transaction.transaction_hash : undefined, version: 'version' in res.transaction ? res.transaction.version : undefined });
59
48
  };
60
49
  SequencerAPIResponseParser.prototype.parseGetTransactionReceiptResponse = function (res) {
61
50
  return __assign(__assign(__assign(__assign(__assign(__assign(__assign({ transaction_hash: res.transaction_hash, status: res.status, messages_sent: res.l2_to_l1_messages, events: res.events }, ('block_hash' in res && { block_hash: res.block_hash })), ('block_number' in res && { block_number: res.block_number })), ('actual_fee' in res && { actual_fee: res.actual_fee })), ('transaction_index' in res && { transaction_index: res.transaction_index })), ('execution_resources' in res && { execution_resources: res.execution_resources })), ('l1_to_l2_consumed_message' in res && {
51
+ // eslint-disable-next-line @typescript-eslint/dot-notation
62
52
  l1_to_l2_consumed_message: res['l1_to_l2_consumed_message'],
63
53
  })), ('transaction_failure_reason' in res && {
64
54
  transaction_failure_reason: res.transaction_failure_reason,
@@ -24,20 +24,82 @@ The address of the account contract.
24
24
 
25
25
  ## Methods
26
26
 
27
- account.**getNonce()** => _Promise < BigNumberish >_
27
+ account.**getNonce(blockIdentifier)** => _Promise < BigNumberish >_
28
28
 
29
- Gets the new Nonce of the connected account for the next transaction.
29
+ Gets the nonce of the account with respect to a specific block.
30
+
31
+ _blockIdentifier_ - optional blockIdentifier. Defaults to 'pending'.
32
+
33
+ Returns the nonce of the account.
34
+
35
+ <hr />
36
+
37
+ account.**estimateInvokeFee**(calls [ , estimateFeeDetails ]) => _Promise < EstimateFeeResponse >_
38
+
39
+ Estimate Fee for executing an INVOKE transaction on starknet.
40
+
41
+ The _calls_ object structure:
42
+
43
+ - calls.**contractAddress** - Address of the contract
44
+ - calls.**entrypoint** - Entrypoint of the call (method name)
45
+ - calls.**calldata** - Payload for the invoking method
46
+
47
+ The _estimateFeeDetails_ object may include any of:
48
+
49
+ - estimateFeeDetails.**blockIdentifier** - Block Identifier for the transaction
50
+ - estimateFeeDetails.**nonce** - Nonce for the transaction
51
+
52
+ ###### _EstimateFeeResponse_
53
+
54
+ ```typescript
55
+ {
56
+ overall_fee: BN;
57
+ gas_consumed?: BN;
58
+ gas_price?: BN;
59
+ }
60
+ ```
61
+
62
+ <hr />
63
+
64
+ account.**estimateDeclareFee**(contractPayload [ , estimateFeeDetails ]) => _Promise < EstimateFeeResponse >_
65
+
66
+ Estimate Fee for executing a DECLARE transaction on starknet.
67
+
68
+ The _contractPayload_ object structure:
69
+
70
+ - contractPayload.**contract** - The compiled contract
71
+ - contractPayload.**classHash** - This can be obtained by using starknet-cli. Once the classHash is included in CompiledContract, this can be removed
72
+
73
+ The _estimateFeeDetails_ object may include any of:
74
+
75
+ - estimateFeeDetails.**blockIdentifier** - Block Identifier for the transaction
76
+ - estimateFeeDetails.**nonce** - Nonce for the transaction
77
+
78
+ ###### _EstimateFeeResponse_
79
+
80
+ ```typescript
81
+ {
82
+ overall_fee: BN;
83
+ gas_consumed?: BN;
84
+ gas_price?: BN;
85
+ }
86
+ ```
30
87
 
31
88
  <hr />
32
89
 
33
- account.**estimateFee**(calls [ , options ]) => _Promise < EstimateFeeResponse >_
90
+ account.**estimateAccountDeployFee**(contractPayload [ , estimateFeeDetails ]) => _Promise < EstimateFeeResponse >_
91
+
92
+ Estimate Fee for executing a DEPLOY_ACCOUNT transaction on starknet
34
93
 
35
- Gets the estimated fee for the call(s).
94
+ The _contractPayload_ object structure:
36
95
 
37
- The _options_ object may include any of:
96
+ - contractPayload.**contract** - The compiled contract to be declared
97
+ - contractPayload.**classHash** - This can be obtained by using starknet-cli. Once the classHash is included in CompiledContract, this can be removed
38
98
 
39
- - options.**blockIdentifier** - Block Identifier for the transaction
40
- - options.**nonce** - Nonce for the transaction
99
+ The _estimateFeeDetails_ object may include any of:
100
+
101
+ - estimateFeeDetails.**blockIdentifier** - Block Identifier for the transaction
102
+ - estimateFeeDetails.**nonce** - Nonce for the transaction
41
103
 
42
104
  ###### _EstimateFeeResponse_
43
105
 
@@ -51,17 +113,26 @@ The _options_ object may include any of:
51
113
 
52
114
  <hr />
53
115
 
54
- account.**execute**(calls [ , abi , transactionsDetail ]) => _Promise < AddTransactionResponse >_
116
+ account.**execute**(transactions [ , abi , transactionsDetail ]) => _Promise < InvokeFunctionResponse >_
55
117
 
56
118
  Executes one or multiple calls using the account contract.
57
119
 
120
+ The _transactions_ object structure:
121
+
122
+ - contractPayload.**contractAddress** - the address of the contract
123
+ - contractPayload.**entrypoint** - the entrypoint of the contract
124
+ - contractPayload.**calldata** - (defaults to []) the calldata
125
+ - contractPayload.**signature** - (defaults to []) the signature
126
+
127
+ _abi_ - (optional) the abi of the contract for better displaying
128
+
58
129
  The _transactionsDetail_ object may include any of:
59
130
 
60
131
  - transactionsDetail.**maxFee** - Max Fee that that will be used to execute the call(s)
61
132
  - transactionsDetail.**nonce** - Nonce for the transaction
62
133
  - transactionsDetail.**version** - Version for the transaction (default is 1)
63
134
 
64
- ###### _AddTransactionResponse_
135
+ ###### _InvokeFunctionResponse_
65
136
 
66
137
  ```typescript
67
138
  {
@@ -71,9 +142,79 @@ The _transactionsDetail_ object may include any of:
71
142
 
72
143
  <hr />
73
144
 
145
+ account.**declare**(contractPayload [ , transactionsDetail ]) => _Promise < DeclareContractResponse >_
146
+
147
+ Declares a given compiled contract (json) to starknet.
148
+
149
+ The _contractPayload_ object consists of:
150
+
151
+ - contractPayload.**contract** - The compiled contract
152
+ - contractPayload.**classHash** - Hash of the compiled contract
153
+
154
+ The _transactionsDetail_ object may include any of:
155
+
156
+ - transactionsDetail.**maxFee** - Max Fee that that will be used to execute the call(s)
157
+ - transactionsDetail.**nonce** - Nonce for the transaction
158
+ - transactionsDetail.**version** - Version for the transaction (default is 1)
159
+
160
+ > _Note:_ Once the classHash is included in CompiledContract, this parameter can be removed. Currently it can be pre-computed from starknet-cli.
161
+
162
+ Example:
163
+
164
+ ```typescript
165
+ const declareTx = await account.declare({
166
+ contract: compiledErc20,
167
+ // classHash is pre-computed from starknet-cli
168
+ classHash: '0x54328a1075b8820eb43caf0caa233923148c983742402dcfc38541dd843d01a',
169
+ });
170
+ ```
171
+
172
+ ###### _DeclareContractResponse_
173
+
174
+ ```typescript
175
+ {
176
+ transaction_hash: string;
177
+ class_hash: string;
178
+ };
179
+ ```
180
+
181
+ <hr />
182
+
183
+ account.**deployAccount**(contractPayload [ , transactionsDetail ]) => _Promise < DeployContractResponse >_
184
+
185
+ Declares a given compiled contract (json) to starknet.
186
+
187
+ The _contractPayload_ object consists of:
188
+
189
+ - contractPayload.**classHash** - Hash of the compiled contract
190
+ - contractPayload.**constructorCalldata** - optional
191
+ - contractPayload.**addressSalt** - optional
192
+ - contractPayload.**contractAddress** - optional
193
+
194
+ The _transactionsDetail_ object may include any of:
195
+
196
+ - transactionsDetail.**maxFee** - Max Fee that that will be used to execute the call(s)
197
+ - transactionsDetail.**nonce** - Nonce for the transaction
198
+ - transactionsDetail.**version** - Version for the transaction (default is 1)
199
+
200
+ > _Note:_ Once the classHash is included in CompiledContract, this parameter can be removed. Currently it can be pre-computed from starknet-cli.
201
+
202
+ ###### _DeployContractResponse_
203
+
204
+ ```typescript
205
+ {
206
+ contract_address: string;
207
+ transaction_hash: string;
208
+ };
209
+ ```
210
+
211
+ <hr/>
212
+
74
213
  account.**signMessage**(typedData) => _Promise < Signature >_
75
214
 
76
- Creates a signature from the passed data.
215
+ Sign an JSON object for off-chain usage with the starknet private key and return the signature. This adds a message prefix so it cant be interchanged with transactions.
216
+
217
+ _typedData_ - JSON object to be signed
77
218
 
78
219
  ###### _Signature_
79
220
 
@@ -85,7 +226,11 @@ string[];
85
226
 
86
227
  account.**hashMessage**(typedData) => _Promise < string >_
87
228
 
88
- Creates a hash from the passed data.
229
+ Hash a JSON object with pederson hash and return the hash. This adds a message prefix so it cant be interchanged with transactions.
230
+
231
+ _typedData_ - JSON object to be signed
232
+
233
+ Returns the hash of the JSON object.
89
234
 
90
235
  <hr />
91
236
 
@@ -103,4 +248,18 @@ account.**verifyMessage**(typedData, signature) => _Promise < boolean >_
103
248
 
104
249
  Verify a signature of a JSON object.
105
250
 
251
+ _typedData_ - JSON object to be verified
252
+ _signature_ - signature of the JSON object
253
+
254
+ Returns true if the signature is valid, false otherwise
255
+
106
256
  <hr />
257
+
258
+ account.**getSuggestedMaxFee**(estimateFeeAction, details) => _Promise < BigNumberish >_
259
+
260
+ Gets Suggested Max Fee based on the transaction type.
261
+
262
+ The _details_ object may include any of:
263
+
264
+ - details.**blockIdentifier**
265
+ - details.**nonce**
@@ -18,6 +18,10 @@ Contracts allow you to transform Cairo values, like `Uint256` to `BigNumber`. It
18
18
 
19
19
  ## Properties
20
20
 
21
+ contract.**abi** => _Abi_
22
+
23
+ The ABI the contract was constructed with.
24
+
21
25
  contract.**address** => _string_
22
26
 
23
27
  The address the contract was constructed/connected with.
@@ -30,16 +34,48 @@ contract.**deployTransactionHash** => _string | null_
30
34
 
31
35
  If the Contract object is the result of a ContractFactory deployment, this is the transaction which was used to deploy the contract.
32
36
 
33
- contract.**abi** => _Abi_
37
+ ## Methods
34
38
 
35
- The ABI the contract was constructed with.
39
+ contract.**attach**(address) => void
36
40
 
37
- ## Methods
41
+ Saves the address of the contract deployed on network that will be used for interaction.
42
+
43
+ _address_ - address of the contract.
44
+
45
+ <br></br>
46
+
47
+ contract.**connect**(providerOrAccount) => void
48
+
49
+ Attaches to new Provider or Account
50
+
51
+ <br></br>
38
52
 
39
53
  contract.**deployed**() => _Promise < Contract >_
40
54
 
41
55
  If the Contract object is the result of a ContractFactory deployment, this method will wait for the transaction to be resolved.
42
56
 
57
+ <br></br>
58
+
59
+ contract.**call**(method, args, options) => _Promise < Result >_
60
+
61
+ Calls a method on a contract.
62
+
63
+ <br></br>
64
+
65
+ contract.**invoke**(method, args, options) => _Promise < InvokeFunctionResponse >_
66
+
67
+ Invokes a method on a contract.
68
+
69
+ <br></br>
70
+
71
+ contract.**estimate**(method, args, options) => _Promise < any >_
72
+
73
+ Estimates a method on a contract.
74
+
75
+ <br></br>
76
+
77
+ contract.**populate**(method, args, options) => _Invocation_
78
+
43
79
  ## Meta-Class
44
80
 
45
81
  A Meta-Class is a Class which has any of its properties determined at run-time. The Contract object uses a Contract's ABI to determine what methods are available, so the following sections describe the generic ways to interact with the properties added at run-time during the Contract constructor.