Skip to content

Commit

Permalink
/send checks create/claim shovel integrations
Browse files Browse the repository at this point in the history
  • Loading branch information
nicky-LV committed Aug 10, 2024
1 parent 75be2e2 commit 82c4e97
Show file tree
Hide file tree
Showing 9 changed files with 766 additions and 0 deletions.
190 changes: 190 additions & 0 deletions packages/shovel/etc/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -766,6 +766,196 @@
"start": "$BASE_BLOCK_START"
}
]
},
{
"name": "send_check_created",
"enabled": true,
"block": [
{
"name": "chain_id",
"column": "chain_id"
},
{
"name": "block_time",
"column": "block_time"
},
{
"name": "tx_hash",
"column": "tx_hash"
},
{
"name": "log_addr",
"column": "log_addr",
"filter_op": "contains",
"filter_arg": [
"0xe1f30594e663400EeA4e51e2B5603204cfE81712"
]
}
],
"event": {
"type": "event",
"anonymous": false,
"inputs": [
{
"name": "token",
"type": "address",
"indexed": false,
"column": "token"
},
{
"name": "amount",
"type": "uint256",
"indexed": false,
"column": "amount"
},
{
"name": "from",
"type": "address",
"indexed": false,
"column": "from"
}
],
"name": "CheckCreated"
},
"table": {
"name": "send_check_created",
"columns": [
{
"name": "chain_id",
"type": "numeric"
},
{
"name": "block_time",
"type": "numeric"
},
{
"name": "tx_hash",
"type": "bytea"
},
{
"name": "log_addr",
"type": "bytea"
},
{
"name": "token",
"type": "bytea"
},
{
"name": "amount",
"type": "numeric"
},
{
"name": "from",
"type": "bytea"
}
]
},
"sources": [
{
"name": "base_logs",
"start": "$BASE_BLOCK_START"
}
]
},
{
"name": "send_check_claimed",
"enabled": true,
"block": [
{
"name": "chain_id",
"column": "chain_id"
},
{
"name": "block_time",
"column": "block_time"
},
{
"name": "tx_hash",
"column": "tx_hash"
},
{
"name": "log_addr",
"column": "log_addr",
"filter_op": "contains",
"filter_arg": [
"0xe1f30594e663400EeA4e51e2B5603204cfE81712"
]
}
],
"event": {
"type": "event",
"anonymous": false,
"inputs": [
{
"name": "token",
"type": "address",
"indexed": false,
"column": "token"
},
{
"name": "amount",
"type": "uint256",
"indexed": false,
"column": "amount"
},
{
"name": "from",
"type": "address",
"indexed": false,
"column": "from"
},
{
"name": "redeemer",
"type": "address",
"indexed": false,
"column": "redeemer"
}
],
"name": "CheckClaimed"
},
"table": {
"name": "send_check_claimed",
"columns": [
{
"name": "chain_id",
"type": "numeric"
},
{
"name": "block_time",
"type": "numeric"
},
{
"name": "tx_hash",
"type": "bytea"
},
{
"name": "log_addr",
"type": "bytea"
},
{
"name": "token",
"type": "bytea"
},
{
"name": "amount",
"type": "numeric"
},
{
"name": "from",
"type": "bytea"
},
{
"name": "redeemer",
"type": "bytea"
}
]
},
"sources": [
{
"name": "base_logs",
"start": "$BASE_BLOCK_START"
}
]
}
]
}
10 changes: 10 additions & 0 deletions packages/shovel/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ import {
sendAccountSigningKeyAdded,
sendAccountSigningKeyRemoved,
sendtagCheckoutReceiptsIntegration,
sendCheckCreatedIntegration,
sendCheckClaimedIntegration,
} from './integrations'

// baseSrcBlockHeaders is to be used for integrations that require block headers
Expand Down Expand Up @@ -66,6 +68,14 @@ export const integrations: Integration[] = [
...sendtagCheckoutReceiptsIntegration,
sources: [{ name: baseSrcLogs.name, start: '$BASE_BLOCK_START' }],
},
{
...sendCheckCreatedIntegration,
sources: [{ name: baseSrcLogs.name, start: '$BASE_BLOCK_START' }],
},
{
...sendCheckClaimedIntegration,
sources: [{ name: baseSrcLogs.name, start: '$BASE_BLOCK_START' }],
},
]

const c = makeConfig({
Expand Down
2 changes: 2 additions & 0 deletions packages/shovel/src/integrations/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ export { integration as sendAccountSigningKeyAdded } from './send-account-signin
export { integration as sendAccountSigningKeyRemoved } from './send-account-signing-key-removed'
export { integration as sendAccountReceivesIntegration } from './send-account-receives'
export { integration as sendtagCheckoutReceiptsIntegration } from './sendtag-checkout-receipts'
export { integration as sendCheckCreatedIntegration } from './send-check-created'
export { integration as sendCheckClaimedIntegration } from './send-check-claimed'
73 changes: 73 additions & 0 deletions packages/shovel/src/integrations/send-check-claimed.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import type { BlockData, Column, Integration, Table } from '@indexsupply/shovel-config'
import { sendCheckAddress } from '@my/wagmi'

export const sendCheckClaimedTable: Table = {
name: 'send_check_claimed',
columns: [
{ name: 'chain_id', type: 'numeric' },
{ name: 'block_time', type: 'numeric' },
{ name: 'tx_hash', type: 'bytea' },
{ name: 'log_addr', type: 'bytea' },
{ name: 'token', type: 'bytea' },
{ name: 'amount', type: 'numeric' },
{ name: 'from', type: 'bytea' },
{ name: 'redeemer', type: 'bytea' },
] as Column[],
} as const

export const integration: Omit<Integration, 'sources'> = {
name: 'send_check_claimed',
enabled: true,
block: [
{
name: 'chain_id',
column: 'chain_id',
},
{
name: 'block_time',
column: 'block_time',
},
{
name: 'tx_hash',
column: 'tx_hash',
},
{
name: 'log_addr',
column: 'log_addr',
filter_op: 'contains',
filter_arg: [...new Set(Object.values(sendCheckAddress))].sort() as `0x${string}`[],
},
] as BlockData[],
event: {
type: 'event',
anonymous: false,
inputs: [
{
name: 'token',
type: 'address',
indexed: false,
column: 'token',
},
{
name: 'amount',
type: 'uint256',
indexed: false,
column: 'amount',
},
{
name: 'from',
type: 'address',
indexed: false,
column: 'from',
},
{
name: 'redeemer',
type: 'address',
indexed: false,
column: 'redeemer',
},
],
name: 'CheckClaimed',
},
table: sendCheckClaimedTable,
} as const
66 changes: 66 additions & 0 deletions packages/shovel/src/integrations/send-check-created.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
import type { BlockData, Column, Integration, Table } from '@indexsupply/shovel-config'
import { sendCheckAddress } from '@my/wagmi'

export const sendCheckCreatedTable: Table = {
name: 'send_check_created',
columns: [
{ name: 'chain_id', type: 'numeric' },
{ name: 'block_time', type: 'numeric' },
{ name: 'tx_hash', type: 'bytea' },
{ name: 'log_addr', type: 'bytea' },
{ name: 'token', type: 'bytea' },
{ name: 'amount', type: 'numeric' },
{ name: 'from', type: 'bytea' },
] as Column[],
} as const

export const integration: Omit<Integration, 'sources'> = {
name: 'send_check_created',
enabled: true,
block: [
{
name: 'chain_id',
column: 'chain_id',
},
{
name: 'block_time',
column: 'block_time',
},
{
name: 'tx_hash',
column: 'tx_hash',
},
{
name: 'log_addr',
column: 'log_addr',
filter_op: 'contains',
filter_arg: [...new Set(Object.values(sendCheckAddress))].sort() as `0x${string}`[],
},
] as BlockData[],
event: {
type: 'event',
anonymous: false,
inputs: [
{
name: 'token',
type: 'address',
indexed: false,
column: 'token',
},
{
name: 'amount',
type: 'uint256',
indexed: false,
column: 'amount',
},
{
name: 'from',
type: 'address',
indexed: false,
column: 'from',
},
],
name: 'CheckCreated',
},
table: sendCheckCreatedTable,
} as const
Loading

0 comments on commit 82c4e97

Please sign in to comment.