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.mjs
CHANGED
|
@@ -2850,7 +2850,26 @@ var RPCResponseParser = class {
|
|
|
2850
2850
|
};
|
|
2851
2851
|
|
|
2852
2852
|
// src/provider/errors.ts
|
|
2853
|
-
|
|
2853
|
+
function fixStack(target, fn = target.constructor) {
|
|
2854
|
+
const { captureStackTrace } = Error;
|
|
2855
|
+
captureStackTrace && captureStackTrace(target, fn);
|
|
2856
|
+
}
|
|
2857
|
+
function fixProto(target, prototype) {
|
|
2858
|
+
const { setPrototypeOf } = Object;
|
|
2859
|
+
setPrototypeOf ? setPrototypeOf(target, prototype) : target.__proto__ = prototype;
|
|
2860
|
+
}
|
|
2861
|
+
var CustomError = class extends Error {
|
|
2862
|
+
constructor(message) {
|
|
2863
|
+
super(message);
|
|
2864
|
+
Object.defineProperty(this, "name", {
|
|
2865
|
+
value: new.target.name,
|
|
2866
|
+
enumerable: false,
|
|
2867
|
+
configurable: true
|
|
2868
|
+
});
|
|
2869
|
+
fixProto(this, new.target.prototype);
|
|
2870
|
+
fixStack(this);
|
|
2871
|
+
}
|
|
2872
|
+
};
|
|
2854
2873
|
var LibraryError = class extends CustomError {
|
|
2855
2874
|
};
|
|
2856
2875
|
var GatewayError = class extends LibraryError {
|
|
@@ -3519,6 +3538,12 @@ var SequencerAPIResponseParser = class extends ResponseParser {
|
|
|
3519
3538
|
}
|
|
3520
3539
|
};
|
|
3521
3540
|
}
|
|
3541
|
+
parseSierraContractClassResponse(res) {
|
|
3542
|
+
return {
|
|
3543
|
+
...res,
|
|
3544
|
+
abi: JSON.parse(res.abi)
|
|
3545
|
+
};
|
|
3546
|
+
}
|
|
3522
3547
|
};
|
|
3523
3548
|
|
|
3524
3549
|
// src/utils/url.ts
|
|
@@ -3726,16 +3751,24 @@ var SequencerProvider = class {
|
|
|
3726
3751
|
}
|
|
3727
3752
|
async getClassAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
3728
3753
|
return this.fetchEndpoint("get_full_contract", { blockIdentifier, contractAddress }).then(
|
|
3729
|
-
|
|
3754
|
+
(res) => {
|
|
3755
|
+
if (isSierra(res)) {
|
|
3756
|
+
return this.responseParser.parseSierraContractClassResponse(res);
|
|
3757
|
+
}
|
|
3758
|
+
return parseContract(res);
|
|
3759
|
+
}
|
|
3730
3760
|
);
|
|
3731
3761
|
}
|
|
3732
3762
|
async getClassHashAt(contractAddress, blockIdentifier = this.blockIdentifier) {
|
|
3733
3763
|
return this.fetchEndpoint("get_class_hash_at", { blockIdentifier, contractAddress });
|
|
3734
3764
|
}
|
|
3735
3765
|
async getClassByHash(classHash, blockIdentifier = this.blockIdentifier) {
|
|
3736
|
-
return this.fetchEndpoint("get_class_by_hash", { classHash, blockIdentifier }).then(
|
|
3737
|
-
|
|
3738
|
-
|
|
3766
|
+
return this.fetchEndpoint("get_class_by_hash", { classHash, blockIdentifier }).then((res) => {
|
|
3767
|
+
if (isSierra(res)) {
|
|
3768
|
+
return this.responseParser.parseSierraContractClassResponse(res);
|
|
3769
|
+
}
|
|
3770
|
+
return parseContract(res);
|
|
3771
|
+
});
|
|
3739
3772
|
}
|
|
3740
3773
|
async getCompiledClassByClassHash(classHash, blockIdentifier = this.blockIdentifier) {
|
|
3741
3774
|
return this.fetchEndpoint("get_compiled_class_by_class_hash", { classHash, blockIdentifier });
|
|
@@ -4386,7 +4419,7 @@ var CallData = class {
|
|
|
4386
4419
|
const invocableFunctionNames = this.abi.filter((abi) => {
|
|
4387
4420
|
if (abi.type !== "function")
|
|
4388
4421
|
return false;
|
|
4389
|
-
const isView = abi.stateMutability === "view";
|
|
4422
|
+
const isView = abi.stateMutability === "view" || abi.state_mutability === "view";
|
|
4390
4423
|
return type === "INVOKE" ? !isView : isView;
|
|
4391
4424
|
}).map((abi) => abi.name);
|
|
4392
4425
|
assert(
|
|
@@ -4508,7 +4541,7 @@ function buildInvoke(contract, functionAbi) {
|
|
|
4508
4541
|
};
|
|
4509
4542
|
}
|
|
4510
4543
|
function buildDefault(contract, functionAbi) {
|
|
4511
|
-
if (functionAbi.stateMutability === "view") {
|
|
4544
|
+
if (functionAbi.stateMutability === "view" || functionAbi.state_mutability === "view") {
|
|
4512
4545
|
return buildCall(contract, functionAbi);
|
|
4513
4546
|
}
|
|
4514
4547
|
return buildInvoke(contract, functionAbi);
|
|
@@ -5378,8 +5411,8 @@ var Account = class extends Provider {
|
|
|
5378
5411
|
return parseUDCEvent(txReceipt);
|
|
5379
5412
|
}
|
|
5380
5413
|
async declareAndDeploy(payload, details) {
|
|
5381
|
-
const {
|
|
5382
|
-
const { transaction_hash, class_hash } = await this.declare(
|
|
5414
|
+
const { constructorCalldata, salt, unique } = payload;
|
|
5415
|
+
const { transaction_hash, class_hash } = await this.declare(payload, details);
|
|
5383
5416
|
const declare = await this.waitForTransaction(transaction_hash, {
|
|
5384
5417
|
successStates: ["ACCEPTED_ON_L2" /* ACCEPTED_ON_L2 */]
|
|
5385
5418
|
});
|
|
@@ -5615,6 +5648,7 @@ export {
|
|
|
5615
5648
|
Contract,
|
|
5616
5649
|
ContractFactory,
|
|
5617
5650
|
ContractInterface,
|
|
5651
|
+
CustomError,
|
|
5618
5652
|
EntryPointType,
|
|
5619
5653
|
GatewayError,
|
|
5620
5654
|
HttpError,
|
|
@@ -5634,6 +5668,8 @@ export {
|
|
|
5634
5668
|
defaultProvider,
|
|
5635
5669
|
ec_exports as ec,
|
|
5636
5670
|
encode_exports as encode,
|
|
5671
|
+
fixProto,
|
|
5672
|
+
fixStack,
|
|
5637
5673
|
getChecksumAddress,
|
|
5638
5674
|
hash_exports as hash,
|
|
5639
5675
|
isUrl,
|