starknet 5.4.1 → 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 +16 -0
- package/dist/index.d.ts +14 -5
- package/dist/index.global.js +46 -112
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +49 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +45 -9
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -2
package/dist/index.js
CHANGED
|
@@ -32,6 +32,7 @@ __export(src_exports, {
|
|
|
32
32
|
Contract: () => Contract,
|
|
33
33
|
ContractFactory: () => ContractFactory,
|
|
34
34
|
ContractInterface: () => ContractInterface,
|
|
35
|
+
CustomError: () => CustomError,
|
|
35
36
|
EntryPointType: () => EntryPointType,
|
|
36
37
|
GatewayError: () => GatewayError,
|
|
37
38
|
HttpError: () => HttpError,
|
|
@@ -51,6 +52,8 @@ __export(src_exports, {
|
|
|
51
52
|
defaultProvider: () => defaultProvider,
|
|
52
53
|
ec: () => ec_exports,
|
|
53
54
|
encode: () => encode_exports,
|
|
55
|
+
fixProto: () => fixProto,
|
|
56
|
+
fixStack: () => fixStack,
|
|
54
57
|
getChecksumAddress: () => getChecksumAddress,
|
|
55
58
|
hash: () => hash_exports,
|
|
56
59
|
isUrl: () => isUrl,
|
|
@@ -2914,8 +2917,27 @@ var RPCResponseParser = class {
|
|
|
2914
2917
|
};
|
|
2915
2918
|
|
|
2916
2919
|
// src/provider/errors.ts
|
|
2917
|
-
|
|
2918
|
-
|
|
2920
|
+
function fixStack(target, fn = target.constructor) {
|
|
2921
|
+
const { captureStackTrace } = Error;
|
|
2922
|
+
captureStackTrace && captureStackTrace(target, fn);
|
|
2923
|
+
}
|
|
2924
|
+
function fixProto(target, prototype) {
|
|
2925
|
+
const { setPrototypeOf } = Object;
|
|
2926
|
+
setPrototypeOf ? setPrototypeOf(target, prototype) : target.__proto__ = prototype;
|
|
2927
|
+
}
|
|
2928
|
+
var CustomError = class extends Error {
|
|
2929
|
+
constructor(message) {
|
|
2930
|
+
super(message);
|
|
2931
|
+
Object.defineProperty(this, "name", {
|
|
2932
|
+
value: new.target.name,
|
|
2933
|
+
enumerable: false,
|
|
2934
|
+
configurable: true
|
|
2935
|
+
});
|
|
2936
|
+
fixProto(this, new.target.prototype);
|
|
2937
|
+
fixStack(this);
|
|
2938
|
+
}
|
|
2939
|
+
};
|
|
2940
|
+
var LibraryError = class extends CustomError {
|
|
2919
2941
|
};
|
|
2920
2942
|
var GatewayError = class extends LibraryError {
|
|
2921
2943
|
constructor(message, errorCode) {
|
|
@@ -3583,6 +3605,12 @@ var SequencerAPIResponseParser = class extends ResponseParser {
|
|
|
3583
3605
|
}
|
|
3584
3606
|
};
|
|
3585
3607
|
}
|
|
3608
|
+
parseSierraContractClassResponse(res) {
|
|
3609
|
+
return {
|
|
3610
|
+
...res,
|
|
3611
|
+
abi: JSON.parse(res.abi)
|
|
3612
|
+
};
|
|
3613
|
+
}
|
|
3586
3614
|
};
|
|
3587
3615
|
|
|
3588
3616
|
// src/utils/url.ts
|
|
@@ -3790,16 +3818,24 @@ var SequencerProvider = class {
|
|
|
3790
3818
|
}
|
|
3791
3819
|
async getClassAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
3792
3820
|
return this.fetchEndpoint("get_full_contract", { blockIdentifier, contractAddress }).then(
|
|
3793
|
-
|
|
3821
|
+
(res) => {
|
|
3822
|
+
if (isSierra(res)) {
|
|
3823
|
+
return this.responseParser.parseSierraContractClassResponse(res);
|
|
3824
|
+
}
|
|
3825
|
+
return parseContract(res);
|
|
3826
|
+
}
|
|
3794
3827
|
);
|
|
3795
3828
|
}
|
|
3796
3829
|
async getClassHashAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
3797
3830
|
return this.fetchEndpoint("get_class_hash_at", { blockIdentifier, contractAddress });
|
|
3798
3831
|
}
|
|
3799
3832
|
async getClassByHash(classHash, blockIdentifier = this.blockIdentifier) {
|
|
3800
|
-
return this.fetchEndpoint("get_class_by_hash", { classHash, blockIdentifier }).then(
|
|
3801
|
-
|
|
3802
|
-
|
|
3833
|
+
return this.fetchEndpoint("get_class_by_hash", { classHash, blockIdentifier }).then((res) => {
|
|
3834
|
+
if (isSierra(res)) {
|
|
3835
|
+
return this.responseParser.parseSierraContractClassResponse(res);
|
|
3836
|
+
}
|
|
3837
|
+
return parseContract(res);
|
|
3838
|
+
});
|
|
3803
3839
|
}
|
|
3804
3840
|
async getCompiledClassByClassHash(classHash, blockIdentifier = this.blockIdentifier) {
|
|
3805
3841
|
return this.fetchEndpoint("get_compiled_class_by_class_hash", { classHash, blockIdentifier });
|
|
@@ -4450,7 +4486,7 @@ var CallData = class {
|
|
|
4450
4486
|
const invocableFunctionNames = this.abi.filter((abi) => {
|
|
4451
4487
|
if (abi.type !== "function")
|
|
4452
4488
|
return false;
|
|
4453
|
-
const isView = abi.stateMutability === "view";
|
|
4489
|
+
const isView = abi.stateMutability === "view" || abi.state_mutability === "view";
|
|
4454
4490
|
return type === "INVOKE" ? !isView : isView;
|
|
4455
4491
|
}).map((abi) => abi.name);
|
|
4456
4492
|
assert(
|
|
@@ -4572,7 +4608,7 @@ function buildInvoke(contract, functionAbi) {
|
|
|
4572
4608
|
};
|
|
4573
4609
|
}
|
|
4574
4610
|
function buildDefault(contract, functionAbi) {
|
|
4575
|
-
if (functionAbi.stateMutability === "view") {
|
|
4611
|
+
if (functionAbi.stateMutability === "view" || functionAbi.state_mutability === "view") {
|
|
4576
4612
|
return buildCall(contract, functionAbi);
|
|
4577
4613
|
}
|
|
4578
4614
|
return buildInvoke(contract, functionAbi);
|
|
@@ -5442,8 +5478,8 @@ var Account = class extends Provider {
|
|
|
5442
5478
|
return parseUDCEvent(txReceipt);
|
|
5443
5479
|
}
|
|
5444
5480
|
async declareAndDeploy(payload, details) {
|
|
5445
|
-
const {
|
|
5446
|
-
const { transaction_hash, class_hash } = await this.declare(
|
|
5481
|
+
const { constructorCalldata, salt, unique } = payload;
|
|
5482
|
+
const { transaction_hash, class_hash } = await this.declare(payload, details);
|
|
5447
5483
|
const declare = await this.waitForTransaction(transaction_hash, {
|
|
5448
5484
|
successStates: ["ACCEPTED_ON_L2" /* ACCEPTED_ON_L2 */]
|
|
5449
5485
|
});
|
|
@@ -5680,6 +5716,7 @@ var number = num_exports;
|
|
|
5680
5716
|
Contract,
|
|
5681
5717
|
ContractFactory,
|
|
5682
5718
|
ContractInterface,
|
|
5719
|
+
CustomError,
|
|
5683
5720
|
EntryPointType,
|
|
5684
5721
|
GatewayError,
|
|
5685
5722
|
HttpError,
|
|
@@ -5699,6 +5736,8 @@ var number = num_exports;
|
|
|
5699
5736
|
defaultProvider,
|
|
5700
5737
|
ec,
|
|
5701
5738
|
encode,
|
|
5739
|
+
fixProto,
|
|
5740
|
+
fixStack,
|
|
5702
5741
|
getChecksumAddress,
|
|
5703
5742
|
hash,
|
|
5704
5743
|
isUrl,
|