starknet 9.1.0 → 9.2.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 +12 -0
- package/dist/index.d.ts +175 -135
- package/dist/index.global.js +108 -50
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +118 -60
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +118 -60
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.global.js
CHANGED
|
@@ -766,6 +766,26 @@ var starknet = (() => {
|
|
|
766
766
|
LEGACY: "0"
|
|
767
767
|
};
|
|
768
768
|
|
|
769
|
+
// src/provider/types/spec.type.ts
|
|
770
|
+
var { ETransactionVersion: ETransactionVersion5 } = esm_exports;
|
|
771
|
+
var { ETransactionVersion2: ETransactionVersion23 } = esm_exports;
|
|
772
|
+
var { ETransactionVersion3: ETransactionVersion33 } = esm_exports;
|
|
773
|
+
var { EDataAvailabilityMode: EDataAvailabilityMode3 } = esm_exports2;
|
|
774
|
+
var { EDAMode: EDAMode3 } = esm_exports2;
|
|
775
|
+
function isRPC08Plus_ResourceBounds(entry) {
|
|
776
|
+
return "l1_data_gas" in entry;
|
|
777
|
+
}
|
|
778
|
+
function isRPC08Plus_ResourceBoundsBN(entry) {
|
|
779
|
+
return "l1_data_gas" in entry;
|
|
780
|
+
}
|
|
781
|
+
var { ETransactionStatus: ETransactionStatus3 } = esm_exports2;
|
|
782
|
+
var { ETransactionExecutionStatus: ETransactionExecutionStatus3 } = esm_exports2;
|
|
783
|
+
var { ETransactionType: TransactionType } = esm_exports;
|
|
784
|
+
var { EBlockStatus: BlockStatus } = esm_exports;
|
|
785
|
+
var { ETransactionFinalityStatus: TransactionFinalityStatus } = esm_exports;
|
|
786
|
+
var { ETransactionExecutionStatus: TransactionExecutionStatus } = esm_exports;
|
|
787
|
+
var { EBlockTag: BlockTag } = esm_exports;
|
|
788
|
+
|
|
769
789
|
// src/utils/encode.ts
|
|
770
790
|
var encode_exports = {};
|
|
771
791
|
__export(encode_exports, {
|
|
@@ -1198,6 +1218,22 @@ var starknet = (() => {
|
|
|
1198
1218
|
}
|
|
1199
1219
|
},
|
|
1200
1220
|
defaultTipType: "recommendedTip",
|
|
1221
|
+
channelDefaults: {
|
|
1222
|
+
options: {
|
|
1223
|
+
headers: { "Content-Type": "application/json" },
|
|
1224
|
+
blockIdentifier: BlockTag.LATEST,
|
|
1225
|
+
retries: 200
|
|
1226
|
+
},
|
|
1227
|
+
methods: {
|
|
1228
|
+
simulateTransaction: {
|
|
1229
|
+
skipValidate: true,
|
|
1230
|
+
skipFeeCharge: true
|
|
1231
|
+
},
|
|
1232
|
+
getEstimateFee: {
|
|
1233
|
+
skipValidate: true
|
|
1234
|
+
}
|
|
1235
|
+
}
|
|
1236
|
+
},
|
|
1201
1237
|
fetch: void 0,
|
|
1202
1238
|
websocket: void 0,
|
|
1203
1239
|
buffer: void 0,
|
|
@@ -1242,11 +1278,51 @@ var starknet = (() => {
|
|
|
1242
1278
|
}
|
|
1243
1279
|
return _Configuration.instance;
|
|
1244
1280
|
}
|
|
1281
|
+
/**
|
|
1282
|
+
* Get a nested value from an object using a dot-notation path
|
|
1283
|
+
* @param obj - The object to traverse
|
|
1284
|
+
* @param path - The dot-notation path (e.g., 'a.b.c')
|
|
1285
|
+
* @returns The value at the path, or undefined if not found
|
|
1286
|
+
*/
|
|
1287
|
+
getNestedValue(obj, path) {
|
|
1288
|
+
const keys = path.split(".");
|
|
1289
|
+
return keys.reduce((current, key) => {
|
|
1290
|
+
if (current === null || current === void 0) {
|
|
1291
|
+
return void 0;
|
|
1292
|
+
}
|
|
1293
|
+
return current[key];
|
|
1294
|
+
}, obj);
|
|
1295
|
+
}
|
|
1296
|
+
/**
|
|
1297
|
+
* Set a nested value in an object using a dot-notation path
|
|
1298
|
+
* @param obj - The object to modify
|
|
1299
|
+
* @param path - The dot-notation path (e.g., 'a.b.c')
|
|
1300
|
+
* @param value - The value to set
|
|
1301
|
+
*/
|
|
1302
|
+
setNestedValue(obj, path, value) {
|
|
1303
|
+
const keys = path.split(".");
|
|
1304
|
+
const lastKey = keys.pop();
|
|
1305
|
+
const target = keys.reduce((current, key) => {
|
|
1306
|
+
if (!(key in current) || typeof current[key] !== "object" || current[key] === null) {
|
|
1307
|
+
current[key] = {};
|
|
1308
|
+
}
|
|
1309
|
+
return current[key];
|
|
1310
|
+
}, obj);
|
|
1311
|
+
target[lastKey] = value;
|
|
1312
|
+
}
|
|
1245
1313
|
get(key, defaultValue) {
|
|
1314
|
+
if (key.includes(".")) {
|
|
1315
|
+
const value = this.getNestedValue(this.config, key);
|
|
1316
|
+
return value ?? defaultValue;
|
|
1317
|
+
}
|
|
1246
1318
|
return this.config[key] ?? defaultValue;
|
|
1247
1319
|
}
|
|
1248
1320
|
set(key, value) {
|
|
1249
|
-
|
|
1321
|
+
if (key.includes(".")) {
|
|
1322
|
+
this.setNestedValue(this.config, key, value);
|
|
1323
|
+
} else {
|
|
1324
|
+
this.config[key] = value;
|
|
1325
|
+
}
|
|
1250
1326
|
}
|
|
1251
1327
|
update(configData) {
|
|
1252
1328
|
this.config = {
|
|
@@ -1415,26 +1491,6 @@ ${JSON.stringify(data, null, 2)}`;
|
|
|
1415
1491
|
CONSTRUCTOR: "CONSTRUCTOR"
|
|
1416
1492
|
};
|
|
1417
1493
|
|
|
1418
|
-
// src/provider/types/spec.type.ts
|
|
1419
|
-
var { ETransactionVersion: ETransactionVersion5 } = esm_exports;
|
|
1420
|
-
var { ETransactionVersion2: ETransactionVersion23 } = esm_exports;
|
|
1421
|
-
var { ETransactionVersion3: ETransactionVersion33 } = esm_exports;
|
|
1422
|
-
var { EDataAvailabilityMode: EDataAvailabilityMode3 } = esm_exports2;
|
|
1423
|
-
var { EDAMode: EDAMode3 } = esm_exports2;
|
|
1424
|
-
function isRPC08Plus_ResourceBounds(entry) {
|
|
1425
|
-
return "l1_data_gas" in entry;
|
|
1426
|
-
}
|
|
1427
|
-
function isRPC08Plus_ResourceBoundsBN(entry) {
|
|
1428
|
-
return "l1_data_gas" in entry;
|
|
1429
|
-
}
|
|
1430
|
-
var { ETransactionStatus: ETransactionStatus3 } = esm_exports2;
|
|
1431
|
-
var { ETransactionExecutionStatus: ETransactionExecutionStatus3 } = esm_exports2;
|
|
1432
|
-
var { ETransactionType: TransactionType } = esm_exports;
|
|
1433
|
-
var { EBlockStatus: BlockStatus } = esm_exports;
|
|
1434
|
-
var { ETransactionFinalityStatus: TransactionFinalityStatus } = esm_exports;
|
|
1435
|
-
var { ETransactionExecutionStatus: TransactionExecutionStatus } = esm_exports;
|
|
1436
|
-
var { EBlockTag: BlockTag } = esm_exports;
|
|
1437
|
-
|
|
1438
1494
|
// src/types/calldata.ts
|
|
1439
1495
|
var ValidateType = {
|
|
1440
1496
|
DEPLOY: "DEPLOY",
|
|
@@ -14725,7 +14781,7 @@ ${indent}}` : "}";
|
|
|
14725
14781
|
}
|
|
14726
14782
|
|
|
14727
14783
|
// src/utils/connect/fetch.ts
|
|
14728
|
-
var fetch_default = typeof globalThis !== "undefined" && globalThis.fetch.bind(globalThis) || typeof window !== "undefined" && window.fetch.bind(window) || typeof global !== "undefined" && global.fetch.bind(global) || (() => {
|
|
14784
|
+
var fetch_default = typeof globalThis !== "undefined" && typeof globalThis.fetch !== "undefined" && globalThis.fetch.bind(globalThis) || typeof window !== "undefined" && typeof window.fetch !== "undefined" && window.fetch.bind(window) || typeof global !== "undefined" && typeof global.fetch !== "undefined" && global.fetch.bind(global) || (() => {
|
|
14729
14785
|
throw new LibraryError(
|
|
14730
14786
|
"'fetch()' not detected, use the 'baseFetch' constructor parameter to set it"
|
|
14731
14787
|
);
|
|
@@ -14956,11 +15012,6 @@ ${indent}}` : "}";
|
|
|
14956
15012
|
}
|
|
14957
15013
|
|
|
14958
15014
|
// src/channel/rpc_0_9_0.ts
|
|
14959
|
-
var defaultOptions = {
|
|
14960
|
-
headers: { "Content-Type": "application/json" },
|
|
14961
|
-
blockIdentifier: BlockTag.LATEST,
|
|
14962
|
-
retries: 200
|
|
14963
|
-
};
|
|
14964
15015
|
var RpcChannel = class {
|
|
14965
15016
|
id = "RPC090";
|
|
14966
15017
|
/**
|
|
@@ -15010,11 +15061,12 @@ ${indent}}` : "}";
|
|
|
15010
15061
|
this.channelSpecVersion
|
|
15011
15062
|
);
|
|
15012
15063
|
}
|
|
15064
|
+
const channelDefaults = config.get("channelDefaults");
|
|
15013
15065
|
this.baseFetch = baseFetch || config.get("fetch") || fetch_default;
|
|
15014
|
-
this.blockIdentifier = blockIdentifier ??
|
|
15066
|
+
this.blockIdentifier = blockIdentifier ?? channelDefaults.options.blockIdentifier;
|
|
15015
15067
|
this.chainId = chainId;
|
|
15016
|
-
this.headers = { ...
|
|
15017
|
-
this.retries = retries ??
|
|
15068
|
+
this.headers = { ...channelDefaults.options.headers, ...headers };
|
|
15069
|
+
this.retries = retries ?? channelDefaults.options.retries;
|
|
15018
15070
|
this.specVersion = specVersion;
|
|
15019
15071
|
this.transactionRetryIntervalFallback = transactionRetryIntervalFallback;
|
|
15020
15072
|
this.waitMode = waitMode ?? false;
|
|
@@ -15228,14 +15280,16 @@ ${indent}}` : "}";
|
|
|
15228
15280
|
* @param invocations AccountInvocations
|
|
15229
15281
|
* @param simulateTransactionOptions blockIdentifier and flags to skip validation and fee charge<br/>
|
|
15230
15282
|
* - blockIdentifier<br/>
|
|
15231
|
-
* - skipValidate (default
|
|
15283
|
+
* - skipValidate (default true)<br/>
|
|
15232
15284
|
* - skipFeeCharge (default true)<br/>
|
|
15233
15285
|
*/
|
|
15234
15286
|
simulateTransaction(invocations, simulateTransactionOptions = {}) {
|
|
15287
|
+
const channelDefaults = config.get("channelDefaults");
|
|
15288
|
+
const methodDefaults = channelDefaults.methods.simulateTransaction || {};
|
|
15235
15289
|
const {
|
|
15236
15290
|
blockIdentifier = this.blockIdentifier,
|
|
15237
|
-
skipValidate =
|
|
15238
|
-
skipFeeCharge =
|
|
15291
|
+
skipValidate = methodDefaults.skipValidate,
|
|
15292
|
+
skipFeeCharge = methodDefaults.skipFeeCharge
|
|
15239
15293
|
} = simulateTransactionOptions;
|
|
15240
15294
|
const block_id = new Block(blockIdentifier).identifier;
|
|
15241
15295
|
const simulationFlags = [];
|
|
@@ -15395,7 +15449,10 @@ ${indent}}` : "}";
|
|
|
15395
15449
|
contract_address
|
|
15396
15450
|
});
|
|
15397
15451
|
}
|
|
15398
|
-
async getEstimateFee(invocations,
|
|
15452
|
+
async getEstimateFee(invocations, options = {}) {
|
|
15453
|
+
const channelDefaults = config.get("channelDefaults");
|
|
15454
|
+
const methodDefaults = channelDefaults.methods.getEstimateFee || {};
|
|
15455
|
+
const { blockIdentifier = this.blockIdentifier, skipValidate = methodDefaults.skipValidate } = options;
|
|
15399
15456
|
const block_id = new Block(blockIdentifier).identifier;
|
|
15400
15457
|
const flags = {
|
|
15401
15458
|
simulation_flags: skipValidate ? [esm_exports.ESimulationFlag.SKIP_VALIDATE] : []
|
|
@@ -15553,11 +15610,6 @@ ${indent}}` : "}";
|
|
|
15553
15610
|
__export(rpc_0_10_0_exports, {
|
|
15554
15611
|
RpcChannel: () => RpcChannel2
|
|
15555
15612
|
});
|
|
15556
|
-
var defaultOptions2 = {
|
|
15557
|
-
headers: { "Content-Type": "application/json" },
|
|
15558
|
-
blockIdentifier: BlockTag.LATEST,
|
|
15559
|
-
retries: 200
|
|
15560
|
-
};
|
|
15561
15613
|
var RpcChannel2 = class {
|
|
15562
15614
|
id = "RPC0.10.0";
|
|
15563
15615
|
/**
|
|
@@ -15607,11 +15659,12 @@ ${indent}}` : "}";
|
|
|
15607
15659
|
this.channelSpecVersion
|
|
15608
15660
|
);
|
|
15609
15661
|
}
|
|
15662
|
+
const channelDefaults = config.get("channelDefaults");
|
|
15610
15663
|
this.baseFetch = baseFetch || config.get("fetch") || fetch_default;
|
|
15611
|
-
this.blockIdentifier = blockIdentifier ??
|
|
15664
|
+
this.blockIdentifier = blockIdentifier ?? channelDefaults.options.blockIdentifier;
|
|
15612
15665
|
this.chainId = chainId;
|
|
15613
|
-
this.headers = { ...
|
|
15614
|
-
this.retries = retries ??
|
|
15666
|
+
this.headers = { ...channelDefaults.options.headers, ...headers };
|
|
15667
|
+
this.retries = retries ?? channelDefaults.options.retries;
|
|
15615
15668
|
this.specVersion = specVersion;
|
|
15616
15669
|
this.transactionRetryIntervalFallback = transactionRetryIntervalFallback;
|
|
15617
15670
|
this.waitMode = waitMode ?? false;
|
|
@@ -15825,14 +15878,16 @@ ${indent}}` : "}";
|
|
|
15825
15878
|
* @param invocations AccountInvocations
|
|
15826
15879
|
* @param simulateTransactionOptions blockIdentifier and flags to skip validation and fee charge<br/>
|
|
15827
15880
|
* - blockIdentifier<br/>
|
|
15828
|
-
* - skipValidate (default
|
|
15881
|
+
* - skipValidate (default true)<br/>
|
|
15829
15882
|
* - skipFeeCharge (default true)<br/>
|
|
15830
15883
|
*/
|
|
15831
15884
|
simulateTransaction(invocations, simulateTransactionOptions = {}) {
|
|
15885
|
+
const channelDefaults = config.get("channelDefaults");
|
|
15886
|
+
const methodDefaults = channelDefaults.methods.simulateTransaction || {};
|
|
15832
15887
|
const {
|
|
15833
15888
|
blockIdentifier = this.blockIdentifier,
|
|
15834
|
-
skipValidate =
|
|
15835
|
-
skipFeeCharge =
|
|
15889
|
+
skipValidate = methodDefaults.skipValidate,
|
|
15890
|
+
skipFeeCharge = methodDefaults.skipFeeCharge
|
|
15836
15891
|
} = simulateTransactionOptions;
|
|
15837
15892
|
const block_id = new Block(blockIdentifier).identifier;
|
|
15838
15893
|
const simulationFlags = [];
|
|
@@ -15992,7 +16047,10 @@ ${indent}}` : "}";
|
|
|
15992
16047
|
contract_address
|
|
15993
16048
|
});
|
|
15994
16049
|
}
|
|
15995
|
-
async getEstimateFee(invocations,
|
|
16050
|
+
async getEstimateFee(invocations, options = {}) {
|
|
16051
|
+
const channelDefaults = config.get("channelDefaults");
|
|
16052
|
+
const methodDefaults = channelDefaults.methods.getEstimateFee || {};
|
|
16053
|
+
const { blockIdentifier = this.blockIdentifier, skipValidate = methodDefaults.skipValidate } = options;
|
|
15996
16054
|
const block_id = new Block(blockIdentifier).identifier;
|
|
15997
16055
|
const flags = {
|
|
15998
16056
|
simulation_flags: skipValidate ? [esm_exports2.ESimulationFlag.SKIP_VALIDATE] : []
|
|
@@ -20166,7 +20224,7 @@ ${indent}}` : "}";
|
|
|
20166
20224
|
feeMode: convertFEE_MODE(parameters.fee_mode),
|
|
20167
20225
|
timeBounds: convertTIME_BOUNDS(parameters.time_bounds)
|
|
20168
20226
|
});
|
|
20169
|
-
var
|
|
20227
|
+
var defaultOptions = {
|
|
20170
20228
|
headers: { "Content-Type": "application/json" }
|
|
20171
20229
|
};
|
|
20172
20230
|
var PaymasterRpc = class _PaymasterRpc {
|
|
@@ -20177,14 +20235,14 @@ ${indent}}` : "}";
|
|
|
20177
20235
|
constructor(options) {
|
|
20178
20236
|
if (options instanceof _PaymasterRpc) {
|
|
20179
20237
|
this.nodeUrl = options.nodeUrl;
|
|
20180
|
-
this.headers = { ...
|
|
20238
|
+
this.headers = { ...defaultOptions.headers, ...options.headers };
|
|
20181
20239
|
this.baseFetch = options.baseFetch;
|
|
20182
20240
|
this.requestId = options.requestId;
|
|
20183
20241
|
return;
|
|
20184
20242
|
}
|
|
20185
20243
|
if (options && "nodeUrl" in options && "headers" in options && "baseFetch" in options) {
|
|
20186
20244
|
this.nodeUrl = options.nodeUrl ?? getDefaultPaymasterNodeUrl(void 0);
|
|
20187
|
-
this.headers = { ...
|
|
20245
|
+
this.headers = { ...defaultOptions.headers, ...options.headers };
|
|
20188
20246
|
this.baseFetch = options.baseFetch ?? fetch_default;
|
|
20189
20247
|
this.requestId = 0;
|
|
20190
20248
|
return;
|
|
@@ -20198,7 +20256,7 @@ ${indent}}` : "}";
|
|
|
20198
20256
|
this.nodeUrl = getDefaultPaymasterNodeUrl(void 0, options?.default);
|
|
20199
20257
|
}
|
|
20200
20258
|
this.baseFetch = baseFetch ?? fetch_default;
|
|
20201
|
-
this.headers = { ...
|
|
20259
|
+
this.headers = { ...defaultOptions.headers, ...headers };
|
|
20202
20260
|
this.requestId = 0;
|
|
20203
20261
|
}
|
|
20204
20262
|
fetch(method, params, id = 0) {
|