Skip to content

Commit

Permalink
[SDK] expose rpcBatchingOptions (#2294)
Browse files Browse the repository at this point in the history
  • Loading branch information
joaquim-verges authored Feb 14, 2024
1 parent ed4ad86 commit 3137e45
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/forty-nails-perform.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@thirdweb-dev/sdk": patch
---

Expose rpcBatchSettings in SDKOptions
1 change: 1 addition & 0 deletions packages/sdk/src/evm/constants/urls.ts
Original file line number Diff line number Diff line change
Expand Up @@ -297,6 +297,7 @@ export function getProviderFromRpcUrl(
skipFetchSetup: _skipFetchSetup,
},
chainId,
sdkOptions?.rpcBatchSettings,
)
: // Otherwise fall back to the built in json rpc batch provider
new providers.JsonRpcBatchProvider({
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/evm/lib/static-batch-rpc.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ export class StaticJsonRpcBatchProvider extends providers.StaticJsonRpcProvider
batchOptions: BatchOptions = DEFAULT_BATCH_OPTIONS,
) {
super(url, network);
this._timeLimitMs = batchOptions.timeLimitMs || DEFAULT_BATCH_SIZE_LIMIT;
this._sizeLimit = batchOptions.sizeLimit || DEFAULT_BATCH_TIME_LIMIT_MS;
this._timeLimitMs = batchOptions.timeLimitMs || DEFAULT_BATCH_TIME_LIMIT_MS;
this._sizeLimit = batchOptions.sizeLimit || DEFAULT_BATCH_SIZE_LIMIT;
this._pendingBatchAggregator = null;
this._pendingBatch = null;
}
Expand Down
6 changes: 6 additions & 0 deletions packages/sdk/src/evm/schema/sdk-options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,12 @@ export const SDKOptionsSchema = /* @__PURE__ */ (() =>
])
.optional(),
gatewayUrls: z.array(z.string()).optional(),
rpcBatchSettings: z
.object({
sizeLimit: z.number().default(200),
timeLimit: z.number().default(10),
})
.optional(),
})
.default({
gasSettings: { maxPriceInGwei: 300, speed: "fastest" },
Expand Down

0 comments on commit 3137e45

Please sign in to comment.