starknet 4.5.0 → 4.6.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.
@@ -1,110 +1,68 @@
1
- import { StarknetChainId } from '../../constants';
2
- import { BlockIdentifier } from '../../provider/utils';
3
- import { Status } from '../lib';
4
- import { OPENRPC } from './openrpc';
1
+ import { ADDRESS, FELT, OPENRPC } from './openrpc';
5
2
  export declare namespace RPC {
6
- export type Response = {
3
+ type Response = {
7
4
  id: number;
8
- result: any;
9
5
  jsonrpc: string;
6
+ result?: any;
10
7
  error?: {
11
8
  code: string;
12
9
  message: string;
13
10
  };
14
11
  };
15
- export type AddTransactionResponse = {
16
- transaction_hash: string;
17
- };
18
- export type GetClassResponse = {
19
- program: string;
20
- entry_point_by_type: any;
21
- };
22
- export type DeclareResponse = {
23
- transaction_hash: string;
24
- class_hash: string;
25
- };
26
- export type EstimateFeeResponse = {
27
- overall_fee: number;
28
- gas_consumed: number;
29
- gas_price: number;
30
- };
31
- export type GetBlockWithTxHashesResponse = OPENRPC.GetBlockWithTxHashesResponse;
32
- export type GetBlockWithTxs = OPENRPC.GetBlockWithTxs;
33
- export type GetStorageAtResponse = OPENRPC.GetStorageAtResponse;
34
- export type GetTransactionReceiptResponse = {
35
- txn_hash: string;
36
- actual_fee: string;
37
- status: Status;
38
- status_data: string;
39
- messages_sent: Array<MessageToL1>;
40
- l1_origin_message: MessageToL2;
41
- events: Array<StarknetEvent>;
42
- };
43
- interface CommonTransactionProperties {
44
- txn_hash: string;
45
- max_fee: string;
46
- version: string;
47
- nonce: string;
48
- signature: Array<string>;
49
- }
50
- export interface InvokeTransactionResponse extends CommonTransactionProperties {
51
- contract_address?: string;
52
- entry_point_selector?: string;
53
- calldata?: Array<string>;
54
- }
55
- export interface DeclareTransactionResponse extends CommonTransactionProperties {
56
- contract_class?: GetClassResponse;
57
- sender_address?: string;
58
- }
59
- export type GetTransactionByHashResponse = OPENRPC.GetTransactionByHashResponse;
60
- export type GetTransactionByBlockIdAndIndex = OPENRPC.GetTransactionByBlockIdAndIndex;
61
- export type GetTransactionCountResponse = number;
62
- export type GetBlockNumberResponse = number;
63
- export type GetSyncingStatsResponse = {
64
- starting_block_hash: string;
65
- starting_block_num: string;
66
- current_block_hash: string;
67
- current_block_num: string;
68
- highest_block_hash: string;
69
- highest_block_num: string;
70
- } | boolean;
71
- export type EventFilter = {
72
- fromBlock: BlockIdentifier;
73
- toBlock: BlockIdentifier;
74
- address: string;
75
- keys: string[];
76
- page_size: number;
77
- page_number: number;
78
- };
79
- export type GetEventsResponse = {
80
- events: StarknetEmittedEvent[];
81
- page_number: number;
82
- is_last_page: number;
83
- };
84
- export type DeployContractResponse = {
85
- transaction_hash: string;
86
- contract_address: string;
87
- };
88
- export type StarknetEvent = {
89
- from_address: string;
90
- keys: string[];
91
- data: string[];
92
- };
93
- export type StarknetEmittedEvent = {
94
- event: StarknetEvent;
95
- block_hash: string;
96
- block_number: number;
97
- transaction_hash: string;
98
- };
99
- export type MessageToL1 = {
100
- to_address: string;
101
- payload: string[];
102
- };
103
- export type MessageToL2 = {
104
- from_address: string;
105
- payload: string[];
106
- };
107
- export type Methods = {
12
+ type ChainId = OPENRPC.ChainId;
13
+ type ContractAddress = ADDRESS;
14
+ type Felt = FELT;
15
+ type ContractClass = OPENRPC.ContractClass;
16
+ type StateUpdate = OPENRPC.StateUpdate;
17
+ type Transaction = OPENRPC.Transaction;
18
+ type PendingTransactions = OPENRPC.PendingTransactions;
19
+ type TransactionHash = OPENRPC.TransactionHash;
20
+ type Trace = OPENRPC.Trace;
21
+ type Traces = OPENRPC.Traces;
22
+ type BlockHash = OPENRPC.BlockHash;
23
+ type BlockHashAndNumber = OPENRPC.BlockHashAndNumber;
24
+ type GetClassResponse = OPENRPC.ContractClass;
25
+ type EstimateFeeResponse = OPENRPC.EstimatedFee;
26
+ type GetBlockWithTxHashesResponse = OPENRPC.BlockWithTxHashes;
27
+ type GetBlockWithTxs = OPENRPC.BlockWithTxs;
28
+ type GetStorageAtResponse = OPENRPC.Storage;
29
+ type TransactionReceipt = OPENRPC.TransactionReceipt;
30
+ type GetTransactionByHashResponse = OPENRPC.Transaction;
31
+ type GetTransactionByBlockIdAndIndex = OPENRPC.Transaction;
32
+ type GetTransactionCountResponse = number;
33
+ type GetBlockNumberResponse = OPENRPC.BlockNumber;
34
+ type GetSyncingStatsResponse = OPENRPC.SyncingStatus;
35
+ type EventFilter = OPENRPC.EventFilter;
36
+ type GetEventsResponse = OPENRPC.Events;
37
+ type InvokedTransaction = OPENRPC.InvokedTransaction;
38
+ type DeclaredTransaction = OPENRPC.DeclaredTransaction;
39
+ 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
+ };
108
66
  starknet_getBlockWithTxHashes: {
109
67
  QUERY: never;
110
68
  REQUEST: any[];
@@ -118,7 +76,7 @@ export declare namespace RPC {
118
76
  starknet_getNonce: {
119
77
  QUERY: never;
120
78
  REQUEST: any[];
121
- RESPONSE: string;
79
+ RESPONSE: OPENRPC.Nonce;
122
80
  };
123
81
  starknet_getStorageAt: {
124
82
  QUERY: never;
@@ -138,7 +96,7 @@ export declare namespace RPC {
138
96
  starknet_getTransactionReceipt: {
139
97
  QUERY: never;
140
98
  REQUEST: any[];
141
- RESPONSE: GetTransactionReceiptResponse;
99
+ RESPONSE: TransactionReceipt;
142
100
  };
143
101
  starknet_getBlockTransactionCount: {
144
102
  QUERY: never;
@@ -153,7 +111,7 @@ export declare namespace RPC {
153
111
  starknet_estimateFee: {
154
112
  QUERY: never;
155
113
  REQUEST: any[];
156
- RESPONSE: EstimateFeeResponse;
114
+ RESPONSE: OPENRPC.EstimatedFee;
157
115
  };
158
116
  starknet_blockNumber: {
159
117
  QUERY: never;
@@ -163,7 +121,7 @@ export declare namespace RPC {
163
121
  starknet_chainId: {
164
122
  QUERY: never;
165
123
  REQUEST: any[];
166
- RESPONSE: StarknetChainId;
124
+ RESPONSE: OPENRPC.ChainId;
167
125
  };
168
126
  starknet_syncing: {
169
127
  QUERY: never;
@@ -178,23 +136,32 @@ export declare namespace RPC {
178
136
  starknet_addInvokeTransaction: {
179
137
  QUERY: never;
180
138
  REQUEST: any[];
181
- RESPONSE: AddTransactionResponse;
139
+ RESPONSE: OPENRPC.InvokedTransaction;
182
140
  };
183
141
  starknet_addDeployTransaction: {
184
142
  QUERY: never;
185
143
  REQUEST: any[];
186
- RESPONSE: DeployContractResponse;
144
+ RESPONSE: OPENRPC.DeployedTransaction;
187
145
  };
188
146
  starknet_addDeclareTransaction: {
189
147
  QUERY: never;
190
148
  REQUEST: any[];
191
- RESPONSE: DeclareResponse;
149
+ RESPONSE: OPENRPC.DeclaredTransaction;
192
150
  };
193
151
  starknet_getClassAt: {
194
152
  QUERY: never;
195
153
  REQUEST: any[];
196
154
  RESPONSE: any;
197
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
+ };
198
166
  };
199
- export {};
200
167
  }
@@ -11,14 +11,17 @@ 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
+ };
14
17
  export declare class RPCResponseParser extends ResponseParser {
15
18
  parseGetBlockResponse(res: RpcGetBlockResponse): GetBlockResponse;
16
19
  parseGetTransactionResponse(res: GetTransactionByHashResponse): GetTransactionResponse;
17
- parseGetTransactionReceiptResponse(res: RPC.GetTransactionReceiptResponse): GetTransactionReceiptResponse;
20
+ parseGetTransactionReceiptResponse(res: TransactionReceipt): GetTransactionReceiptResponse;
18
21
  parseFeeEstimateResponse(res: RPC.EstimateFeeResponse): EstimateFeeResponse;
19
22
  parseCallContractResponse(res: Array<string>): CallContractResponse;
20
- parseInvokeFunctionResponse(res: RPC.AddTransactionResponse): InvokeFunctionResponse;
21
- parseDeployContractResponse(res: RPC.DeployContractResponse): DeployContractResponse;
22
- parseDeclareContractResponse(res: RPC.DeclareResponse): DeclareContractResponse;
23
+ parseInvokeFunctionResponse(res: RPC.InvokedTransaction): InvokeFunctionResponse;
24
+ parseDeployContractResponse(res: RPC.DeployedTransaction): DeployContractResponse;
25
+ parseDeclareContractResponse(res: RPC.DeclaredTransaction): DeclareContractResponse;
23
26
  }
24
27
  export {};
@@ -48,7 +48,7 @@ var RPCResponseParser = /** @class */ (function (_super) {
48
48
  };
49
49
  RPCResponseParser.prototype.parseGetTransactionReceiptResponse = function (res) {
50
50
  return {
51
- transaction_hash: res.txn_hash,
51
+ transaction_hash: res.transaction_hash,
52
52
  actual_fee: res.actual_fee,
53
53
  status: res.status,
54
54
  status_data: res.status_data,