starknet 5.4.2 → 5.5.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 +10 -0
- package/dist/index.d.ts +8 -4
- package/dist/index.global.js +22 -8
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +22 -8
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -8
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
# [5.5.0](https://github.com/0xs34n/starknet.js/compare/v5.4.2...v5.5.0) (2023-04-10)
|
|
2
|
+
|
|
3
|
+
### Bug Fixes
|
|
4
|
+
|
|
5
|
+
- update DeclareAndDeploy with cairo 1 declare ([71072cf](https://github.com/0xs34n/starknet.js/commit/71072cffadb8ac118780cec21cb8c4f83e74d7ae))
|
|
6
|
+
|
|
7
|
+
### Features
|
|
8
|
+
|
|
9
|
+
- response parsing and types ([09a46af](https://github.com/0xs34n/starknet.js/commit/09a46af02e88376dc49e0aa39468fded99b94ee2))
|
|
10
|
+
|
|
1
11
|
## [5.4.2](https://github.com/0xs34n/starknet.js/compare/v5.4.1...v5.4.2) (2023-04-04)
|
|
2
12
|
|
|
3
13
|
### Bug Fixes
|
package/dist/index.d.ts
CHANGED
|
@@ -222,6 +222,7 @@ declare type FunctionAbi = {
|
|
|
222
222
|
name: string;
|
|
223
223
|
outputs: AbiEntry[];
|
|
224
224
|
stateMutability?: 'view';
|
|
225
|
+
state_mutability?: string;
|
|
225
226
|
type: FunctionAbiType;
|
|
226
227
|
};
|
|
227
228
|
declare type AbiStructs = {
|
|
@@ -269,7 +270,8 @@ declare type CairoAssembly = {
|
|
|
269
270
|
prime: string;
|
|
270
271
|
compiler_version: string;
|
|
271
272
|
bytecode: ByteCode;
|
|
272
|
-
hints:
|
|
273
|
+
hints: any[];
|
|
274
|
+
pythonic_hints: PythonicHints;
|
|
273
275
|
entry_points_by_type: EntryPointsByType;
|
|
274
276
|
};
|
|
275
277
|
declare type SierraContractClass = {
|
|
@@ -284,7 +286,7 @@ declare type CompiledSierra = SierraContractClass;
|
|
|
284
286
|
declare type CompiledSierraCasm = CairoAssembly;
|
|
285
287
|
/** SUBTYPES */
|
|
286
288
|
declare type ByteCode = string[];
|
|
287
|
-
declare type
|
|
289
|
+
declare type PythonicHints = [number, string[]][];
|
|
288
290
|
declare type SierraProgramDebugInfo = {
|
|
289
291
|
type_names: [number, string][];
|
|
290
292
|
libfunc_names: [number, string][];
|
|
@@ -1892,7 +1894,9 @@ declare abstract class ProviderInterface {
|
|
|
1892
1894
|
/**
|
|
1893
1895
|
* Wait for the transaction to be accepted
|
|
1894
1896
|
* @param txHash - transaction hash
|
|
1895
|
-
* @param
|
|
1897
|
+
* @param options
|
|
1898
|
+
* - (optional) retryInterval: number | undefined;
|
|
1899
|
+
* - (optional) successStates: TransactionStatus[] | undefined;
|
|
1896
1900
|
* @return GetTransactionReceiptResponse
|
|
1897
1901
|
*/
|
|
1898
1902
|
abstract waitForTransaction(txHash: BigNumberish, options?: waitForTransactionOptions): Promise<GetTransactionReceiptResponse>;
|
|
@@ -3152,4 +3156,4 @@ declare class CallData {
|
|
|
3152
3156
|
/** @deprecated prefer the 'num' naming */
|
|
3153
3157
|
declare const number: typeof num;
|
|
3154
3158
|
|
|
3155
|
-
export { Abi, AbiEntry, AbiStructs, Account, AccountInterface, AllowArray, Args, ArraySignatureType, AsyncContractFunction, 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, 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,
|
|
3159
|
+
export { Abi, AbiEntry, AbiStructs, Account, AccountInterface, AllowArray, Args, ArraySignatureType, AsyncContractFunction, 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, 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, HttpError, Invocation, InvocationBulk, InvocationsDetails, InvocationsDetailsWithNonce, InvocationsSignerDetails, InvokeFunctionResponse, InvokeTransactionReceiptResponse, InvokeTransactionResponse, LegacyCompiledContract, LegacyContractClass, LibraryError, MessageToL1, MessageToL2, MultiDeployContractResponse, Nonce, Overrides, ParsedStruct, Program, Provider, ProviderInterface, ProviderOptions, PythonicHints, RPC, RawArgs, RawCalldata, Result, RpcProvider, RpcProviderOptions, Sequencer, SequencerHttpMethod, SequencerIdentifier, SequencerProvider, SequencerProviderOptions, SierraContractClass, SierraContractEntryPointFields, SierraEntryPointsByType, SierraProgramDebugInfo, Signature, Signer, SignerInterface, StateUpdateResponse, Status, Storage, Struct, StructAbi, TransactionBulk, TransactionSimulation, TransactionSimulationResponse, TransactionStatus, TransactionTraceResponse, TransactionType, Tupled, UniversalDeployerContractPayload, WeierstrassSignatureType, addAddressPadding, buildUrl, constants, defaultProvider, ec, encode, fixProto, fixStack, getChecksumAddress, hash, isUrl, json, merkle, num, number, shortString, stark, transaction, index as typedData, uint256, validateAndParseAddress, validateChecksumAddress, waitForTransactionOptions };
|
package/dist/index.global.js
CHANGED
|
@@ -11335,6 +11335,12 @@ var starknet = (() => {
|
|
|
11335
11335
|
}
|
|
11336
11336
|
};
|
|
11337
11337
|
}
|
|
11338
|
+
parseSierraContractClassResponse(res) {
|
|
11339
|
+
return {
|
|
11340
|
+
...res,
|
|
11341
|
+
abi: JSON.parse(res.abi)
|
|
11342
|
+
};
|
|
11343
|
+
}
|
|
11338
11344
|
};
|
|
11339
11345
|
|
|
11340
11346
|
// src/utils/url.ts
|
|
@@ -11542,16 +11548,24 @@ var starknet = (() => {
|
|
|
11542
11548
|
}
|
|
11543
11549
|
async getClassAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
11544
11550
|
return this.fetchEndpoint("get_full_contract", { blockIdentifier, contractAddress }).then(
|
|
11545
|
-
|
|
11551
|
+
(res) => {
|
|
11552
|
+
if (isSierra(res)) {
|
|
11553
|
+
return this.responseParser.parseSierraContractClassResponse(res);
|
|
11554
|
+
}
|
|
11555
|
+
return parseContract(res);
|
|
11556
|
+
}
|
|
11546
11557
|
);
|
|
11547
11558
|
}
|
|
11548
11559
|
async getClassHashAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
11549
11560
|
return this.fetchEndpoint("get_class_hash_at", { blockIdentifier, contractAddress });
|
|
11550
11561
|
}
|
|
11551
11562
|
async getClassByHash(classHash, blockIdentifier = this.blockIdentifier) {
|
|
11552
|
-
return this.fetchEndpoint("get_class_by_hash", { classHash, blockIdentifier }).then(
|
|
11553
|
-
|
|
11554
|
-
|
|
11563
|
+
return this.fetchEndpoint("get_class_by_hash", { classHash, blockIdentifier }).then((res) => {
|
|
11564
|
+
if (isSierra(res)) {
|
|
11565
|
+
return this.responseParser.parseSierraContractClassResponse(res);
|
|
11566
|
+
}
|
|
11567
|
+
return parseContract(res);
|
|
11568
|
+
});
|
|
11555
11569
|
}
|
|
11556
11570
|
async getCompiledClassByClassHash(classHash, blockIdentifier = this.blockIdentifier) {
|
|
11557
11571
|
return this.fetchEndpoint("get_compiled_class_by_class_hash", { classHash, blockIdentifier });
|
|
@@ -12202,7 +12216,7 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
12202
12216
|
const invocableFunctionNames = this.abi.filter((abi) => {
|
|
12203
12217
|
if (abi.type !== "function")
|
|
12204
12218
|
return false;
|
|
12205
|
-
const isView = abi.stateMutability === "view";
|
|
12219
|
+
const isView = abi.stateMutability === "view" || abi.state_mutability === "view";
|
|
12206
12220
|
return type === "INVOKE" ? !isView : isView;
|
|
12207
12221
|
}).map((abi) => abi.name);
|
|
12208
12222
|
assert2(
|
|
@@ -12324,7 +12338,7 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
12324
12338
|
};
|
|
12325
12339
|
}
|
|
12326
12340
|
function buildDefault(contract, functionAbi) {
|
|
12327
|
-
if (functionAbi.stateMutability === "view") {
|
|
12341
|
+
if (functionAbi.stateMutability === "view" || functionAbi.state_mutability === "view") {
|
|
12328
12342
|
return buildCall(contract, functionAbi);
|
|
12329
12343
|
}
|
|
12330
12344
|
return buildInvoke(contract, functionAbi);
|
|
@@ -13194,8 +13208,8 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
13194
13208
|
return parseUDCEvent(txReceipt);
|
|
13195
13209
|
}
|
|
13196
13210
|
async declareAndDeploy(payload, details) {
|
|
13197
|
-
const {
|
|
13198
|
-
const { transaction_hash, class_hash } = await this.declare(
|
|
13211
|
+
const { constructorCalldata, salt, unique } = payload;
|
|
13212
|
+
const { transaction_hash, class_hash } = await this.declare(payload, details);
|
|
13199
13213
|
const declare = await this.waitForTransaction(transaction_hash, {
|
|
13200
13214
|
successStates: ["ACCEPTED_ON_L2" /* ACCEPTED_ON_L2 */]
|
|
13201
13215
|
});
|