starknet 5.13.0 → 5.13.2
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 +12 -0
- package/dist/index.d.ts +26 -12
- package/dist/index.global.js +31 -25
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +31 -25
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +31 -25
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,15 @@
|
|
|
1
|
+
## [5.13.2](https://github.com/0xs34n/starknet.js/compare/v5.13.1...v5.13.2) (2023-06-16)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- rpc storage key & added simple storage test ([6c66202](https://github.com/0xs34n/starknet.js/commit/6c66202a966003509460dedf91e98177f7f4af27))
|
|
6
|
+
|
|
7
|
+
## [5.13.1](https://github.com/0xs34n/starknet.js/compare/v5.13.0...v5.13.1) (2023-06-14)
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
- common abi type for ContractClassResponse ([55a8d98](https://github.com/0xs34n/starknet.js/commit/55a8d981be4ee4d861c7a3f988c012801af3d905))
|
|
12
|
+
|
|
1
13
|
# [5.13.0](https://github.com/0xs34n/starknet.js/compare/v5.12.0...v5.13.0) (2023-06-12)
|
|
2
14
|
|
|
3
15
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -237,7 +237,7 @@ type CompiledSierra = {
|
|
|
237
237
|
* format produced after compressing 'sierra_program', stringifies 'abi' property and omit sierra_program_debug_info
|
|
238
238
|
* CompressedCompiledSierra
|
|
239
239
|
*/
|
|
240
|
-
type SierraContractClass = Omit<CompiledSierra, '
|
|
240
|
+
type SierraContractClass = Omit<CompiledSierra, 'abi' | 'sierra_program_debug_info'> & {
|
|
241
241
|
sierra_program: string;
|
|
242
242
|
abi: string;
|
|
243
243
|
};
|
|
@@ -1161,7 +1161,6 @@ declare namespace RPC {
|
|
|
1161
1161
|
type Traces = OPENRPC.Traces;
|
|
1162
1162
|
type BlockHash = OPENRPC.BlockHash;
|
|
1163
1163
|
type BlockHashAndNumber = OPENRPC.BlockHashAndNumber;
|
|
1164
|
-
type GetClassResponse = OPENRPC.ContractClass;
|
|
1165
1164
|
type EstimateFeeResponse = OPENRPC.EstimatedFee;
|
|
1166
1165
|
type GetBlockWithTxHashesResponse = OPENRPC.BlockWithTxHashes;
|
|
1167
1166
|
type GetBlockWithTxs = OPENRPC.BlockWithTxs;
|
|
@@ -1739,6 +1738,9 @@ interface StateUpdateResponse {
|
|
|
1739
1738
|
deprecated_declared_classes?: RPC.DeprecatedDeclaredClasses;
|
|
1740
1739
|
};
|
|
1741
1740
|
}
|
|
1741
|
+
type ContractClassResponse = Omit<ContractClass, 'abi'> & {
|
|
1742
|
+
abi?: Abi;
|
|
1743
|
+
};
|
|
1742
1744
|
|
|
1743
1745
|
interface EstimateFee extends EstimateFeeResponse {
|
|
1744
1746
|
suggestedMaxFee: bigint;
|
|
@@ -1907,6 +1909,7 @@ type index_CompiledSierraCasm = CompiledSierraCasm;
|
|
|
1907
1909
|
type index_CompleteDeclareContractPayload = CompleteDeclareContractPayload;
|
|
1908
1910
|
type index_CompressedProgram = CompressedProgram;
|
|
1909
1911
|
type index_ContractClass = ContractClass;
|
|
1912
|
+
type index_ContractClassResponse = ContractClassResponse;
|
|
1910
1913
|
type index_ContractEntryPoint = ContractEntryPoint;
|
|
1911
1914
|
type index_ContractEntryPointFields = ContractEntryPointFields;
|
|
1912
1915
|
type index_ContractFunction = ContractFunction;
|
|
@@ -2048,6 +2051,7 @@ declare namespace index {
|
|
|
2048
2051
|
index_CompleteDeclareContractPayload as CompleteDeclareContractPayload,
|
|
2049
2052
|
index_CompressedProgram as CompressedProgram,
|
|
2050
2053
|
index_ContractClass as ContractClass,
|
|
2054
|
+
index_ContractClassResponse as ContractClassResponse,
|
|
2051
2055
|
index_ContractEntryPoint as ContractEntryPoint,
|
|
2052
2056
|
index_ContractEntryPointFields as ContractEntryPointFields,
|
|
2053
2057
|
index_ContractFunction as ContractFunction,
|
|
@@ -2183,7 +2187,7 @@ declare abstract class ProviderInterface {
|
|
|
2183
2187
|
* @param blockIdentifier - block identifier
|
|
2184
2188
|
* @returns Contract class of compiled contract
|
|
2185
2189
|
*/
|
|
2186
|
-
abstract getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<
|
|
2190
|
+
abstract getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClassResponse>;
|
|
2187
2191
|
/**
|
|
2188
2192
|
* Returns the class hash deployed under the given address.
|
|
2189
2193
|
*
|
|
@@ -2198,7 +2202,7 @@ declare abstract class ProviderInterface {
|
|
|
2198
2202
|
* @param classHash - class hash
|
|
2199
2203
|
* @returns Contract class of compiled contract
|
|
2200
2204
|
*/
|
|
2201
|
-
abstract getClassByHash(classHash: string): Promise<
|
|
2205
|
+
abstract getClassByHash(classHash: string): Promise<ContractClassResponse>;
|
|
2202
2206
|
/**
|
|
2203
2207
|
* Gets the nonce of a contract with respect to a specific block
|
|
2204
2208
|
*
|
|
@@ -2378,9 +2382,9 @@ declare class Provider implements ProviderInterface {
|
|
|
2378
2382
|
constructor(providerOrOptions?: ProviderOptions | ProviderInterface);
|
|
2379
2383
|
getChainId(): Promise<StarknetChainId>;
|
|
2380
2384
|
getBlock(blockIdentifier: BlockIdentifier): Promise<GetBlockResponse>;
|
|
2381
|
-
getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<
|
|
2385
|
+
getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClassResponse>;
|
|
2382
2386
|
getClassHashAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<string>;
|
|
2383
|
-
getClassByHash(classHash: string): Promise<
|
|
2387
|
+
getClassByHash(classHash: string): Promise<ContractClassResponse>;
|
|
2384
2388
|
getEstimateFee(invocationWithTxType: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier: BlockIdentifier): Promise<EstimateFeeResponse>;
|
|
2385
2389
|
getInvokeEstimateFee(invocationWithTxType: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier, skipValidate?: boolean): Promise<EstimateFeeResponse>;
|
|
2386
2390
|
getEstimateFeeBulk(invocations: AccountInvocations, options: getEstimateFeeBulkOptions): Promise<EstimateFeeResponseBulk>;
|
|
@@ -2447,9 +2451,9 @@ declare class SequencerProvider implements ProviderInterface {
|
|
|
2447
2451
|
getStorageAt(contractAddress: string, key: BigNumberish, blockIdentifier?: BlockIdentifier): Promise<Sequencer.Storage>;
|
|
2448
2452
|
getTransaction(txHash: BigNumberish): Promise<GetTransactionResponse>;
|
|
2449
2453
|
getTransactionReceipt(txHash: BigNumberish): Promise<GetTransactionReceiptResponse>;
|
|
2450
|
-
getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<
|
|
2454
|
+
getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClassResponse>;
|
|
2451
2455
|
getClassHashAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<string>;
|
|
2452
|
-
getClassByHash(classHash: string, blockIdentifier?: BlockIdentifier): Promise<
|
|
2456
|
+
getClassByHash(classHash: string, blockIdentifier?: BlockIdentifier): Promise<ContractClassResponse>;
|
|
2453
2457
|
getCompiledClassByClassHash(classHash: string, blockIdentifier?: BlockIdentifier): Promise<CairoAssembly>;
|
|
2454
2458
|
invokeFunction(functionInvocation: Invocation, details: InvocationsDetailsWithNonce): Promise<InvokeFunctionResponse>;
|
|
2455
2459
|
deployAccountContract({ classHash, constructorCalldata, addressSalt, signature }: DeployAccountContractTransaction, details: InvocationsDetailsWithNonce): Promise<DeployContractResponse>;
|
|
@@ -2528,9 +2532,9 @@ declare class RpcProvider implements ProviderInterface {
|
|
|
2528
2532
|
getTransactionByHash(txHash: string): Promise<RPC.GetTransactionByHashResponse>;
|
|
2529
2533
|
getTransactionByBlockIdAndIndex(blockIdentifier: BlockIdentifier, index: number): Promise<RPC.GetTransactionByBlockIdAndIndex>;
|
|
2530
2534
|
getTransactionReceipt(txHash: string): Promise<RPC.TransactionReceipt>;
|
|
2531
|
-
getClassByHash(classHash: RPC.Felt): Promise<
|
|
2532
|
-
getClass(classHash: RPC.Felt, blockIdentifier?: BlockIdentifier): Promise<
|
|
2533
|
-
getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<
|
|
2535
|
+
getClassByHash(classHash: RPC.Felt): Promise<ContractClassResponse>;
|
|
2536
|
+
getClass(classHash: RPC.Felt, blockIdentifier?: BlockIdentifier): Promise<ContractClassResponse>;
|
|
2537
|
+
getClassAt(contractAddress: string, blockIdentifier?: BlockIdentifier): Promise<ContractClassResponse>;
|
|
2534
2538
|
getCode(_contractAddress: string, _blockIdentifier?: BlockIdentifier): Promise<GetCodeResponse>;
|
|
2535
2539
|
getEstimateFee(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
|
|
2536
2540
|
getInvokeEstimateFee(invocation: Invocation, invocationDetails: InvocationsDetailsWithNonce, blockIdentifier?: BlockIdentifier): Promise<EstimateFeeResponse>;
|
|
@@ -3230,6 +3234,14 @@ declare function isHex(hex: string): boolean;
|
|
|
3230
3234
|
declare function toBigInt(value: BigNumberish): bigint;
|
|
3231
3235
|
declare function isBigInt(value: any): value is bigint;
|
|
3232
3236
|
declare function toHex(number: BigNumberish): string;
|
|
3237
|
+
/**
|
|
3238
|
+
* Convert BigNumberish to STORAGE_KEY
|
|
3239
|
+
* Same as toHex but conforming pattern STORAGE_KEY pattern ^0x0[0-7]{1}[a-fA-F0-9]{0,62}$
|
|
3240
|
+
* A storage key. Represented as up to 62 hex digits, 3 bits, and 5 leading zeroes.
|
|
3241
|
+
* 0x0 + [0-7] + 62 hex = 0x + 64 hex
|
|
3242
|
+
* @param number BigNumberish
|
|
3243
|
+
*/
|
|
3244
|
+
declare function toStorageKey(number: BigNumberish): string;
|
|
3233
3245
|
declare function hexToDecimalString(hex: string): string;
|
|
3234
3246
|
/**
|
|
3235
3247
|
* Remove hex string leading zero and lower case '0x01A'.. -> '0x1a..'
|
|
@@ -3269,6 +3281,7 @@ declare const num_toBigInt: typeof toBigInt;
|
|
|
3269
3281
|
declare const num_toCairoBool: typeof toCairoBool;
|
|
3270
3282
|
declare const num_toHex: typeof toHex;
|
|
3271
3283
|
declare const num_toHexString: typeof toHexString;
|
|
3284
|
+
declare const num_toStorageKey: typeof toStorageKey;
|
|
3272
3285
|
declare namespace num {
|
|
3273
3286
|
export {
|
|
3274
3287
|
num_BigNumberish as BigNumberish,
|
|
@@ -3288,6 +3301,7 @@ declare namespace num {
|
|
|
3288
3301
|
num_toCairoBool as toCairoBool,
|
|
3289
3302
|
num_toHex as toHex,
|
|
3290
3303
|
num_toHexString as toHexString,
|
|
3304
|
+
num_toStorageKey as toStorageKey,
|
|
3291
3305
|
};
|
|
3292
3306
|
}
|
|
3293
3307
|
|
|
@@ -3787,4 +3801,4 @@ declare class CallData {
|
|
|
3787
3801
|
/** @deprecated prefer the 'num' naming */
|
|
3788
3802
|
declare const number: typeof num;
|
|
3789
3803
|
|
|
3790
|
-
export { Abi, AbiEntry, AbiStructs, Account, AccountInterface, AccountInvocationItem, AccountInvocations, AccountInvocationsFactoryDetails, AllowArray, Args, ArgsOrCalldata, ArgsOrCalldataWithOptions, ArraySignatureType, AsyncContractFunction, BigNumberish, BlockIdentifier, BlockNumber, BlockTag, Builtins, ByteCode, CairoAssembly, CairoContract, CairoVersion, Call, CallContractResponse, CallData, CallDetails, CallL1Handler, CallOptions, CallStruct, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompiledSierra, CompiledSierraCasm, CompleteDeclareContractPayload, CompressedProgram, Contract, ContractClass, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFunction, ContractInterface, ContractOptions, CustomError, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, DeployedContractItem, Details, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeBulk, EstimateFeeDetails, EstimateFeeResponse, EstimateFeeResponseBulk, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, HexCalldata, HttpError, Invocation, Invocations, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeOptions, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LegacyCompiledContract, LegacyContractClass, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, MultiType, Nonce, OptionalPayload, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, PythonicHints, RPC, RawArgs, RawArgsArray, RawArgsObject, RawCalldata, Result, RpcProvider, RpcProviderOptions, SIMULATION_FLAG, Sequencer, SequencerHttpMethod, SequencerIdentifier, SequencerProvider, SequencerProviderOptions, SierraContractClass, SierraContractEntryPointFields, SierraEntryPointsByType, SierraProgramDebugInfo, Signature, Signer, SignerInterface, SimulateTransactionDetails, SimulateTransactionResponse, SimulatedTransaction, SimulationFlags, StarkNetDomain, StarkNetMerkleType, StarkNetType, StateUpdateResponse, Status, Storage, Struct, StructAbi, TransactionStatus, TransactionType, Tupled, TypedData, Uint256, UniversalDeployerContractPayload, WeierstrassSignatureType, addAddressPadding, buildUrl, cairo, constants, defaultProvider, ec, encode, fixProto, fixStack, getCalldata, getChecksumAddress, getEstimateFeeBulkOptions, getSimulateTransactionOptions, hash, isUrl, json, merkle, num, number, shortString, splitArgsAndOptions, stark, starknetId, transaction, typedData, index as types, uint256$1 as uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };
|
|
3804
|
+
export { Abi, AbiEntry, AbiStructs, Account, AccountInterface, AccountInvocationItem, AccountInvocations, AccountInvocationsFactoryDetails, AllowArray, Args, ArgsOrCalldata, ArgsOrCalldataWithOptions, ArraySignatureType, AsyncContractFunction, BigNumberish, BlockIdentifier, BlockNumber, BlockTag, Builtins, ByteCode, CairoAssembly, CairoContract, CairoVersion, Call, CallContractResponse, CallData, CallDetails, CallL1Handler, CallOptions, CallStruct, Calldata, CommonTransactionReceiptResponse, CommonTransactionResponse, CompiledContract, CompiledSierra, CompiledSierraCasm, CompleteDeclareContractPayload, CompressedProgram, Contract, ContractClass, ContractClassResponse, ContractEntryPoint, ContractEntryPointFields, ContractFactory, ContractFunction, ContractInterface, ContractOptions, CustomError, DeclareAndDeployContractPayload, DeclareContractPayload, DeclareContractResponse, DeclareContractTransaction, DeclareDeployUDCResponse, DeclareSignerDetails, DeclareTransactionReceiptResponse, DeclareTransactionResponse, DeployAccountContractPayload, DeployAccountContractTransaction, DeployAccountSignerDetails, DeployContractPayload, DeployContractResponse, DeployContractUDCResponse, DeployedContractItem, Details, EntryPointType, EntryPointsByType, EstimateFee, EstimateFeeAction, EstimateFeeBulk, EstimateFeeDetails, EstimateFeeResponse, EstimateFeeResponseBulk, Event, ExecutionResources, FunctionAbi, FunctionInvocation, GatewayError, GetBlockResponse, GetCodeResponse, GetContractAddressesResponse, GetTransactionReceiptResponse, GetTransactionResponse, GetTransactionStatusResponse, HexCalldata, HttpError, Invocation, Invocations, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeOptions, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LegacyCompiledContract, LegacyContractClass, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, MultiType, Nonce, OptionalPayload, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, PythonicHints, RPC, RawArgs, RawArgsArray, RawArgsObject, RawCalldata, Result, RpcProvider, RpcProviderOptions, SIMULATION_FLAG, Sequencer, SequencerHttpMethod, SequencerIdentifier, SequencerProvider, SequencerProviderOptions, SierraContractClass, SierraContractEntryPointFields, SierraEntryPointsByType, SierraProgramDebugInfo, Signature, Signer, SignerInterface, SimulateTransactionDetails, SimulateTransactionResponse, SimulatedTransaction, SimulationFlags, StarkNetDomain, StarkNetMerkleType, StarkNetType, StateUpdateResponse, Status, Storage, Struct, StructAbi, TransactionStatus, TransactionType, Tupled, TypedData, Uint256, UniversalDeployerContractPayload, WeierstrassSignatureType, addAddressPadding, buildUrl, cairo, constants, defaultProvider, ec, encode, fixProto, fixStack, getCalldata, getChecksumAddress, getEstimateFeeBulkOptions, getSimulateTransactionOptions, hash, isUrl, json, merkle, num, number, shortString, splitArgsAndOptions, stark, starknetId, transaction, typedData, index as types, uint256$1 as uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };
|
package/dist/index.global.js
CHANGED
|
@@ -2906,7 +2906,8 @@ var starknet = (() => {
|
|
|
2906
2906
|
toBigInt: () => toBigInt,
|
|
2907
2907
|
toCairoBool: () => toCairoBool,
|
|
2908
2908
|
toHex: () => toHex,
|
|
2909
|
-
toHexString: () => toHexString
|
|
2909
|
+
toHexString: () => toHexString,
|
|
2910
|
+
toStorageKey: () => toStorageKey
|
|
2910
2911
|
});
|
|
2911
2912
|
|
|
2912
2913
|
// node_modules/@noble/curves/esm/abstract/utils.js
|
|
@@ -3126,6 +3127,10 @@ var starknet = (() => {
|
|
|
3126
3127
|
function toHex(number3) {
|
|
3127
3128
|
return addHexPrefix(toBigInt(number3).toString(16));
|
|
3128
3129
|
}
|
|
3130
|
+
function toStorageKey(number3) {
|
|
3131
|
+
const res = addHexPrefix(toBigInt(number3).toString(16).padStart(64, "0"));
|
|
3132
|
+
return res;
|
|
3133
|
+
}
|
|
3129
3134
|
function hexToDecimalString(hex) {
|
|
3130
3135
|
return BigInt(addHexPrefix(hex)).toString(10);
|
|
3131
3136
|
}
|
|
@@ -7269,18 +7274,18 @@ var starknet = (() => {
|
|
|
7269
7274
|
}
|
|
7270
7275
|
function formatSpaces(json) {
|
|
7271
7276
|
let insideQuotes = false;
|
|
7272
|
-
|
|
7277
|
+
const newString = [];
|
|
7273
7278
|
for (const char of json) {
|
|
7274
|
-
if (char === '"' && newString.
|
|
7279
|
+
if (char === '"' && (newString.length > 0 && newString.slice(-1)[0] === "\\") === false) {
|
|
7275
7280
|
insideQuotes = !insideQuotes;
|
|
7276
7281
|
}
|
|
7277
7282
|
if (insideQuotes) {
|
|
7278
|
-
newString
|
|
7283
|
+
newString.push(char);
|
|
7279
7284
|
} else {
|
|
7280
|
-
newString
|
|
7285
|
+
newString.push(char === ":" ? ": " : char === "," ? ", " : char);
|
|
7281
7286
|
}
|
|
7282
7287
|
}
|
|
7283
|
-
return newString;
|
|
7288
|
+
return newString.join("");
|
|
7284
7289
|
}
|
|
7285
7290
|
function computeHintedClassHash(compiledContract) {
|
|
7286
7291
|
const { abi, program } = compiledContract;
|
|
@@ -11707,6 +11712,12 @@ var starknet = (() => {
|
|
|
11707
11712
|
};
|
|
11708
11713
|
});
|
|
11709
11714
|
}
|
|
11715
|
+
parseContractClassResponse(res) {
|
|
11716
|
+
return {
|
|
11717
|
+
...res,
|
|
11718
|
+
abi: typeof res.abi === "string" ? JSON.parse(res.abi) : res.abi
|
|
11719
|
+
};
|
|
11720
|
+
}
|
|
11710
11721
|
};
|
|
11711
11722
|
|
|
11712
11723
|
// src/provider/errors.ts
|
|
@@ -12032,7 +12043,7 @@ var starknet = (() => {
|
|
|
12032
12043
|
return this.fetchEndpoint("starknet_getStateUpdate", { block_id });
|
|
12033
12044
|
}
|
|
12034
12045
|
async getStorageAt(contractAddress, key, blockIdentifier = this.blockIdentifier) {
|
|
12035
|
-
const parsedKey =
|
|
12046
|
+
const parsedKey = toStorageKey(key);
|
|
12036
12047
|
const block_id = new Block(blockIdentifier).identifier;
|
|
12037
12048
|
return this.fetchEndpoint("starknet_getStorageAt", {
|
|
12038
12049
|
contract_address: contractAddress,
|
|
@@ -12059,14 +12070,17 @@ var starknet = (() => {
|
|
|
12059
12070
|
}
|
|
12060
12071
|
async getClass(classHash, blockIdentifier = this.blockIdentifier) {
|
|
12061
12072
|
const block_id = new Block(blockIdentifier).identifier;
|
|
12062
|
-
return this.fetchEndpoint("starknet_getClass", {
|
|
12073
|
+
return this.fetchEndpoint("starknet_getClass", {
|
|
12074
|
+
class_hash: classHash,
|
|
12075
|
+
block_id
|
|
12076
|
+
}).then(this.responseParser.parseContractClassResponse);
|
|
12063
12077
|
}
|
|
12064
12078
|
async getClassAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
12065
12079
|
const block_id = new Block(blockIdentifier).identifier;
|
|
12066
12080
|
return this.fetchEndpoint("starknet_getClassAt", {
|
|
12067
12081
|
block_id,
|
|
12068
12082
|
contract_address: contractAddress
|
|
12069
|
-
});
|
|
12083
|
+
}).then(this.responseParser.parseContractClassResponse);
|
|
12070
12084
|
}
|
|
12071
12085
|
async getCode(_contractAddress, _blockIdentifier) {
|
|
12072
12086
|
throw new Error("RPC does not implement getCode function");
|
|
@@ -12512,11 +12526,11 @@ var starknet = (() => {
|
|
|
12512
12526
|
}
|
|
12513
12527
|
};
|
|
12514
12528
|
}
|
|
12515
|
-
|
|
12516
|
-
|
|
12529
|
+
parseContractClassResponse(res) {
|
|
12530
|
+
const response = isSierra(res) ? res : parseContract(res);
|
|
12517
12531
|
return {
|
|
12518
|
-
...
|
|
12519
|
-
abi: JSON.parse(
|
|
12532
|
+
...response,
|
|
12533
|
+
abi: typeof response.abi === "string" ? JSON.parse(response.abi) : response.abi
|
|
12520
12534
|
};
|
|
12521
12535
|
}
|
|
12522
12536
|
};
|
|
@@ -12731,24 +12745,16 @@ var starknet = (() => {
|
|
|
12731
12745
|
}
|
|
12732
12746
|
async getClassAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
12733
12747
|
return this.fetchEndpoint("get_full_contract", { blockIdentifier, contractAddress }).then(
|
|
12734
|
-
|
|
12735
|
-
if (isSierra(res)) {
|
|
12736
|
-
return this.responseParser.parseSierraContractClassResponse(res);
|
|
12737
|
-
}
|
|
12738
|
-
return parseContract(res);
|
|
12739
|
-
}
|
|
12748
|
+
this.responseParser.parseContractClassResponse
|
|
12740
12749
|
);
|
|
12741
12750
|
}
|
|
12742
12751
|
async getClassHashAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
12743
12752
|
return this.fetchEndpoint("get_class_hash_at", { blockIdentifier, contractAddress });
|
|
12744
12753
|
}
|
|
12745
12754
|
async getClassByHash(classHash, blockIdentifier = this.blockIdentifier) {
|
|
12746
|
-
return this.fetchEndpoint("get_class_by_hash", { classHash, blockIdentifier }).then(
|
|
12747
|
-
|
|
12748
|
-
|
|
12749
|
-
}
|
|
12750
|
-
return parseContract(res);
|
|
12751
|
-
});
|
|
12755
|
+
return this.fetchEndpoint("get_class_by_hash", { classHash, blockIdentifier }).then(
|
|
12756
|
+
this.responseParser.parseContractClassResponse
|
|
12757
|
+
);
|
|
12752
12758
|
}
|
|
12753
12759
|
async getCompiledClassByClassHash(classHash, blockIdentifier = this.blockIdentifier) {
|
|
12754
12760
|
return this.fetchEndpoint("get_compiled_class_by_class_hash", { classHash, blockIdentifier });
|