starknet 4.19.3 → 4.20.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 +11 -0
- package/dist/index.d.ts +58 -3
- package/dist/index.global.js +35 -0
- package/dist/index.global.js.map +1 -1
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +35 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -2716,6 +2716,9 @@ var Block = class {
|
|
|
2716
2716
|
set identifier(_identifier) {
|
|
2717
2717
|
this.setIdentifier(_identifier);
|
|
2718
2718
|
}
|
|
2719
|
+
get sequencerIdentifier() {
|
|
2720
|
+
return this.hash !== null ? { blockHash: this.hash } : { blockNumber: this.number ?? this.tag };
|
|
2721
|
+
}
|
|
2719
2722
|
};
|
|
2720
2723
|
|
|
2721
2724
|
// src/provider/rpc.ts
|
|
@@ -3151,6 +3154,29 @@ var SequencerAPIResponseParser = class extends ResponseParser {
|
|
|
3151
3154
|
class_hash: res.class_hash
|
|
3152
3155
|
};
|
|
3153
3156
|
}
|
|
3157
|
+
parseGetStateUpdateResponse(res) {
|
|
3158
|
+
const nonces = [].concat(res.state_diff.nonces).map(({ contract_address, nonce }) => {
|
|
3159
|
+
return {
|
|
3160
|
+
contract_address,
|
|
3161
|
+
nonce
|
|
3162
|
+
};
|
|
3163
|
+
});
|
|
3164
|
+
const storage_diffs = [].concat(res.state_diff.storage_diffs).map(({ address, storage_entries }) => {
|
|
3165
|
+
return {
|
|
3166
|
+
address,
|
|
3167
|
+
storage_entries
|
|
3168
|
+
};
|
|
3169
|
+
});
|
|
3170
|
+
return {
|
|
3171
|
+
...res,
|
|
3172
|
+
state_diff: {
|
|
3173
|
+
storage_diffs,
|
|
3174
|
+
declared_contract_hashes: res.state_diff.declared_contract_hashes,
|
|
3175
|
+
deployed_contracts: res.state_diff.deployed_contracts,
|
|
3176
|
+
nonces
|
|
3177
|
+
}
|
|
3178
|
+
};
|
|
3179
|
+
}
|
|
3154
3180
|
};
|
|
3155
3181
|
|
|
3156
3182
|
// src/utils/url.ts
|
|
@@ -3544,6 +3570,12 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
3544
3570
|
}
|
|
3545
3571
|
).then(this.responseParser.parseFeeSimulateTransactionResponse);
|
|
3546
3572
|
}
|
|
3573
|
+
async getStateUpdate(blockIdentifier = this.blockIdentifier) {
|
|
3574
|
+
const args = new Block(blockIdentifier).sequencerIdentifier;
|
|
3575
|
+
return this.fetchEndpoint("get_state_update", { ...args }).then(
|
|
3576
|
+
this.responseParser.parseGetStateUpdateResponse
|
|
3577
|
+
);
|
|
3578
|
+
}
|
|
3547
3579
|
};
|
|
3548
3580
|
|
|
3549
3581
|
// src/provider/default.ts
|
|
@@ -3631,6 +3663,9 @@ var Provider = class {
|
|
|
3631
3663
|
async getSimulateTransaction(invocation, invocationDetails, blockIdentifier) {
|
|
3632
3664
|
return this.provider.getSimulateTransaction(invocation, invocationDetails, blockIdentifier);
|
|
3633
3665
|
}
|
|
3666
|
+
async getStateUpdate(blockIdentifier) {
|
|
3667
|
+
return this.provider.getStateUpdate(blockIdentifier);
|
|
3668
|
+
}
|
|
3634
3669
|
};
|
|
3635
3670
|
|
|
3636
3671
|
// src/provider/interface.ts
|