starknet 3.13.0 → 3.13.1

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/CHANGELOG.md CHANGED
@@ -1,3 +1,9 @@
1
+ ## [3.13.1](https://github.com/0xs34n/starknet.js/compare/v3.13.0...v3.13.1) (2022-06-14)
2
+
3
+ ### Bug Fixes
4
+
5
+ - account estimate fee interface ([51e8cf6](https://github.com/0xs34n/starknet.js/commit/51e8cf6858acd5aed003f8f1c4d755088684f134))
6
+
1
7
  # [3.13.0](https://github.com/0xs34n/starknet.js/compare/v3.12.3...v3.13.0) (2022-06-14)
2
8
 
3
9
  ### Bug Fixes
@@ -1,5 +1,4 @@
1
1
  import { Provider, ProviderInterface } from '../provider';
2
- import { BlockIdentifier } from '../provider/utils';
3
2
  import { SignerInterface } from '../signer';
4
3
  import {
5
4
  Abi,
@@ -10,7 +9,7 @@ import {
10
9
  Signature,
11
10
  Transaction,
12
11
  } from '../types';
13
- import { EstimateFee } from '../types/account';
12
+ import { EstimateFee, EstimateFeeDetails } from '../types/account';
14
13
  import { BigNumberish } from '../utils/number';
15
14
  import { TypedData } from '../utils/typedData';
16
15
  import { AccountInterface } from './interface';
@@ -25,13 +24,7 @@ export declare class Account extends Provider implements AccountInterface {
25
24
  getNonce(): Promise<string>;
26
25
  estimateFee(
27
26
  calls: Call | Call[],
28
- {
29
- nonce: providedNonce,
30
- blockIdentifier,
31
- }?: {
32
- nonce?: BigNumberish;
33
- blockIdentifier?: BlockIdentifier;
34
- }
27
+ { nonce: providedNonce, blockIdentifier }?: EstimateFeeDetails
35
28
  ): Promise<EstimateFee>;
36
29
  /**
37
30
  * Invoke execute function in account contract
@@ -5,11 +5,10 @@ import {
5
5
  AddTransactionResponse,
6
6
  Call,
7
7
  DeployContractPayload,
8
- Invocation,
9
8
  InvocationsDetails,
10
9
  Signature,
11
10
  } from '../types';
12
- import { EstimateFee } from '../types/account';
11
+ import { EstimateFee, EstimateFeeDetails } from '../types/account';
13
12
  import { BigNumberish } from '../utils/number';
14
13
  import { TypedData } from '../utils/typedData/types';
15
14
  export declare abstract class AccountInterface extends ProviderInterface {
@@ -40,7 +39,10 @@ export declare abstract class AccountInterface extends ProviderInterface {
40
39
  *
41
40
  * @returns response from addTransaction
42
41
  */
43
- abstract estimateFee(invocation: Invocation): Promise<EstimateFee>;
42
+ abstract estimateFee(
43
+ calls: Call | Call[],
44
+ estimateFeeDetails?: EstimateFeeDetails
45
+ ): Promise<EstimateFee>;
44
46
  /**
45
47
  * Invoke execute function in account contract
46
48
  *
@@ -148,6 +148,6 @@ export declare class Contract implements ContractInterface {
148
148
  blockIdentifier?: BlockIdentifier;
149
149
  }
150
150
  ): Promise<Result>;
151
- estimate(method: string, args?: Array<any>): Promise<import('../types/account').EstimateFee>;
151
+ estimate(method: string, args?: Array<any>): Promise<import('../types').EstimateFee>;
152
152
  populate(method: string, args?: Array<any>): Invocation;
153
153
  }
@@ -1,8 +1,7 @@
1
1
  import { Provider, ProviderInterface } from '../provider';
2
- import { BlockIdentifier } from '../provider/utils';
3
2
  import { SignerInterface } from '../signer';
4
3
  import { Abi, AddTransactionResponse, Call, InvocationsDetails, KeyPair, Signature, Transaction } from '../types';
5
- import { EstimateFee } from '../types/account';
4
+ import { EstimateFee, EstimateFeeDetails } from '../types/account';
6
5
  import { BigNumberish } from '../utils/number';
7
6
  import { TypedData } from '../utils/typedData';
8
7
  import { AccountInterface } from './interface';
@@ -11,10 +10,7 @@ export declare class Account extends Provider implements AccountInterface {
11
10
  signer: SignerInterface;
12
11
  constructor(provider: ProviderInterface, address: string, keyPairOrSigner: KeyPair | SignerInterface);
13
12
  getNonce(): Promise<string>;
14
- estimateFee(calls: Call | Call[], { nonce: providedNonce, blockIdentifier, }?: {
15
- nonce?: BigNumberish;
16
- blockIdentifier?: BlockIdentifier;
17
- }): Promise<EstimateFee>;
13
+ estimateFee(calls: Call | Call[], { nonce: providedNonce, blockIdentifier }?: EstimateFeeDetails): Promise<EstimateFee>;
18
14
  /**
19
15
  * Invoke execute function in account contract
20
16
  *
@@ -1,7 +1,7 @@
1
1
  import { ProviderInterface } from '../provider';
2
2
  import { SignerInterface } from '../signer';
3
- import { Abi, AddTransactionResponse, Call, DeployContractPayload, Invocation, InvocationsDetails, Signature } from '../types';
4
- import { EstimateFee } from '../types/account';
3
+ import { Abi, AddTransactionResponse, Call, DeployContractPayload, InvocationsDetails, Signature } from '../types';
4
+ import { EstimateFee, EstimateFeeDetails } from '../types/account';
5
5
  import { BigNumberish } from '../utils/number';
6
6
  import { TypedData } from '../utils/typedData/types';
7
7
  export declare abstract class AccountInterface extends ProviderInterface {
@@ -29,7 +29,7 @@ export declare abstract class AccountInterface extends ProviderInterface {
29
29
  *
30
30
  * @returns response from addTransaction
31
31
  */
32
- abstract estimateFee(invocation: Invocation): Promise<EstimateFee>;
32
+ abstract estimateFee(calls: Call | Call[], estimateFeeDetails?: EstimateFeeDetails): Promise<EstimateFee>;
33
33
  /**
34
34
  * Invoke execute function in account contract
35
35
  *
@@ -119,6 +119,6 @@ export declare class Contract implements ContractInterface {
119
119
  call(method: string, args?: Array<any>, { blockIdentifier, }?: {
120
120
  blockIdentifier?: BlockIdentifier;
121
121
  }): Promise<Result>;
122
- estimate(method: string, args?: Array<any>): Promise<import("../types/account").EstimateFee>;
122
+ estimate(method: string, args?: Array<any>): Promise<import("../types").EstimateFee>;
123
123
  populate(method: string, args?: Array<any>): Invocation;
124
124
  }
@@ -85,9 +85,9 @@ export declare class Provider implements ProviderInterface {
85
85
  */
86
86
  getTransactionStatus(txHash: BigNumberish): Promise<GetTransactionStatusResponse>;
87
87
  /**
88
- * Gets the transaction receipt from a tx hash or tx id.
88
+ * Gets the transaction receipt from a tx hash.
89
89
  *
90
- * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L104-L111)
90
+ * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/167b28bcd940fd25ea3816204fa882a0b0a49603/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L183)
91
91
  *
92
92
  * @param txHash
93
93
  * @returns the transaction receipt object
@@ -321,9 +321,9 @@ var Provider = /** @class */ (function () {
321
321
  });
322
322
  };
323
323
  /**
324
- * Gets the transaction receipt from a tx hash or tx id.
324
+ * Gets the transaction receipt from a tx hash.
325
325
  *
326
- * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L104-L111)
326
+ * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/167b28bcd940fd25ea3816204fa882a0b0a49603/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L183)
327
327
  *
328
328
  * @param txHash
329
329
  * @returns the transaction receipt object
@@ -74,6 +74,14 @@ export declare abstract class ProviderInterface {
74
74
  * @returns the transacton object { transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? }
75
75
  */
76
76
  abstract getTransaction(txHash: BigNumberish): Promise<GetTransactionResponse>;
77
+ /**
78
+ * Gets the transaction receipt from a tx hash.
79
+ *
80
+ * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/167b28bcd940fd25ea3816204fa882a0b0a49603/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L183)
81
+ *
82
+ * @param txHash
83
+ * @returns the transaction receipt object
84
+ */
77
85
  abstract getTransactionReceipt(txHash: BigNumberish): Promise<TransactionReceiptResponse>;
78
86
  /**
79
87
  * Deploys a given compiled contract (json) to starknet
@@ -1,5 +1,11 @@
1
1
  import BN from 'bn.js';
2
+ import { BlockIdentifier } from '../provider/utils';
3
+ import { BigNumberish } from '../utils/number';
2
4
  import { EstimateFeeResponse } from './api';
3
5
  export interface EstimateFee extends EstimateFeeResponse {
4
6
  suggestedMaxFee: BN;
5
7
  }
8
+ export interface EstimateFeeDetails {
9
+ nonce?: BigNumberish;
10
+ blockIdentifier?: BlockIdentifier;
11
+ }
@@ -2,3 +2,4 @@ export * from './lib';
2
2
  export * from './api';
3
3
  export * from './signer';
4
4
  export * from './contract';
5
+ export * from './account';
@@ -18,3 +18,4 @@ __exportStar(require("./lib"), exports);
18
18
  __exportStar(require("./api"), exports);
19
19
  __exportStar(require("./signer"), exports);
20
20
  __exportStar(require("./contract"), exports);
21
+ __exportStar(require("./account"), exports);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "starknet",
3
- "version": "3.13.0",
3
+ "version": "3.13.1",
4
4
  "description": "JavaScript library for StarkNet",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -122,9 +122,9 @@ export declare class Provider implements ProviderInterface {
122
122
  */
123
123
  getTransactionStatus(txHash: BigNumberish): Promise<GetTransactionStatusResponse>;
124
124
  /**
125
- * Gets the transaction receipt from a tx hash or tx id.
125
+ * Gets the transaction receipt from a tx hash.
126
126
  *
127
- * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L104-L111)
127
+ * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/167b28bcd940fd25ea3816204fa882a0b0a49603/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L183)
128
128
  *
129
129
  * @param txHash
130
130
  * @returns the transaction receipt object
@@ -478,9 +478,9 @@ var Provider = /** @class */ (function () {
478
478
  });
479
479
  };
480
480
  /**
481
- * Gets the transaction receipt from a tx hash or tx id.
481
+ * Gets the transaction receipt from a tx hash.
482
482
  *
483
- * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L104-L111)
483
+ * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/167b28bcd940fd25ea3816204fa882a0b0a49603/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L183)
484
484
  *
485
485
  * @param txHash
486
486
  * @returns the transaction receipt object
@@ -96,6 +96,14 @@ export declare abstract class ProviderInterface {
96
96
  * @returns the transacton object { transaction_id, status, transaction, block_number?, block_number?, transaction_index?, transaction_failure_reason? }
97
97
  */
98
98
  abstract getTransaction(txHash: BigNumberish): Promise<GetTransactionResponse>;
99
+ /**
100
+ * Gets the transaction receipt from a tx hash.
101
+ *
102
+ * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/167b28bcd940fd25ea3816204fa882a0b0a49603/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L183)
103
+ *
104
+ * @param txHash
105
+ * @returns the transaction receipt object
106
+ */
99
107
  abstract getTransactionReceipt(txHash: BigNumberish): Promise<TransactionReceiptResponse>;
100
108
  /**
101
109
  * Deploys a given compiled contract (json) to starknet
@@ -2,7 +2,6 @@ import assert from 'minimalistic-assert';
2
2
 
3
3
  import { ZERO } from '../constants';
4
4
  import { Provider, ProviderInterface } from '../provider';
5
- import { BlockIdentifier } from '../provider/utils';
6
5
  import { Signer, SignerInterface } from '../signer';
7
6
  import {
8
7
  Abi,
@@ -15,7 +14,7 @@ import {
15
14
  Signature,
16
15
  Transaction,
17
16
  } from '../types';
18
- import { EstimateFee } from '../types/account';
17
+ import { EstimateFee, EstimateFeeDetails } from '../types/account';
19
18
  import { sign } from '../utils/ellipticCurve';
20
19
  import {
21
20
  computeHashOnElements,
@@ -56,10 +55,7 @@ export class Account extends Provider implements AccountInterface {
56
55
 
57
56
  public async estimateFee(
58
57
  calls: Call | Call[],
59
- {
60
- nonce: providedNonce,
61
- blockIdentifier = 'pending',
62
- }: { nonce?: BigNumberish; blockIdentifier?: BlockIdentifier } = {}
58
+ { nonce: providedNonce, blockIdentifier = 'pending' }: EstimateFeeDetails = {}
63
59
  ): Promise<EstimateFee> {
64
60
  const transactions = Array.isArray(calls) ? calls : [calls];
65
61
  const nonce = providedNonce ?? (await this.getNonce());
@@ -5,11 +5,10 @@ import {
5
5
  AddTransactionResponse,
6
6
  Call,
7
7
  DeployContractPayload,
8
- Invocation,
9
8
  InvocationsDetails,
10
9
  Signature,
11
10
  } from '../types';
12
- import { EstimateFee } from '../types/account';
11
+ import { EstimateFee, EstimateFeeDetails } from '../types/account';
13
12
  import { BigNumberish } from '../utils/number';
14
13
  import { TypedData } from '../utils/typedData/types';
15
14
 
@@ -44,7 +43,10 @@ export abstract class AccountInterface extends ProviderInterface {
44
43
  *
45
44
  * @returns response from addTransaction
46
45
  */
47
- public abstract estimateFee(invocation: Invocation): Promise<EstimateFee>;
46
+ public abstract estimateFee(
47
+ calls: Call | Call[],
48
+ estimateFeeDetails?: EstimateFeeDetails
49
+ ): Promise<EstimateFee>;
48
50
 
49
51
  /**
50
52
  * Invoke execute function in account contract
@@ -272,14 +272,13 @@ export class Provider implements ProviderInterface {
272
272
  }
273
273
 
274
274
  /**
275
- * Gets the transaction receipt from a tx hash or tx id.
275
+ * Gets the transaction receipt from a tx hash.
276
276
  *
277
- * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/master/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L104-L111)
277
+ * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/167b28bcd940fd25ea3816204fa882a0b0a49603/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L183)
278
278
  *
279
279
  * @param txHash
280
280
  * @returns the transaction receipt object
281
281
  */
282
-
283
282
  public async getTransactionReceipt(txHash: BigNumberish): Promise<TransactionReceiptResponse> {
284
283
  const txHashHex = toHex(toBN(txHash));
285
284
  return this.fetchEndpoint('get_transaction_receipt', { transactionHash: txHashHex });
@@ -109,6 +109,14 @@ export abstract class ProviderInterface {
109
109
  */
110
110
  public abstract getTransaction(txHash: BigNumberish): Promise<GetTransactionResponse>;
111
111
 
112
+ /**
113
+ * Gets the transaction receipt from a tx hash.
114
+ *
115
+ * [Reference] (https://github.com/starkware-libs/cairo-lang/blob/167b28bcd940fd25ea3816204fa882a0b0a49603/src/starkware/starknet/services/api/feeder_gateway/feeder_gateway_client.py#L183)
116
+ *
117
+ * @param txHash
118
+ * @returns the transaction receipt object
119
+ */
112
120
  public abstract getTransactionReceipt(txHash: BigNumberish): Promise<TransactionReceiptResponse>;
113
121
 
114
122
  /**
@@ -1,7 +1,14 @@
1
1
  import BN from 'bn.js';
2
2
 
3
+ import { BlockIdentifier } from '../provider/utils';
4
+ import { BigNumberish } from '../utils/number';
3
5
  import { EstimateFeeResponse } from './api';
4
6
 
5
7
  export interface EstimateFee extends EstimateFeeResponse {
6
8
  suggestedMaxFee: BN;
7
9
  }
10
+
11
+ export interface EstimateFeeDetails {
12
+ nonce?: BigNumberish;
13
+ blockIdentifier?: BlockIdentifier;
14
+ }
@@ -2,3 +2,4 @@ export * from './lib';
2
2
  export * from './api';
3
3
  export * from './signer';
4
4
  export * from './contract';
5
+ export * from './account';
@@ -1,6 +1,12 @@
1
1
  import BN from 'bn.js';
2
2
 
3
+ import { BlockIdentifier } from '../provider/utils';
4
+ import { BigNumberish } from '../utils/number';
3
5
  import { EstimateFeeResponse } from './api';
4
6
  export interface EstimateFee extends EstimateFeeResponse {
5
7
  suggestedMaxFee: BN;
6
8
  }
9
+ export interface EstimateFeeDetails {
10
+ nonce?: BigNumberish;
11
+ blockIdentifier?: BlockIdentifier;
12
+ }
package/types/index.d.ts CHANGED
@@ -2,3 +2,4 @@ export * from './lib';
2
2
  export * from './api';
3
3
  export * from './signer';
4
4
  export * from './contract';
5
+ export * from './account';
package/types/index.js CHANGED
@@ -31,3 +31,4 @@ __exportStar(require('./lib'), exports);
31
31
  __exportStar(require('./api'), exports);
32
32
  __exportStar(require('./signer'), exports);
33
33
  __exportStar(require('./contract'), exports);
34
+ __exportStar(require('./account'), exports);
@@ -131,11 +131,11 @@ Gets the status of a transaction.
131
131
 
132
132
  <hr/>
133
133
 
134
- provider.**getTransactionReceipt**(txHash, txId) => _Promise < TransactionReceipt >_
134
+ provider.**getTransactionReceipt**(txHash) => _Promise < TransactionReceiptResponse >_
135
135
 
136
136
  Gets the status of a transaction.
137
137
 
138
- ###### _TransactionReceipt_
138
+ ###### _TransactionReceiptResponse_
139
139
 
140
140
  ```
141
141
  {