Socket
Socket
Sign inDemoInstall

@flashbots/matchmaker-ts

Package Overview
Dependencies
22
Maintainers
3
Versions
17
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.7.4 to 0.7.5

2

package.json
{
"name": "@flashbots/matchmaker-ts",
"version": "0.7.4",
"version": "0.7.5",
"description": "Matchmaker client library for Flashbots mev-share.",

@@ -5,0 +5,0 @@ "main": "build/index.js",

@@ -182,5 +182,6 @@ # Flashbots Matchmaker

```typescript
const targetBlock = 1 + await provider.getBlockNumber()
const bundleParams: BundleParams = {
inclusion: {
block: TARGET_BLOCK,
block: targetBlock,
},

@@ -191,18 +192,30 @@ body: [

],
validity: {
refund: [
{address: SEARCHER_ADDRESS, percent: 10}
]
}
await matchmaker.sendBundle(bundleParams)
```
Bundles that _only_ contain signed transactions can share hints about the transactions in their bundle by setting the `privacy` parameter:
```typescript
const targetBlock = 1 + await provider.getBlockNumber()
const bundleParams: BundleParams = {
inclusion: {
block: targetBlock,
maxBlock: targetBlock + 5, // allow bundle to land in next 5 blocks
},
body: [
{tx: await wallet.signTransaction(TX1), canRevert: false},
{tx: await wallet.signTransaction(TX2), canRevert: false},
],
privacy: {
hints: {
calldata: false,
logs: false,
txHash: true,
calldata: true,
logs: true,
functionSelector: true,
contractAddress: true,
},
// builders: ["flashbots"]
}
}
await matchmaker.sendBundle(bundleParams)
const backrunResult = await matchmaker.sendBundle(bundleParams)
```

@@ -247,1 +260,55 @@

This example uses the state of `parentBlock`, but overrides the state's `blockNumber` value. Setting more fields in `SimBundleOptions` is useful when testing smart contracts which have specific criteria that must be met, like the block being a certain number, or a specific timestamp having passed.
### `getEventHistoryInfo`
Get information about the event history endpoint for use in [`getEventHistory`](#geteventhistory).
Example:
```typescript
const info = await matchmaker.getEventHistoryInfo()
console.log(info)
```
returns something like this:
```txt
{
count: 56934,
minBlock: 9091377,
maxBlock: 9190024,
minTimestamp: 1685452445,
maxTimestamp: 1686943324,
maxLimit: 500
}
```
### `getEventHistory`
Get historical event stream data.
Using the data from our [`getEventHistoryInfo`](#geteventhistoryinfo) call, we can read events starting from the beginning. The data is paginated, so to read all of it, you'll have to make multiple calls to iterate through the it.
```typescript
const info = await matchmaker.getEventHistoryInfo()
// read every event
for (let i = 0; i < Math.ceil(info.count / info.maxLimit); i++) {
const events = await matchmaker.getEventHistory({
limit: info.maxLimit,
offset: i * info.maxLimit,
blockStart: info.minBlock,
})
console.log(events)
}
```
You can also filter events by timestamp:
```typescript
const events = await matchmaker.getEventHistory({
limit: info.maxLimit,
offset: i * info.maxLimit,
timestampStart: 1686942023,
})
```
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc