Skip to content

Commit

Permalink
Merge branch 'starknet-io:develop' into issue-starknet-io#1014
Browse files Browse the repository at this point in the history
  • Loading branch information
fmmesen authored Oct 7, 2024
2 parents a01a19d + 312aa13 commit 86301f5
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 7 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## [6.14.1](https://github.com/starknet-io/starknet.js/compare/v6.14.0...v6.14.1) (2024-09-30)

### Bug Fixes

- adjust module configuration ([47e52cf](https://github.com/starknet-io/starknet.js/commit/47e52cf39a71bf99188edc4991b002018e296504))

# [6.14.0](https://github.com/starknet-io/starknet.js/compare/v6.13.1...v6.14.0) (2024-09-04)

### Features
Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "starknet",
"version": "6.14.0",
"version": "6.14.1",
"description": "JavaScript library for Starknet",
"license": "MIT",
"repository": {
Expand Down
22 changes: 19 additions & 3 deletions src/channel/rpc_0_6.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,24 @@ export class RpcChannel {

private specVersion?: string;

private transactionRetryIntervalFallback?: number;

readonly waitMode: Boolean; // behave like web2 rpc and return when tx is processed

private batchClient?: BatchClient;

constructor(optionsOrProvider?: RpcProviderOptions) {
const { nodeUrl, retries, headers, blockIdentifier, chainId, specVersion, waitMode, batch } =
optionsOrProvider || {};
const {
nodeUrl,
retries,
headers,
blockIdentifier,
chainId,
specVersion,
waitMode,
transactionRetryIntervalFallback,
batch,
} = optionsOrProvider || {};
if (Object.values(NetworkName).includes(nodeUrl as NetworkName)) {
this.nodeUrl = getDefaultNodeUrl(nodeUrl as NetworkName, optionsOrProvider?.default);
} else if (nodeUrl) {
Expand All @@ -72,6 +83,7 @@ export class RpcChannel {
this.specVersion = specVersion;
this.waitMode = waitMode || false;
this.requestId = 0;
this.transactionRetryIntervalFallback = transactionRetryIntervalFallback;

if (typeof batch === 'number') {
this.batchClient = new BatchClient({
Expand All @@ -82,6 +94,10 @@ export class RpcChannel {
}
}

private get transactionRetryIntervalDefault() {
return this.transactionRetryIntervalFallback ?? 5000;
}

public setChainId(chainId: StarknetChainId) {
this.chainId = chainId;
}
Expand Down Expand Up @@ -267,7 +283,7 @@ export class RpcChannel {
let { retries } = this;
let onchain = false;
let isErrorState = false;
const retryInterval = options?.retryInterval ?? 5000;
const retryInterval = options?.retryInterval ?? this.transactionRetryIntervalDefault;
const errorStates: any = options?.errorStates ?? [
RPC.ETransactionStatus.REJECTED,
// TODO: commented out to preserve the long-standing behavior of "reverted" not being treated as an error by default
Expand Down
2 changes: 1 addition & 1 deletion src/signer/ledgerSigner.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ type _Transport = any;
/**
* Signer for accounts using a Ledger Nano S+/X signature
*/
export class LedgerSigner<Transport extends Record<any, any>> implements SignerInterface {
export class LedgerSigner<Transport extends Record<any, any> = any> implements SignerInterface {
readonly transporter: Transport;

// this is a hack to allow the '@ledgerhq/hw-transport' type to be used as a dev dependency but not exposed in the production build
Expand Down

0 comments on commit 86301f5

Please sign in to comment.