starknet 6.10.2 → 7.0.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 +110 -0
- package/dist/index.global.js +116 -210
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +54 -108
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -108
- package/dist/index.mjs.map +1 -1
- package/package.json +5 -6
package/dist/index.js
CHANGED
|
@@ -633,8 +633,7 @@ function toCairoBool(value) {
|
|
|
633
633
|
return (+value).toString();
|
|
634
634
|
}
|
|
635
635
|
function hexToBytes(str) {
|
|
636
|
-
if (!isHex(str))
|
|
637
|
-
throw new Error(`${str} needs to be a hex-string`);
|
|
636
|
+
if (!isHex(str)) throw new Error(`${str} needs to be a hex-string`);
|
|
638
637
|
let adaptedValue = removeHexPrefix(str);
|
|
639
638
|
if (adaptedValue.length % 2 !== 0) {
|
|
640
639
|
adaptedValue = `0${adaptedValue}`;
|
|
@@ -722,15 +721,12 @@ function splitLongString(longStr) {
|
|
|
722
721
|
return longStr.match(regex) || [];
|
|
723
722
|
}
|
|
724
723
|
function encodeShortString(str) {
|
|
725
|
-
if (!isASCII(str))
|
|
726
|
-
|
|
727
|
-
if (!isShortString(str))
|
|
728
|
-
throw new Error(`${str} is too long`);
|
|
724
|
+
if (!isASCII(str)) throw new Error(`${str} is not an ASCII string`);
|
|
725
|
+
if (!isShortString(str)) throw new Error(`${str} is too long`);
|
|
729
726
|
return addHexPrefix(str.replace(/./g, (char) => char.charCodeAt(0).toString(16)));
|
|
730
727
|
}
|
|
731
728
|
function decodeShortString(str) {
|
|
732
|
-
if (!isASCII(str))
|
|
733
|
-
throw new Error(`${str} is not an ASCII string`);
|
|
729
|
+
if (!isASCII(str)) throw new Error(`${str} is not an ASCII string`);
|
|
734
730
|
if (isHex(str)) {
|
|
735
731
|
return removeHexPrefix(str).replace(/.{2}/g, (hex) => String.fromCharCode(parseInt(hex, 16)));
|
|
736
732
|
}
|
|
@@ -858,10 +854,8 @@ var CairoUint256 = class _CairoUint256 {
|
|
|
858
854
|
*/
|
|
859
855
|
static validate(bigNumberish) {
|
|
860
856
|
const bigInt = BigInt(bigNumberish);
|
|
861
|
-
if (bigInt < UINT_256_MIN)
|
|
862
|
-
|
|
863
|
-
if (bigInt > UINT_256_MAX)
|
|
864
|
-
throw new Error("bigNumberish is bigger than UINT_256_MAX");
|
|
857
|
+
if (bigInt < UINT_256_MIN) throw Error("bigNumberish is smaller than UINT_256_MIN");
|
|
858
|
+
if (bigInt > UINT_256_MAX) throw new Error("bigNumberish is bigger than UINT_256_MAX");
|
|
865
859
|
return bigInt;
|
|
866
860
|
}
|
|
867
861
|
/**
|
|
@@ -972,10 +966,8 @@ var CairoUint512 = class _CairoUint512 {
|
|
|
972
966
|
*/
|
|
973
967
|
static validate(bigNumberish) {
|
|
974
968
|
const bigInt = BigInt(bigNumberish);
|
|
975
|
-
if (bigInt < UINT_512_MIN)
|
|
976
|
-
|
|
977
|
-
if (bigInt > UINT_512_MAX)
|
|
978
|
-
throw Error("bigNumberish is bigger than UINT_512_MAX.");
|
|
969
|
+
if (bigInt < UINT_512_MIN) throw Error("bigNumberish is smaller than UINT_512_MIN.");
|
|
970
|
+
if (bigInt > UINT_512_MAX) throw Error("bigNumberish is bigger than UINT_512_MAX.");
|
|
979
971
|
return bigInt;
|
|
980
972
|
}
|
|
981
973
|
/**
|
|
@@ -1412,10 +1404,8 @@ function createAbiParser(abi) {
|
|
|
1412
1404
|
throw Error(`Unsupported ABI version ${version}`);
|
|
1413
1405
|
}
|
|
1414
1406
|
function getAbiVersion(abi) {
|
|
1415
|
-
if (abi.find((it) => it.type === "interface"))
|
|
1416
|
-
|
|
1417
|
-
if (isCairo1Abi(abi))
|
|
1418
|
-
return 1;
|
|
1407
|
+
if (abi.find((it) => it.type === "interface")) return 2;
|
|
1408
|
+
if (isCairo1Abi(abi)) return 1;
|
|
1419
1409
|
return 0;
|
|
1420
1410
|
}
|
|
1421
1411
|
function isNoConstructorValid(method, argsCalldata, abiMethod) {
|
|
@@ -1429,8 +1419,7 @@ function parseNamedTuple(namedTuple) {
|
|
|
1429
1419
|
return { name, type };
|
|
1430
1420
|
}
|
|
1431
1421
|
function parseSubTuple(s) {
|
|
1432
|
-
if (!s.includes("("))
|
|
1433
|
-
return { subTuple: [], result: s };
|
|
1422
|
+
if (!s.includes("(")) return { subTuple: [], result: s };
|
|
1434
1423
|
const subTuple = [];
|
|
1435
1424
|
let result = "";
|
|
1436
1425
|
let i = 0;
|
|
@@ -1440,10 +1429,8 @@ function parseSubTuple(s) {
|
|
|
1440
1429
|
const lBracket = i;
|
|
1441
1430
|
i++;
|
|
1442
1431
|
while (counter) {
|
|
1443
|
-
if (s[i] === ")")
|
|
1444
|
-
|
|
1445
|
-
if (s[i] === "(")
|
|
1446
|
-
counter++;
|
|
1432
|
+
if (s[i] === ")") counter--;
|
|
1433
|
+
if (s[i] === "(") counter++;
|
|
1447
1434
|
i++;
|
|
1448
1435
|
}
|
|
1449
1436
|
subTuple.push(s.substring(lBracket, i));
|
|
@@ -1750,8 +1737,7 @@ function parseCalldataValue(element, type, structs, enums) {
|
|
|
1750
1737
|
}
|
|
1751
1738
|
if (type === "core::starknet::eth_address::EthAddress")
|
|
1752
1739
|
return parseBaseTypes(type, element);
|
|
1753
|
-
if (type === "core::byte_array::ByteArray")
|
|
1754
|
-
return parseByteArray(element);
|
|
1740
|
+
if (type === "core::byte_array::ByteArray") return parseByteArray(element);
|
|
1755
1741
|
const { members } = structs[type];
|
|
1756
1742
|
const subElement = element;
|
|
1757
1743
|
return members.reduce((acc, it) => {
|
|
@@ -2071,8 +2057,7 @@ var validateFelt = (parameter, input) => {
|
|
|
2071
2057
|
isString(parameter) || isNumber(parameter) || isBigInt(parameter),
|
|
2072
2058
|
`Validate: arg ${input.name} should be a felt typed as (String, Number or BigInt)`
|
|
2073
2059
|
);
|
|
2074
|
-
if (isString(parameter) && !isHex(parameter))
|
|
2075
|
-
return;
|
|
2060
|
+
if (isString(parameter) && !isHex(parameter)) return;
|
|
2076
2061
|
const param = BigInt(parameter.toString(10));
|
|
2077
2062
|
assert(
|
|
2078
2063
|
// from : https://github.com/starkware-libs/starknet-specs/blob/29bab650be6b1847c92d4461d4c33008b5e50b1a/api/starknet_api_openrpc.json#L1266
|
|
@@ -2378,8 +2363,7 @@ var CallData = class _CallData {
|
|
|
2378
2363
|
validate(type, method, args = []) {
|
|
2379
2364
|
if (type !== "DEPLOY" /* DEPLOY */) {
|
|
2380
2365
|
const invocableFunctionNames = this.abi.filter((abi) => {
|
|
2381
|
-
if (abi.type !== "function")
|
|
2382
|
-
return false;
|
|
2366
|
+
if (abi.type !== "function") return false;
|
|
2383
2367
|
const isView = abi.stateMutability === "view" || abi.state_mutability === "view";
|
|
2384
2368
|
return type === "INVOKE" /* INVOKE */ ? !isView : isView;
|
|
2385
2369
|
}).map((abi) => abi.name);
|
|
@@ -2457,13 +2441,10 @@ var CallData = class _CallData {
|
|
|
2457
2441
|
const oe = Array.isArray(o) ? [o.length.toString(), ...o] : o;
|
|
2458
2442
|
return Object.entries(oe).flatMap(([k, v]) => {
|
|
2459
2443
|
let value = v;
|
|
2460
|
-
if (k === "entrypoint")
|
|
2461
|
-
|
|
2462
|
-
else if (isLongText(value))
|
|
2463
|
-
value = byteArrayFromString(value);
|
|
2444
|
+
if (k === "entrypoint") value = getSelectorFromName(value);
|
|
2445
|
+
else if (isLongText(value)) value = byteArrayFromString(value);
|
|
2464
2446
|
const kk = Array.isArray(oe) && k === "0" ? "$$len" : k;
|
|
2465
|
-
if (isBigInt(value))
|
|
2466
|
-
return [[`${prefix}${kk}`, felt(value)]];
|
|
2447
|
+
if (isBigInt(value)) return [[`${prefix}${kk}`, felt(value)]];
|
|
2467
2448
|
if (Object(value) === value) {
|
|
2468
2449
|
const methodsKeys = Object.getOwnPropertyNames(Object.getPrototypeOf(value));
|
|
2469
2450
|
const keys = [...Object.getOwnPropertyNames(value), ...methodsKeys];
|
|
@@ -2911,8 +2892,7 @@ __export(json_exports, {
|
|
|
2911
2892
|
});
|
|
2912
2893
|
var json = __toESM(require("lossless-json"));
|
|
2913
2894
|
var parseIntAsNumberOrBigInt = (str) => {
|
|
2914
|
-
if (!json.isInteger(str))
|
|
2915
|
-
return parseFloat(str);
|
|
2895
|
+
if (!json.isInteger(str)) return parseFloat(str);
|
|
2916
2896
|
const num = parseInt(str, 10);
|
|
2917
2897
|
return Number.isSafeInteger(num) ? num : BigInt(str);
|
|
2918
2898
|
};
|
|
@@ -3108,8 +3088,7 @@ function compressProgram(jsonProgram) {
|
|
|
3108
3088
|
return btoaUniversal(compressedProgram);
|
|
3109
3089
|
}
|
|
3110
3090
|
function decompressProgram(base642) {
|
|
3111
|
-
if (Array.isArray(base642))
|
|
3112
|
-
return base642;
|
|
3091
|
+
if (Array.isArray(base642)) return base642;
|
|
3113
3092
|
const decompressed = arrayBufferToString((0, import_pako.ungzip)(atobUniversal(base642)));
|
|
3114
3093
|
return parse2(decompressed);
|
|
3115
3094
|
}
|
|
@@ -3121,8 +3100,7 @@ function makeAddress(input) {
|
|
|
3121
3100
|
return addHexPrefix(input).toLowerCase();
|
|
3122
3101
|
}
|
|
3123
3102
|
function formatSignature(sig) {
|
|
3124
|
-
if (!sig)
|
|
3125
|
-
throw Error("formatSignature: provided signature is undefined");
|
|
3103
|
+
if (!sig) throw Error("formatSignature: provided signature is undefined");
|
|
3126
3104
|
if (Array.isArray(sig)) {
|
|
3127
3105
|
return sig.map((it) => toHex(it));
|
|
3128
3106
|
}
|
|
@@ -3160,10 +3138,8 @@ function estimateFeeToBounds(estimate, amountOverhead = 50 /* L1_BOUND_MAX_AMOUN
|
|
|
3160
3138
|
};
|
|
3161
3139
|
}
|
|
3162
3140
|
function intDAM(dam) {
|
|
3163
|
-
if (dam === api_exports.EDataAvailabilityMode.L1)
|
|
3164
|
-
|
|
3165
|
-
if (dam === api_exports.EDataAvailabilityMode.L2)
|
|
3166
|
-
return api_exports.EDAMode.L2;
|
|
3141
|
+
if (dam === api_exports.EDataAvailabilityMode.L1) return api_exports.EDAMode.L1;
|
|
3142
|
+
if (dam === api_exports.EDataAvailabilityMode.L2) return api_exports.EDAMode.L2;
|
|
3167
3143
|
throw Error("EDAM conversion");
|
|
3168
3144
|
}
|
|
3169
3145
|
function toTransactionVersion(defaultVersion, providedVersion) {
|
|
@@ -3178,17 +3154,12 @@ function toTransactionVersion(defaultVersion, providedVersion) {
|
|
|
3178
3154
|
return providedVersion ? providedVersion0xs : defaultVersion0xs;
|
|
3179
3155
|
}
|
|
3180
3156
|
function toFeeVersion(providedVersion) {
|
|
3181
|
-
if (!providedVersion)
|
|
3182
|
-
return void 0;
|
|
3157
|
+
if (!providedVersion) return void 0;
|
|
3183
3158
|
const version = toHex(providedVersion);
|
|
3184
|
-
if (version === api_exports.ETransactionVersion.V0)
|
|
3185
|
-
|
|
3186
|
-
if (version === api_exports.ETransactionVersion.
|
|
3187
|
-
|
|
3188
|
-
if (version === api_exports.ETransactionVersion.V2)
|
|
3189
|
-
return api_exports.ETransactionVersion.F2;
|
|
3190
|
-
if (version === api_exports.ETransactionVersion.V3)
|
|
3191
|
-
return api_exports.ETransactionVersion.F3;
|
|
3159
|
+
if (version === api_exports.ETransactionVersion.V0) return api_exports.ETransactionVersion.F0;
|
|
3160
|
+
if (version === api_exports.ETransactionVersion.V1) return api_exports.ETransactionVersion.F1;
|
|
3161
|
+
if (version === api_exports.ETransactionVersion.V2) return api_exports.ETransactionVersion.F2;
|
|
3162
|
+
if (version === api_exports.ETransactionVersion.V3) return api_exports.ETransactionVersion.F3;
|
|
3192
3163
|
throw Error(`toFeeVersion: ${version} is not supported`);
|
|
3193
3164
|
}
|
|
3194
3165
|
function v3Details(details) {
|
|
@@ -3202,10 +3173,8 @@ function v3Details(details) {
|
|
|
3202
3173
|
};
|
|
3203
3174
|
}
|
|
3204
3175
|
function reduceV2(providedVersion) {
|
|
3205
|
-
if (providedVersion === api_exports.ETransactionVersion.F2)
|
|
3206
|
-
|
|
3207
|
-
if (providedVersion === api_exports.ETransactionVersion.V2)
|
|
3208
|
-
return api_exports.ETransactionVersion.V1;
|
|
3176
|
+
if (providedVersion === api_exports.ETransactionVersion.F2) return api_exports.ETransactionVersion.F1;
|
|
3177
|
+
if (providedVersion === api_exports.ETransactionVersion.V2) return api_exports.ETransactionVersion.V1;
|
|
3209
3178
|
return providedVersion;
|
|
3210
3179
|
}
|
|
3211
3180
|
|
|
@@ -3695,10 +3664,8 @@ var RpcChannel = class {
|
|
|
3695
3664
|
} = simulateTransactionOptions;
|
|
3696
3665
|
const block_id = new Block(blockIdentifier).identifier;
|
|
3697
3666
|
const simulationFlags = [];
|
|
3698
|
-
if (skipValidate)
|
|
3699
|
-
|
|
3700
|
-
if (skipFeeCharge)
|
|
3701
|
-
simulationFlags.push(rpcspec_0_6_exports.ESimulationFlag.SKIP_FEE_CHARGE);
|
|
3667
|
+
if (skipValidate) simulationFlags.push(rpcspec_0_6_exports.ESimulationFlag.SKIP_VALIDATE);
|
|
3668
|
+
if (skipFeeCharge) simulationFlags.push(rpcspec_0_6_exports.ESimulationFlag.SKIP_FEE_CHARGE);
|
|
3702
3669
|
return this.fetchEndpoint("starknet_simulateTransactions", {
|
|
3703
3670
|
block_id,
|
|
3704
3671
|
transactions: invocations.map((it) => this.buildTransaction(it)),
|
|
@@ -4247,10 +4214,8 @@ var RpcChannel2 = class {
|
|
|
4247
4214
|
} = simulateTransactionOptions;
|
|
4248
4215
|
const block_id = new Block(blockIdentifier).identifier;
|
|
4249
4216
|
const simulationFlags = [];
|
|
4250
|
-
if (skipValidate)
|
|
4251
|
-
|
|
4252
|
-
if (skipFeeCharge)
|
|
4253
|
-
simulationFlags.push(RPCSPEC07.ESimulationFlag.SKIP_FEE_CHARGE);
|
|
4217
|
+
if (skipValidate) simulationFlags.push(RPCSPEC07.ESimulationFlag.SKIP_VALIDATE);
|
|
4218
|
+
if (skipFeeCharge) simulationFlags.push(RPCSPEC07.ESimulationFlag.SKIP_FEE_CHARGE);
|
|
4254
4219
|
return this.fetchEndpoint("starknet_simulateTransactions", {
|
|
4255
4220
|
block_id,
|
|
4256
4221
|
transactions: invocations.map((it) => this.buildTransaction(it)),
|
|
@@ -4795,12 +4760,10 @@ var RpcProvider = class {
|
|
|
4795
4760
|
* ```
|
|
4796
4761
|
*/
|
|
4797
4762
|
async waitForBlock(blockIdentifier = "pending", retryInterval = 5e3) {
|
|
4798
|
-
if (blockIdentifier === "latest" /* LATEST */)
|
|
4799
|
-
return;
|
|
4763
|
+
if (blockIdentifier === "latest" /* LATEST */) return;
|
|
4800
4764
|
const currentBlock = await this.getBlockNumber();
|
|
4801
4765
|
const targetBlock = blockIdentifier === "pending" /* PENDING */ ? currentBlock + 1 : Number(toHex(blockIdentifier));
|
|
4802
|
-
if (targetBlock <= currentBlock)
|
|
4803
|
-
return;
|
|
4766
|
+
if (targetBlock <= currentBlock) return;
|
|
4804
4767
|
const { retries } = this.channel;
|
|
4805
4768
|
let retriesCount = retries;
|
|
4806
4769
|
let isTargetBlock = false;
|
|
@@ -5074,17 +5037,14 @@ function useDecoded(encoded) {
|
|
|
5074
5037
|
if (nextSubdomain === ZERO) {
|
|
5075
5038
|
const code2 = subdomain % bigAlphabetSizePlusOne;
|
|
5076
5039
|
subdomain = nextSubdomain;
|
|
5077
|
-
if (code2 === ZERO)
|
|
5078
|
-
|
|
5079
|
-
else
|
|
5080
|
-
decoded += bigAlphabet[Number(code2) - 1];
|
|
5040
|
+
if (code2 === ZERO) decoded += basicAlphabet[0];
|
|
5041
|
+
else decoded += bigAlphabet[Number(code2) - 1];
|
|
5081
5042
|
} else {
|
|
5082
5043
|
const code2 = subdomain % bigAlphabetSize;
|
|
5083
5044
|
decoded += bigAlphabet[Number(code2)];
|
|
5084
5045
|
subdomain /= bigAlphabetSize;
|
|
5085
5046
|
}
|
|
5086
|
-
} else
|
|
5087
|
-
decoded += basicAlphabet[Number(code)];
|
|
5047
|
+
} else decoded += basicAlphabet[Number(code)];
|
|
5088
5048
|
}
|
|
5089
5049
|
const [str, k] = extractStars(decoded);
|
|
5090
5050
|
if (k)
|
|
@@ -5104,8 +5064,7 @@ function useEncoded(decoded) {
|
|
|
5104
5064
|
decoded = str + bigAlphabet[bigAlphabet.length - 1].repeat(2 * (k + 1));
|
|
5105
5065
|
} else {
|
|
5106
5066
|
const [str, k] = extractStars(decoded);
|
|
5107
|
-
if (k)
|
|
5108
|
-
decoded = str + bigAlphabet[bigAlphabet.length - 1].repeat(1 + 2 * (k - 1));
|
|
5067
|
+
if (k) decoded = str + bigAlphabet[bigAlphabet.length - 1].repeat(1 + 2 * (k - 1));
|
|
5109
5068
|
}
|
|
5110
5069
|
for (let i = 0; i < decoded.length; i += 1) {
|
|
5111
5070
|
const char = decoded[i];
|
|
@@ -5760,8 +5719,7 @@ function encodeValue(types, type, data, ctx = {}, revision = import_starknet_typ
|
|
|
5760
5719
|
const variantType = enumType.find((t) => t.name === variantKey);
|
|
5761
5720
|
const variantIndex = enumType.indexOf(variantType);
|
|
5762
5721
|
const encodedSubtypes = variantType.type.slice(1, -1).split(",").map((subtype, index) => {
|
|
5763
|
-
if (!subtype)
|
|
5764
|
-
return subtype;
|
|
5722
|
+
if (!subtype) return subtype;
|
|
5765
5723
|
const subtypeData = variantData[index];
|
|
5766
5724
|
return encodeValue(types, subtype, subtypeData, void 0, revision)[1];
|
|
5767
5725
|
});
|
|
@@ -6152,19 +6110,16 @@ function getCairo1AbiEvents(abi) {
|
|
|
6152
6110
|
const findName = (variant) => variant.type === name;
|
|
6153
6111
|
while (true) {
|
|
6154
6112
|
const eventEnum = abiEventsEnums.find((eventE) => eventE.variants.some(findName));
|
|
6155
|
-
if (typeof eventEnum === "undefined")
|
|
6156
|
-
break;
|
|
6113
|
+
if (typeof eventEnum === "undefined") break;
|
|
6157
6114
|
const variant = eventEnum.variants.find(findName);
|
|
6158
6115
|
nameList.unshift(variant.name);
|
|
6159
|
-
if (variant.kind === "flat")
|
|
6160
|
-
flat = true;
|
|
6116
|
+
if (variant.kind === "flat") flat = true;
|
|
6161
6117
|
name = eventEnum.name;
|
|
6162
6118
|
}
|
|
6163
6119
|
if (nameList.length === 0) {
|
|
6164
6120
|
throw new Error("inconsistency in ABI events definition.");
|
|
6165
6121
|
}
|
|
6166
|
-
if (flat)
|
|
6167
|
-
nameList = [nameList[nameList.length - 1]];
|
|
6122
|
+
if (flat) nameList = [nameList[nameList.length - 1]];
|
|
6168
6123
|
const final = nameList.pop();
|
|
6169
6124
|
let result = {
|
|
6170
6125
|
[addHexPrefix(starkCurve.keccak(utf8ToArray(final)).toString(16))]: event
|
|
@@ -6190,10 +6145,8 @@ function mergeAbiEvents(target, source) {
|
|
|
6190
6145
|
if (isObject(target) && isObject(source)) {
|
|
6191
6146
|
Object.keys(source).forEach((key) => {
|
|
6192
6147
|
if (isObject(source[key])) {
|
|
6193
|
-
if (!(key in target))
|
|
6194
|
-
|
|
6195
|
-
else
|
|
6196
|
-
output[key] = mergeAbiEvents(target[key], source[key]);
|
|
6148
|
+
if (!(key in target)) Object.assign(output, { [key]: source[key] });
|
|
6149
|
+
else output[key] = mergeAbiEvents(target[key], source[key]);
|
|
6197
6150
|
} else {
|
|
6198
6151
|
Object.assign(output, { [key]: source[key] });
|
|
6199
6152
|
}
|
|
@@ -6280,10 +6233,8 @@ var Account = class extends RpcProvider2 {
|
|
|
6280
6233
|
}
|
|
6281
6234
|
// provided version or contract based preferred transactionVersion
|
|
6282
6235
|
getPreferredVersion(type12, type3) {
|
|
6283
|
-
if (this.transactionVersion === api_exports.ETransactionVersion.V3)
|
|
6284
|
-
|
|
6285
|
-
if (this.transactionVersion === api_exports.ETransactionVersion.V2)
|
|
6286
|
-
return type12;
|
|
6236
|
+
if (this.transactionVersion === api_exports.ETransactionVersion.V3) return type3;
|
|
6237
|
+
if (this.transactionVersion === api_exports.ETransactionVersion.V2) return type12;
|
|
6287
6238
|
return api_exports.ETransactionVersion.V3;
|
|
6288
6239
|
}
|
|
6289
6240
|
async getNonce(blockIdentifier) {
|
|
@@ -6989,13 +6940,11 @@ var WalletAccount = class extends Account {
|
|
|
6989
6940
|
super(providerOrOptions, "", "", cairoVersion);
|
|
6990
6941
|
this.walletProvider = walletProvider;
|
|
6991
6942
|
this.walletProvider.on("accountsChanged", (res) => {
|
|
6992
|
-
if (!res)
|
|
6993
|
-
return;
|
|
6943
|
+
if (!res) return;
|
|
6994
6944
|
this.address = res[0].toLowerCase();
|
|
6995
6945
|
});
|
|
6996
6946
|
this.walletProvider.on("networkChanged", (res) => {
|
|
6997
|
-
if (!res)
|
|
6998
|
-
return;
|
|
6947
|
+
if (!res) return;
|
|
6999
6948
|
this.channel.setChainId(res);
|
|
7000
6949
|
});
|
|
7001
6950
|
walletProvider.request({
|
|
@@ -7135,8 +7084,7 @@ function buildEstimate(contract, functionAbi) {
|
|
|
7135
7084
|
};
|
|
7136
7085
|
}
|
|
7137
7086
|
function getCalldata(args, callback) {
|
|
7138
|
-
if (Array.isArray(args) && "__compiled__" in args)
|
|
7139
|
-
return args;
|
|
7087
|
+
if (Array.isArray(args) && "__compiled__" in args) return args;
|
|
7140
7088
|
if (Array.isArray(args) && Array.isArray(args[0]) && "__compiled__" in args[0])
|
|
7141
7089
|
return args[0];
|
|
7142
7090
|
return callback();
|
|
@@ -7176,8 +7124,7 @@ var Contract = class {
|
|
|
7176
7124
|
estimateFee: { enumerable: true, value: {}, writable: false }
|
|
7177
7125
|
});
|
|
7178
7126
|
this.abi.forEach((abiElement) => {
|
|
7179
|
-
if (abiElement.type !== "function")
|
|
7180
|
-
return;
|
|
7127
|
+
if (abiElement.type !== "function") return;
|
|
7181
7128
|
const signature = abiElement.name;
|
|
7182
7129
|
if (!this[signature]) {
|
|
7183
7130
|
Object.defineProperty(this, signature, {
|
|
@@ -7277,8 +7224,7 @@ var Contract = class {
|
|
|
7277
7224
|
nonce
|
|
7278
7225
|
});
|
|
7279
7226
|
}
|
|
7280
|
-
if (!nonce)
|
|
7281
|
-
throw new Error(`Nonce is required when invoking a function without an account`);
|
|
7227
|
+
if (!nonce) throw new Error(`Nonce is required when invoking a function without an account`);
|
|
7282
7228
|
console.warn(`Invoking ${method} without an account. This will not work on a public node.`);
|
|
7283
7229
|
return this.providerOrAccount.invokeFunction(
|
|
7284
7230
|
{
|