Skip to content

Commit 3137e45

Browse files
[SDK] expose rpcBatchingOptions (#2294)
1 parent ed4ad86 commit 3137e45

File tree

4 files changed

+14
-2
lines changed

4 files changed

+14
-2
lines changed

.changeset/forty-nails-perform.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@thirdweb-dev/sdk": patch
3+
---
4+
5+
Expose rpcBatchSettings in SDKOptions

packages/sdk/src/evm/constants/urls.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -297,6 +297,7 @@ export function getProviderFromRpcUrl(
297297
skipFetchSetup: _skipFetchSetup,
298298
},
299299
chainId,
300+
sdkOptions?.rpcBatchSettings,
300301
)
301302
: // Otherwise fall back to the built in json rpc batch provider
302303
new providers.JsonRpcBatchProvider({

packages/sdk/src/evm/lib/static-batch-rpc.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,8 @@ export class StaticJsonRpcBatchProvider extends providers.StaticJsonRpcProvider
3030
batchOptions: BatchOptions = DEFAULT_BATCH_OPTIONS,
3131
) {
3232
super(url, network);
33-
this._timeLimitMs = batchOptions.timeLimitMs || DEFAULT_BATCH_SIZE_LIMIT;
34-
this._sizeLimit = batchOptions.sizeLimit || DEFAULT_BATCH_TIME_LIMIT_MS;
33+
this._timeLimitMs = batchOptions.timeLimitMs || DEFAULT_BATCH_TIME_LIMIT_MS;
34+
this._sizeLimit = batchOptions.sizeLimit || DEFAULT_BATCH_SIZE_LIMIT;
3535
this._pendingBatchAggregator = null;
3636
this._pendingBatch = null;
3737
}

packages/sdk/src/evm/schema/sdk-options.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,12 @@ export const SDKOptionsSchema = /* @__PURE__ */ (() =>
6464
])
6565
.optional(),
6666
gatewayUrls: z.array(z.string()).optional(),
67+
rpcBatchSettings: z
68+
.object({
69+
sizeLimit: z.number().default(200),
70+
timeLimit: z.number().default(10),
71+
})
72+
.optional(),
6773
})
6874
.default({
6975
gasSettings: { maxPriceInGwei: 300, speed: "fastest" },

0 commit comments

Comments
 (0)