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.mjs
CHANGED
|
@@ -2658,6 +2658,9 @@ var Block = class {
|
|
|
2658
2658
|
set identifier(_identifier) {
|
|
2659
2659
|
this.setIdentifier(_identifier);
|
|
2660
2660
|
}
|
|
2661
|
+
get sequencerIdentifier() {
|
|
2662
|
+
return this.hash !== null ? { blockHash: this.hash } : { blockNumber: this.number ?? this.tag };
|
|
2663
|
+
}
|
|
2661
2664
|
};
|
|
2662
2665
|
|
|
2663
2666
|
// src/provider/rpc.ts
|
|
@@ -3093,6 +3096,29 @@ var SequencerAPIResponseParser = class extends ResponseParser {
|
|
|
3093
3096
|
class_hash: res.class_hash
|
|
3094
3097
|
};
|
|
3095
3098
|
}
|
|
3099
|
+
parseGetStateUpdateResponse(res) {
|
|
3100
|
+
const nonces = [].concat(res.state_diff.nonces).map(({ contract_address, nonce }) => {
|
|
3101
|
+
return {
|
|
3102
|
+
contract_address,
|
|
3103
|
+
nonce
|
|
3104
|
+
};
|
|
3105
|
+
});
|
|
3106
|
+
const storage_diffs = [].concat(res.state_diff.storage_diffs).map(({ address, storage_entries }) => {
|
|
3107
|
+
return {
|
|
3108
|
+
address,
|
|
3109
|
+
storage_entries
|
|
3110
|
+
};
|
|
3111
|
+
});
|
|
3112
|
+
return {
|
|
3113
|
+
...res,
|
|
3114
|
+
state_diff: {
|
|
3115
|
+
storage_diffs,
|
|
3116
|
+
declared_contract_hashes: res.state_diff.declared_contract_hashes,
|
|
3117
|
+
deployed_contracts: res.state_diff.deployed_contracts,
|
|
3118
|
+
nonces
|
|
3119
|
+
}
|
|
3120
|
+
};
|
|
3121
|
+
}
|
|
3096
3122
|
};
|
|
3097
3123
|
|
|
3098
3124
|
// src/utils/url.ts
|
|
@@ -3486,6 +3512,12 @@ ${res.tx_failure_reason.error_message}` : res.tx_status;
|
|
|
3486
3512
|
}
|
|
3487
3513
|
).then(this.responseParser.parseFeeSimulateTransactionResponse);
|
|
3488
3514
|
}
|
|
3515
|
+
async getStateUpdate(blockIdentifier = this.blockIdentifier) {
|
|
3516
|
+
const args = new Block(blockIdentifier).sequencerIdentifier;
|
|
3517
|
+
return this.fetchEndpoint("get_state_update", { ...args }).then(
|
|
3518
|
+
this.responseParser.parseGetStateUpdateResponse
|
|
3519
|
+
);
|
|
3520
|
+
}
|
|
3489
3521
|
};
|
|
3490
3522
|
|
|
3491
3523
|
// src/provider/default.ts
|
|
@@ -3573,6 +3605,9 @@ var Provider = class {
|
|
|
3573
3605
|
async getSimulateTransaction(invocation, invocationDetails, blockIdentifier) {
|
|
3574
3606
|
return this.provider.getSimulateTransaction(invocation, invocationDetails, blockIdentifier);
|
|
3575
3607
|
}
|
|
3608
|
+
async getStateUpdate(blockIdentifier) {
|
|
3609
|
+
return this.provider.getStateUpdate(blockIdentifier);
|
|
3610
|
+
}
|
|
3576
3611
|
};
|
|
3577
3612
|
|
|
3578
3613
|
// src/provider/interface.ts
|