starknet 4.6.0 → 4.7.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.
- package/CHANGELOG.md +25 -0
- package/__tests__/account.test.ts +2 -5
- package/__tests__/contract.test.ts +0 -1
- package/__tests__/defaultProvider.test.ts +9 -1
- package/__tests__/sequencerProvider.test.ts +10 -8
- package/__tests__/utils/ellipticalCurve.test.ts +7 -8
- package/account/default.d.ts +3 -2
- package/account/default.js +22 -29
- package/account/interface.d.ts +2 -1
- package/contract/contractFactory.d.ts +1 -2
- package/contract/default.d.ts +2 -2
- package/contract/default.js +7 -3
- package/dist/account/default.d.ts +3 -2
- package/dist/account/default.js +22 -29
- package/dist/account/interface.d.ts +2 -1
- package/dist/contract/contractFactory.d.ts +1 -2
- package/dist/contract/default.d.ts +2 -2
- package/dist/contract/default.js +7 -3
- package/dist/provider/default.d.ts +4 -3
- package/dist/provider/default.js +9 -3
- package/dist/provider/interface.d.ts +10 -3
- package/dist/provider/rpc.d.ts +12 -10
- package/dist/provider/rpc.js +80 -72
- package/dist/provider/sequencer.d.ts +4 -3
- package/dist/provider/sequencer.js +14 -6
- package/dist/signer/default.d.ts +2 -2
- package/dist/signer/default.js +2 -2
- package/dist/signer/interface.d.ts +2 -2
- package/dist/types/api/openrpc.d.ts +17 -27
- package/dist/types/api/rpc.d.ts +4 -128
- package/dist/types/api/sequencer.d.ts +15 -4
- package/dist/types/lib.d.ts +10 -4
- package/dist/types/provider.d.ts +3 -2
- package/dist/utils/hash.d.ts +2 -2
- package/dist/utils/hash.js +5 -5
- package/dist/utils/responseParser/rpc.d.ts +2 -5
- package/dist/utils/responseParser/rpc.js +2 -38
- package/package.json +1 -1
- package/provider/default.d.ts +4 -3
- package/provider/default.js +9 -3
- package/provider/interface.d.ts +10 -3
- package/provider/rpc.d.ts +12 -10
- package/provider/rpc.js +80 -72
- package/provider/sequencer.d.ts +4 -3
- package/provider/sequencer.js +14 -6
- package/signer/default.d.ts +2 -2
- package/signer/default.js +2 -2
- package/signer/interface.d.ts +2 -2
- package/src/account/default.ts +21 -20
- package/src/account/interface.ts +2 -1
- package/src/contract/contractFactory.ts +1 -2
- package/src/contract/default.ts +16 -8
- package/src/provider/default.ts +12 -5
- package/src/provider/interface.ts +15 -4
- package/src/provider/rpc.ts +89 -73
- package/src/provider/sequencer.ts +16 -8
- package/src/signer/default.ts +8 -8
- package/src/signer/interface.ts +2 -2
- package/src/types/api/openrpc.ts +20 -25
- package/src/types/api/rpc.ts +4 -128
- package/src/types/api/sequencer.ts +17 -4
- package/src/types/lib.ts +7 -5
- package/src/types/provider.ts +3 -2
- package/src/utils/hash.ts +7 -6
- package/src/utils/responseParser/rpc.ts +7 -25
- package/types/api/openrpc.d.ts +17 -27
- package/types/api/rpc.d.ts +4 -128
- package/types/api/sequencer.d.ts +15 -4
- package/types/lib.d.ts +10 -4
- package/types/provider.d.ts +3 -2
- package/utils/hash.d.ts +2 -2
- package/utils/hash.js +5 -5
- package/utils/responseParser/rpc.d.ts +2 -5
- package/utils/responseParser/rpc.js +2 -38
- package/www/docs/API/account.md +3 -3
- package/www/docs/API/contract.md +2 -2
- package/www/docs/API/provider.md +6 -0
- package/www/docs/API/utils.md +2 -2
package/types/api/rpc.d.ts
CHANGED
|
@@ -9,9 +9,11 @@ export declare namespace RPC {
|
|
|
9
9
|
message: string;
|
|
10
10
|
};
|
|
11
11
|
};
|
|
12
|
-
type ChainId = OPENRPC.
|
|
12
|
+
type ChainId = OPENRPC.CHAIN_ID;
|
|
13
|
+
type CallResponse = OPENRPC.CallResponse;
|
|
13
14
|
type ContractAddress = ADDRESS;
|
|
14
15
|
type Felt = FELT;
|
|
16
|
+
type Nonce = OPENRPC.Nonce;
|
|
15
17
|
type ContractClass = OPENRPC.ContractClass;
|
|
16
18
|
type StateUpdate = OPENRPC.StateUpdate;
|
|
17
19
|
type Transaction = OPENRPC.Transaction;
|
|
@@ -37,131 +39,5 @@ export declare namespace RPC {
|
|
|
37
39
|
type InvokedTransaction = OPENRPC.InvokedTransaction;
|
|
38
40
|
type DeclaredTransaction = OPENRPC.DeclaredTransaction;
|
|
39
41
|
type DeployedTransaction = OPENRPC.DeployedTransaction;
|
|
40
|
-
type Methods =
|
|
41
|
-
starknet_pendingTransactions: {
|
|
42
|
-
QUERY: never;
|
|
43
|
-
REQUEST: any[];
|
|
44
|
-
RESPONSE: PendingTransactions;
|
|
45
|
-
};
|
|
46
|
-
starknet_blockHashAndNumber: {
|
|
47
|
-
QUERY: never;
|
|
48
|
-
REQUEST: any[];
|
|
49
|
-
RESPONSE: BlockHashAndNumber;
|
|
50
|
-
};
|
|
51
|
-
starknet_getClassHashAt: {
|
|
52
|
-
QUERY: never;
|
|
53
|
-
REQUEST: any[];
|
|
54
|
-
RESPONSE: Felt;
|
|
55
|
-
};
|
|
56
|
-
starknet_getStateUpdate: {
|
|
57
|
-
QUERY: never;
|
|
58
|
-
REQUEST: any[];
|
|
59
|
-
RESPONSE: OPENRPC.StateUpdate;
|
|
60
|
-
};
|
|
61
|
-
starknet_getClass: {
|
|
62
|
-
QUERY: never;
|
|
63
|
-
REQUEST: any[];
|
|
64
|
-
RESPONSE: OPENRPC.ContractClass;
|
|
65
|
-
};
|
|
66
|
-
starknet_getBlockWithTxHashes: {
|
|
67
|
-
QUERY: never;
|
|
68
|
-
REQUEST: any[];
|
|
69
|
-
RESPONSE: GetBlockWithTxHashesResponse;
|
|
70
|
-
};
|
|
71
|
-
starknet_getBlockWithTxs: {
|
|
72
|
-
QUERY: never;
|
|
73
|
-
REQUEST: any[];
|
|
74
|
-
RESPONSE: GetBlockWithTxs;
|
|
75
|
-
};
|
|
76
|
-
starknet_getNonce: {
|
|
77
|
-
QUERY: never;
|
|
78
|
-
REQUEST: any[];
|
|
79
|
-
RESPONSE: OPENRPC.Nonce;
|
|
80
|
-
};
|
|
81
|
-
starknet_getStorageAt: {
|
|
82
|
-
QUERY: never;
|
|
83
|
-
REQUEST: any[];
|
|
84
|
-
RESPONSE: GetStorageAtResponse;
|
|
85
|
-
};
|
|
86
|
-
starknet_getTransactionByHash: {
|
|
87
|
-
QUERY: never;
|
|
88
|
-
REQUEST: any[];
|
|
89
|
-
RESPONSE: GetTransactionByHashResponse;
|
|
90
|
-
};
|
|
91
|
-
starknet_getTransactionByBlockIdAndIndex: {
|
|
92
|
-
QUERY: never;
|
|
93
|
-
REQUEST: any[];
|
|
94
|
-
RESPONSE: GetTransactionByBlockIdAndIndex;
|
|
95
|
-
};
|
|
96
|
-
starknet_getTransactionReceipt: {
|
|
97
|
-
QUERY: never;
|
|
98
|
-
REQUEST: any[];
|
|
99
|
-
RESPONSE: TransactionReceipt;
|
|
100
|
-
};
|
|
101
|
-
starknet_getBlockTransactionCount: {
|
|
102
|
-
QUERY: never;
|
|
103
|
-
REQUEST: any[];
|
|
104
|
-
RESPONSE: GetTransactionCountResponse;
|
|
105
|
-
};
|
|
106
|
-
starknet_call: {
|
|
107
|
-
QUERY: never;
|
|
108
|
-
REQUEST: any[];
|
|
109
|
-
RESPONSE: string[];
|
|
110
|
-
};
|
|
111
|
-
starknet_estimateFee: {
|
|
112
|
-
QUERY: never;
|
|
113
|
-
REQUEST: any[];
|
|
114
|
-
RESPONSE: OPENRPC.EstimatedFee;
|
|
115
|
-
};
|
|
116
|
-
starknet_blockNumber: {
|
|
117
|
-
QUERY: never;
|
|
118
|
-
REQUEST: any[];
|
|
119
|
-
RESPONSE: GetBlockNumberResponse;
|
|
120
|
-
};
|
|
121
|
-
starknet_chainId: {
|
|
122
|
-
QUERY: never;
|
|
123
|
-
REQUEST: any[];
|
|
124
|
-
RESPONSE: OPENRPC.ChainId;
|
|
125
|
-
};
|
|
126
|
-
starknet_syncing: {
|
|
127
|
-
QUERY: never;
|
|
128
|
-
REQUEST: any[];
|
|
129
|
-
RESPONSE: GetSyncingStatsResponse;
|
|
130
|
-
};
|
|
131
|
-
starknet_getEvents: {
|
|
132
|
-
QUERY: never;
|
|
133
|
-
REQUEST: any[];
|
|
134
|
-
RESPONSE: GetEventsResponse;
|
|
135
|
-
};
|
|
136
|
-
starknet_addInvokeTransaction: {
|
|
137
|
-
QUERY: never;
|
|
138
|
-
REQUEST: any[];
|
|
139
|
-
RESPONSE: OPENRPC.InvokedTransaction;
|
|
140
|
-
};
|
|
141
|
-
starknet_addDeployTransaction: {
|
|
142
|
-
QUERY: never;
|
|
143
|
-
REQUEST: any[];
|
|
144
|
-
RESPONSE: OPENRPC.DeployedTransaction;
|
|
145
|
-
};
|
|
146
|
-
starknet_addDeclareTransaction: {
|
|
147
|
-
QUERY: never;
|
|
148
|
-
REQUEST: any[];
|
|
149
|
-
RESPONSE: OPENRPC.DeclaredTransaction;
|
|
150
|
-
};
|
|
151
|
-
starknet_getClassAt: {
|
|
152
|
-
QUERY: never;
|
|
153
|
-
REQUEST: any[];
|
|
154
|
-
RESPONSE: any;
|
|
155
|
-
};
|
|
156
|
-
starknet_traceTransaction: {
|
|
157
|
-
QUERY: never;
|
|
158
|
-
REQUEST: any[];
|
|
159
|
-
RESPONSE: any;
|
|
160
|
-
};
|
|
161
|
-
starknet_traceBlockTransactions: {
|
|
162
|
-
QUERY: never;
|
|
163
|
-
REQUEST: any[];
|
|
164
|
-
RESPONSE: any;
|
|
165
|
-
};
|
|
166
|
-
};
|
|
42
|
+
type Methods = OPENRPC.Methods;
|
|
167
43
|
}
|
package/types/api/sequencer.d.ts
CHANGED
|
@@ -80,9 +80,8 @@ export declare namespace Sequencer {
|
|
|
80
80
|
contract_address: string;
|
|
81
81
|
signature?: Signature;
|
|
82
82
|
entry_point_type?: EntryPointType;
|
|
83
|
-
entry_point_selector: string;
|
|
84
83
|
calldata?: RawCalldata;
|
|
85
|
-
nonce
|
|
84
|
+
nonce: BigNumberish;
|
|
86
85
|
max_fee?: BigNumberish;
|
|
87
86
|
version?: BigNumberish;
|
|
88
87
|
};
|
|
@@ -99,6 +98,7 @@ export declare namespace Sequencer {
|
|
|
99
98
|
};
|
|
100
99
|
interface InvokeFunctionTransactionResponse extends InvokeFunctionTransaction {
|
|
101
100
|
transaction_hash: string;
|
|
101
|
+
entry_point_selector: string;
|
|
102
102
|
}
|
|
103
103
|
type TransactionResponse = DeclareTransaction | DeployTransaction | InvokeFunctionTransactionResponse;
|
|
104
104
|
type SuccessfulTransactionResponse = {
|
|
@@ -166,10 +166,13 @@ export declare namespace Sequencer {
|
|
|
166
166
|
gas_price: string;
|
|
167
167
|
sequencer_address: string;
|
|
168
168
|
};
|
|
169
|
-
type CallContractTransaction = Omit<InvokeFunctionTransaction, 'type' | 'entry_point_type' | 'nonce'
|
|
169
|
+
type CallContractTransaction = Omit<InvokeFunctionTransaction, 'type' | 'entry_point_type' | 'nonce'> & {
|
|
170
|
+
entry_point_selector: string;
|
|
171
|
+
};
|
|
170
172
|
type CallContractResponse = {
|
|
171
173
|
result: string[];
|
|
172
174
|
};
|
|
175
|
+
type EstimateFeeTransaction = Omit<InvokeFunctionTransaction, 'max_fee' | 'entry_point_type'>;
|
|
173
176
|
type EstimateFeeResponse = {
|
|
174
177
|
overall_fee: number;
|
|
175
178
|
gas_price: number;
|
|
@@ -217,6 +220,14 @@ export declare namespace Sequencer {
|
|
|
217
220
|
REQUEST: never;
|
|
218
221
|
RESPONSE: TransactionReceiptResponse;
|
|
219
222
|
};
|
|
223
|
+
get_nonce: {
|
|
224
|
+
QUERY: {
|
|
225
|
+
contractAddress: string;
|
|
226
|
+
blockIdentifier: BlockIdentifier;
|
|
227
|
+
};
|
|
228
|
+
REQUEST: never;
|
|
229
|
+
RESPONSE: BigNumberish;
|
|
230
|
+
};
|
|
220
231
|
get_storage_at: {
|
|
221
232
|
QUERY: {
|
|
222
233
|
contractAddress: string;
|
|
@@ -252,7 +263,7 @@ export declare namespace Sequencer {
|
|
|
252
263
|
QUERY: {
|
|
253
264
|
blockIdentifier: BlockIdentifier;
|
|
254
265
|
};
|
|
255
|
-
REQUEST:
|
|
266
|
+
REQUEST: EstimateFeeTransaction;
|
|
256
267
|
RESPONSE: EstimateFeeResponse;
|
|
257
268
|
};
|
|
258
269
|
get_class_by_hash: {
|
package/types/lib.d.ts
CHANGED
|
@@ -6,24 +6,30 @@ export declare type RawCalldata = BigNumberish[];
|
|
|
6
6
|
export declare type DeployContractPayload = {
|
|
7
7
|
contract: CompiledContract | string;
|
|
8
8
|
constructorCalldata?: RawCalldata;
|
|
9
|
-
addressSalt?:
|
|
9
|
+
addressSalt?: string;
|
|
10
10
|
};
|
|
11
11
|
export declare type DeclareContractPayload = {
|
|
12
12
|
contract: CompiledContract | string;
|
|
13
13
|
version?: BigNumberish;
|
|
14
14
|
};
|
|
15
|
-
export declare type
|
|
15
|
+
export declare type CallDetails = {
|
|
16
16
|
contractAddress: string;
|
|
17
|
-
entrypoint: string;
|
|
18
17
|
calldata?: RawCalldata;
|
|
18
|
+
};
|
|
19
|
+
export declare type Invocation = CallDetails & {
|
|
19
20
|
signature?: Signature;
|
|
20
21
|
};
|
|
21
|
-
export declare type Call =
|
|
22
|
+
export declare type Call = CallDetails & {
|
|
23
|
+
entrypoint: string;
|
|
24
|
+
};
|
|
22
25
|
export declare type InvocationsDetails = {
|
|
23
26
|
nonce?: BigNumberish;
|
|
24
27
|
maxFee?: BigNumberish;
|
|
25
28
|
version?: BigNumberish;
|
|
26
29
|
};
|
|
30
|
+
export declare type InvocationsDetailsWithNonce = InvocationsDetails & {
|
|
31
|
+
nonce: BigNumberish;
|
|
32
|
+
};
|
|
27
33
|
export declare type Status = 'NOT_RECEIVED' | 'RECEIVED' | 'PENDING' | 'ACCEPTED_ON_L2' | 'ACCEPTED_ON_L1' | 'REJECTED';
|
|
28
34
|
export declare type TransactionStatus = 'TRANSACTION_RECEIVED';
|
|
29
35
|
export declare type Type = 'DECLARE' | 'DEPLOY' | 'INVOKE_FUNCTION';
|
package/types/provider.d.ts
CHANGED
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* Intersection (sequencer response ∩ (∪ rpc responses))
|
|
4
4
|
*/
|
|
5
5
|
import BN from 'bn.js';
|
|
6
|
-
import {
|
|
6
|
+
import { RPC } from './api/rpc';
|
|
7
|
+
import { Abi, CompressedProgram, RawCalldata, Signature, Status } from './lib';
|
|
7
8
|
export interface GetBlockResponse {
|
|
8
9
|
timestamp: number;
|
|
9
10
|
block_hash: string;
|
|
@@ -35,7 +36,7 @@ export interface ContractEntryPoint {
|
|
|
35
36
|
}
|
|
36
37
|
export interface ContractClass {
|
|
37
38
|
program: CompressedProgram;
|
|
38
|
-
entry_points_by_type:
|
|
39
|
+
entry_points_by_type: RPC.ContractClass['entry_points_by_type'];
|
|
39
40
|
abi?: Abi;
|
|
40
41
|
}
|
|
41
42
|
export interface DeclareTransactionResponse extends CommonTransactionResponse {
|
package/utils/hash.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import BN from 'bn.js';
|
|
|
2
2
|
import { StarknetChainId, TransactionHashPrefix } from '../constants';
|
|
3
3
|
import { RawCalldata } from '../types/lib';
|
|
4
4
|
import { BigNumberish } from './number';
|
|
5
|
-
export declare const transactionVersion =
|
|
5
|
+
export declare const transactionVersion = 1;
|
|
6
6
|
export declare const feeTransactionVersion: BN;
|
|
7
7
|
export declare function keccakBn(value: BigNumberish): string;
|
|
8
8
|
/**
|
|
@@ -25,5 +25,5 @@ export declare function pedersen(input: [BigNumberish, BigNumberish]): string;
|
|
|
25
25
|
export declare function computeHashOnElements(data: BigNumberish[]): string;
|
|
26
26
|
export declare function calculateTransactionHashCommon(txHashPrefix: TransactionHashPrefix, version: BigNumberish, contractAddress: BigNumberish, entryPointSelector: BigNumberish, calldata: BigNumberish[], maxFee: BigNumberish, chainId: StarknetChainId, additionalData?: BigNumberish[]): string;
|
|
27
27
|
export declare function calculateDeployTransactionHash(contractAddress: BigNumberish, constructorCalldata: BigNumberish[], version: BigNumberish, chainId: StarknetChainId): string;
|
|
28
|
-
export declare function
|
|
28
|
+
export declare function calculateTransactionHash(contractAddress: BigNumberish, version: BigNumberish, calldata: BigNumberish[], maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string;
|
|
29
29
|
export declare function calculateContractAddressFromHash(salt: BigNumberish, classHash: BigNumberish, constructorCalldata: RawCalldata, deployerAddress: BigNumberish): string;
|
package/utils/hash.js
CHANGED
|
@@ -28,7 +28,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
28
28
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
29
29
|
};
|
|
30
30
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
31
|
-
exports.calculateContractAddressFromHash = exports.
|
|
31
|
+
exports.calculateContractAddressFromHash = exports.calculateTransactionHash = exports.calculateDeployTransactionHash = exports.calculateTransactionHashCommon = exports.computeHashOnElements = exports.pedersen = exports.getSelectorFromName = exports.starknetKeccak = exports.keccakBn = exports.feeTransactionVersion = exports.transactionVersion = void 0;
|
|
32
32
|
var keccak_1 = require("ethereum-cryptography/keccak");
|
|
33
33
|
var utils_1 = require("ethereum-cryptography/utils");
|
|
34
34
|
var minimalistic_assert_1 = __importDefault(require("minimalistic-assert"));
|
|
@@ -36,7 +36,7 @@ var constants_1 = require("../constants");
|
|
|
36
36
|
var ellipticCurve_1 = require("./ellipticCurve");
|
|
37
37
|
var encode_1 = require("./encode");
|
|
38
38
|
var number_1 = require("./number");
|
|
39
|
-
exports.transactionVersion =
|
|
39
|
+
exports.transactionVersion = 1;
|
|
40
40
|
exports.feeTransactionVersion = (0, number_1.toBN)(2).pow((0, number_1.toBN)(128)).add((0, number_1.toBN)(exports.transactionVersion));
|
|
41
41
|
function keccakBn(value) {
|
|
42
42
|
var hexWithoutPrefix = (0, encode_1.removeHexPrefix)((0, number_1.toHex)((0, number_1.toBN)(value)));
|
|
@@ -117,10 +117,10 @@ function calculateDeployTransactionHash(contractAddress, constructorCalldata, ve
|
|
|
117
117
|
return calculateTransactionHashCommon(constants_1.TransactionHashPrefix.DEPLOY, version, contractAddress, getSelectorFromName('constructor'), constructorCalldata, constants_1.ZERO, chainId);
|
|
118
118
|
}
|
|
119
119
|
exports.calculateDeployTransactionHash = calculateDeployTransactionHash;
|
|
120
|
-
function
|
|
121
|
-
return calculateTransactionHashCommon(constants_1.TransactionHashPrefix.INVOKE, version, contractAddress,
|
|
120
|
+
function calculateTransactionHash(contractAddress, version, calldata, maxFee, chainId, nonce) {
|
|
121
|
+
return calculateTransactionHashCommon(constants_1.TransactionHashPrefix.INVOKE, version, contractAddress, 0, calldata, maxFee, chainId, [nonce]);
|
|
122
122
|
}
|
|
123
|
-
exports.
|
|
123
|
+
exports.calculateTransactionHash = calculateTransactionHash;
|
|
124
124
|
function calculateContractAddressFromHash(salt, classHash, constructorCalldata, deployerAddress) {
|
|
125
125
|
var constructorCalldataHash = computeHashOnElements(constructorCalldata);
|
|
126
126
|
var CONTRACT_ADDRESS_PREFIX = (0, number_1.toFelt)('0x535441524b4e45545f434f4e54524143545f41444452455353'); // Equivalent to 'STARKNET_CONTRACT_ADDRESS'
|
|
@@ -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,
|
|
5
|
+
import { CallContractResponse, EstimateFeeResponse, GetBlockResponse, GetTransactionReceiptResponse, GetTransactionResponse } from '../../types';
|
|
6
6
|
import { RPC } from '../../types/api';
|
|
7
7
|
import { ResponseParser } from '.';
|
|
8
8
|
declare type RpcGetBlockResponse = RPC.GetBlockWithTxHashesResponse & {
|
|
@@ -14,14 +14,11 @@ declare type GetTransactionByHashResponse = RPC.GetTransactionByHashResponse & {
|
|
|
14
14
|
declare type TransactionReceipt = RPC.TransactionReceipt & {
|
|
15
15
|
[key: string]: any;
|
|
16
16
|
};
|
|
17
|
-
export declare class RPCResponseParser
|
|
17
|
+
export declare class RPCResponseParser implements Omit<ResponseParser, 'parseDeclareContractResponse' | 'parseDeployContractResponse' | 'parseInvokeFunctionResponse'> {
|
|
18
18
|
parseGetBlockResponse(res: RpcGetBlockResponse): GetBlockResponse;
|
|
19
19
|
parseGetTransactionResponse(res: GetTransactionByHashResponse): GetTransactionResponse;
|
|
20
20
|
parseGetTransactionReceiptResponse(res: TransactionReceipt): GetTransactionReceiptResponse;
|
|
21
21
|
parseFeeEstimateResponse(res: RPC.EstimateFeeResponse): EstimateFeeResponse;
|
|
22
22
|
parseCallContractResponse(res: Array<string>): CallContractResponse;
|
|
23
|
-
parseInvokeFunctionResponse(res: RPC.InvokedTransaction): InvokeFunctionResponse;
|
|
24
|
-
parseDeployContractResponse(res: RPC.DeployedTransaction): DeployContractResponse;
|
|
25
|
-
parseDeclareContractResponse(res: RPC.DeclaredTransaction): DeclareContractResponse;
|
|
26
23
|
}
|
|
27
24
|
export {};
|
|
@@ -1,27 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __extends = (this && this.__extends) || (function () {
|
|
3
|
-
var extendStatics = function (d, b) {
|
|
4
|
-
extendStatics = Object.setPrototypeOf ||
|
|
5
|
-
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
|
6
|
-
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
|
|
7
|
-
return extendStatics(d, b);
|
|
8
|
-
};
|
|
9
|
-
return function (d, b) {
|
|
10
|
-
if (typeof b !== "function" && b !== null)
|
|
11
|
-
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
|
|
12
|
-
extendStatics(d, b);
|
|
13
|
-
function __() { this.constructor = d; }
|
|
14
|
-
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
|
15
|
-
};
|
|
16
|
-
})();
|
|
17
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
3
|
exports.RPCResponseParser = void 0;
|
|
19
4
|
var number_1 = require("../number");
|
|
20
|
-
var
|
|
21
|
-
var RPCResponseParser = /** @class */ (function (_super) {
|
|
22
|
-
__extends(RPCResponseParser, _super);
|
|
5
|
+
var RPCResponseParser = /** @class */ (function () {
|
|
23
6
|
function RPCResponseParser() {
|
|
24
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
|
25
7
|
}
|
|
26
8
|
RPCResponseParser.prototype.parseGetBlockResponse = function (res) {
|
|
27
9
|
return {
|
|
@@ -38,7 +20,6 @@ var RPCResponseParser = /** @class */ (function (_super) {
|
|
|
38
20
|
return {
|
|
39
21
|
calldata: res.calldata || [],
|
|
40
22
|
contract_address: res.contract_address,
|
|
41
|
-
entry_point_selector: res.entry_point_selector,
|
|
42
23
|
max_fee: res.max_fee,
|
|
43
24
|
nonce: res.nonce,
|
|
44
25
|
signature: res.signature || [],
|
|
@@ -69,23 +50,6 @@ var RPCResponseParser = /** @class */ (function (_super) {
|
|
|
69
50
|
result: res,
|
|
70
51
|
};
|
|
71
52
|
};
|
|
72
|
-
RPCResponseParser.prototype.parseInvokeFunctionResponse = function (res) {
|
|
73
|
-
return {
|
|
74
|
-
transaction_hash: res.transaction_hash,
|
|
75
|
-
};
|
|
76
|
-
};
|
|
77
|
-
RPCResponseParser.prototype.parseDeployContractResponse = function (res) {
|
|
78
|
-
return {
|
|
79
|
-
transaction_hash: res.transaction_hash,
|
|
80
|
-
contract_address: res.contract_address,
|
|
81
|
-
};
|
|
82
|
-
};
|
|
83
|
-
RPCResponseParser.prototype.parseDeclareContractResponse = function (res) {
|
|
84
|
-
return {
|
|
85
|
-
transaction_hash: res.transaction_hash,
|
|
86
|
-
class_hash: res.class_hash,
|
|
87
|
-
};
|
|
88
|
-
};
|
|
89
53
|
return RPCResponseParser;
|
|
90
|
-
}(
|
|
54
|
+
}());
|
|
91
55
|
exports.RPCResponseParser = RPCResponseParser;
|
package/www/docs/API/account.md
CHANGED
|
@@ -24,9 +24,9 @@ The address of the account contract.
|
|
|
24
24
|
|
|
25
25
|
## Methods
|
|
26
26
|
|
|
27
|
-
account.**getNonce()** => _Promise <
|
|
27
|
+
account.**getNonce()** => _Promise < BigNumberish >_
|
|
28
28
|
|
|
29
|
-
Gets the new Nonce for the next transaction.
|
|
29
|
+
Gets the new Nonce of the connected account for the next transaction.
|
|
30
30
|
|
|
31
31
|
<hr />
|
|
32
32
|
|
|
@@ -59,7 +59,7 @@ The _transactionsDetail_ object may include any of:
|
|
|
59
59
|
|
|
60
60
|
- transactionsDetail.**maxFee** - Max Fee that that will be used to execute the call(s)
|
|
61
61
|
- transactionsDetail.**nonce** - Nonce for the transaction
|
|
62
|
-
- transactionsDetail.**version** - Version for the transaction (default is
|
|
62
|
+
- transactionsDetail.**version** - Version for the transaction (default is 1)
|
|
63
63
|
|
|
64
64
|
###### _AddTransactionResponse_
|
|
65
65
|
|
package/www/docs/API/contract.md
CHANGED
|
@@ -78,8 +78,8 @@ contract.estimateGas.**METHOD_NAME**( ...args ) => _Promise < EstimateFeeRespons
|
|
|
78
78
|
|
|
79
79
|
Returns the estimate units of gas that would be required to execute the METHOD_NAME with args and overrides.
|
|
80
80
|
|
|
81
|
-
contract.populateTransaction.**METHOD_NAME**( ...args [ , overrides ] ) ⇒
|
|
81
|
+
contract.populateTransaction.**METHOD_NAME**( ...args [ , overrides ] ) ⇒ _Call_
|
|
82
82
|
|
|
83
|
-
Returns an
|
|
83
|
+
Returns an _Call_ object which represents the transaction that would need to be signed and submitted to the network to execute METHOD_NAME with args and overrides.
|
|
84
84
|
|
|
85
85
|
The overrides are identical to the overrides above for write methods.
|
package/www/docs/API/provider.md
CHANGED
|
@@ -319,6 +319,12 @@ Gets the latest block number.
|
|
|
319
319
|
|
|
320
320
|
<hr/>
|
|
321
321
|
|
|
322
|
+
provider.**getNonce**(contractAddress, blockIdentifier) => _Promise < BigNumberish >_
|
|
323
|
+
|
|
324
|
+
Gets the nonce of the provided contractAddress
|
|
325
|
+
|
|
326
|
+
<hr/>
|
|
327
|
+
|
|
322
328
|
provider.**getSyncingStats**() => _Promise < GetSyncingStatsResponse >_
|
|
323
329
|
|
|
324
330
|
Gets syncing status of the node.
|
package/www/docs/API/utils.md
CHANGED
|
@@ -268,9 +268,9 @@ Function that calculates the deployment transaction hash in the StarkNet network
|
|
|
268
268
|
|
|
269
269
|
Internally calls `calculateTransactionHashCommon` with `TransactionHashPrefix.DEPLOY`.
|
|
270
270
|
|
|
271
|
-
###
|
|
271
|
+
### calculateTransactionHash
|
|
272
272
|
|
|
273
|
-
`
|
|
273
|
+
`calculateTransactionHash(contractAddress: BigNumberish, version: BigNumberish, entryPointSelector: BigNumberish, calldata: BigNumberish[], maxFee: BigNumberish, chainId: StarknetChainId, nonce: BigNumberish): string`
|
|
274
274
|
|
|
275
275
|
Function that internally calls `calculateTransactionHashCommon`, with `TransactionHashPrefix.INVOKE`.
|
|
276
276
|
|