starknet 5.13.0 → 5.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 +6 -0
- package/dist/index.d.ts +16 -12
- package/dist/index.global.js +24 -23
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +24 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +24 -23
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,9 @@
|
|
|
1
|
+
## [5.13.1](https://github.com/0xs34n/starknet.js/compare/v5.13.0...v5.13.1) (2023-06-14)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- common abi type for ContractClassResponse ([55a8d98](https://github.com/0xs34n/starknet.js/commit/55a8d981be4ee4d861c7a3f988c012801af3d905))
|
|
6
|
+
|
|
1
7
|
# [5.13.0](https://github.com/0xs34n/starknet.js/compare/v5.12.0...v5.13.0) (2023-06-12)
|
|
2
8
|
|
|
3
9
|
### 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>;
|
|
@@ -3787,4 +3791,4 @@ declare class CallData {
|
|
|
3787
3791
|
/** @deprecated prefer the 'num' naming */
|
|
3788
3792
|
declare const number: typeof num;
|
|
3789
3793
|
|
|
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 };
|
|
3794
|
+
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
|
@@ -7269,18 +7269,18 @@ var starknet = (() => {
|
|
|
7269
7269
|
}
|
|
7270
7270
|
function formatSpaces(json) {
|
|
7271
7271
|
let insideQuotes = false;
|
|
7272
|
-
|
|
7272
|
+
const newString = [];
|
|
7273
7273
|
for (const char of json) {
|
|
7274
|
-
if (char === '"' && newString.
|
|
7274
|
+
if (char === '"' && (newString.length > 0 && newString.slice(-1)[0] === "\\") === false) {
|
|
7275
7275
|
insideQuotes = !insideQuotes;
|
|
7276
7276
|
}
|
|
7277
7277
|
if (insideQuotes) {
|
|
7278
|
-
newString
|
|
7278
|
+
newString.push(char);
|
|
7279
7279
|
} else {
|
|
7280
|
-
newString
|
|
7280
|
+
newString.push(char === ":" ? ": " : char === "," ? ", " : char);
|
|
7281
7281
|
}
|
|
7282
7282
|
}
|
|
7283
|
-
return newString;
|
|
7283
|
+
return newString.join("");
|
|
7284
7284
|
}
|
|
7285
7285
|
function computeHintedClassHash(compiledContract) {
|
|
7286
7286
|
const { abi, program } = compiledContract;
|
|
@@ -11707,6 +11707,12 @@ var starknet = (() => {
|
|
|
11707
11707
|
};
|
|
11708
11708
|
});
|
|
11709
11709
|
}
|
|
11710
|
+
parseContractClassResponse(res) {
|
|
11711
|
+
return {
|
|
11712
|
+
...res,
|
|
11713
|
+
abi: typeof res.abi === "string" ? JSON.parse(res.abi) : res.abi
|
|
11714
|
+
};
|
|
11715
|
+
}
|
|
11710
11716
|
};
|
|
11711
11717
|
|
|
11712
11718
|
// src/provider/errors.ts
|
|
@@ -12059,14 +12065,17 @@ var starknet = (() => {
|
|
|
12059
12065
|
}
|
|
12060
12066
|
async getClass(classHash, blockIdentifier = this.blockIdentifier) {
|
|
12061
12067
|
const block_id = new Block(blockIdentifier).identifier;
|
|
12062
|
-
return this.fetchEndpoint("starknet_getClass", {
|
|
12068
|
+
return this.fetchEndpoint("starknet_getClass", {
|
|
12069
|
+
class_hash: classHash,
|
|
12070
|
+
block_id
|
|
12071
|
+
}).then(this.responseParser.parseContractClassResponse);
|
|
12063
12072
|
}
|
|
12064
12073
|
async getClassAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
12065
12074
|
const block_id = new Block(blockIdentifier).identifier;
|
|
12066
12075
|
return this.fetchEndpoint("starknet_getClassAt", {
|
|
12067
12076
|
block_id,
|
|
12068
12077
|
contract_address: contractAddress
|
|
12069
|
-
});
|
|
12078
|
+
}).then(this.responseParser.parseContractClassResponse);
|
|
12070
12079
|
}
|
|
12071
12080
|
async getCode(_contractAddress, _blockIdentifier) {
|
|
12072
12081
|
throw new Error("RPC does not implement getCode function");
|
|
@@ -12512,11 +12521,11 @@ var starknet = (() => {
|
|
|
12512
12521
|
}
|
|
12513
12522
|
};
|
|
12514
12523
|
}
|
|
12515
|
-
|
|
12516
|
-
|
|
12524
|
+
parseContractClassResponse(res) {
|
|
12525
|
+
const response = isSierra(res) ? res : parseContract(res);
|
|
12517
12526
|
return {
|
|
12518
|
-
...
|
|
12519
|
-
abi: JSON.parse(
|
|
12527
|
+
...response,
|
|
12528
|
+
abi: typeof response.abi === "string" ? JSON.parse(response.abi) : response.abi
|
|
12520
12529
|
};
|
|
12521
12530
|
}
|
|
12522
12531
|
};
|
|
@@ -12731,24 +12740,16 @@ var starknet = (() => {
|
|
|
12731
12740
|
}
|
|
12732
12741
|
async getClassAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
12733
12742
|
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
|
-
}
|
|
12743
|
+
this.responseParser.parseContractClassResponse
|
|
12740
12744
|
);
|
|
12741
12745
|
}
|
|
12742
12746
|
async getClassHashAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
12743
12747
|
return this.fetchEndpoint("get_class_hash_at", { blockIdentifier, contractAddress });
|
|
12744
12748
|
}
|
|
12745
12749
|
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
|
-
});
|
|
12750
|
+
return this.fetchEndpoint("get_class_by_hash", { classHash, blockIdentifier }).then(
|
|
12751
|
+
this.responseParser.parseContractClassResponse
|
|
12752
|
+
);
|
|
12752
12753
|
}
|
|
12753
12754
|
async getCompiledClassByClassHash(classHash, blockIdentifier = this.blockIdentifier) {
|
|
12754
12755
|
return this.fetchEndpoint("get_compiled_class_by_class_hash", { classHash, blockIdentifier });
|