-
Notifications
You must be signed in to change notification settings - Fork 103
Expand file tree
/
Copy pathschema.prisma
More file actions
304 lines (270 loc) · 13.4 KB
/
schema.prisma
File metadata and controls
304 lines (270 loc) · 13.4 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
datasource db {
url = env("POSTGRES_CONNECTION_URL")
provider = "postgresql"
}
generator client {
provider = "prisma-client-js"
}
model Configuration {
id String @id @default("default") @map("id")
// Chains
chainOverrides String? @map("chainOverrides")
// Tx Processing
minTxsToProcess Int @map("minTxsToProcess")
maxTxsToProcess Int @map("maxTxsToProcess")
// Tx Updates
minedTxListenerCronSchedule String? @map("minedTxsCronSchedule")
maxTxsToUpdate Int @map("maxTxsToUpdate")
// Tx Retries
retryTxListenerCronSchedule String? @map("retryTxsCronSchedule")
minEllapsedBlocksBeforeRetry Int @map("minEllapsedBlocksBeforeRetry")
maxFeePerGasForRetries String @map("maxFeePerGasForRetries")
maxPriorityFeePerGasForRetries String @map("maxPriorityFeePerGasForRetries")
maxRetriesPerTx Int @map("maxRetriesPerTx")
// Contract Indexer Updates
indexerListenerCronSchedule String? @map("indexerListenerCronSchedule")
// cron to track balance of address
addressBalanceListenerCronSchedule String? @map("addressBalanceListenerCronSchedule")
maxBlocksToIndex Int @default(25) @map("maxBlocksToIndex")
cursorDelaySeconds Int @default(2) @map("cursorDelaySeconds")
contractSubscriptionsRetryDelaySeconds String @default("10") @map("contractSubscriptionsRetryDelaySeconds")
// AWS
awsAccessKeyId String? @map("awsAccessKeyId") /// global config, precedence goes to WalletDetails
awsSecretAccessKey String? @map("awsSecretAccessKey") /// global config, precedence goes to WalletDetails
awsRegion String? @map("awsRegion") /// global config, treat as "default", store in WalletDetails.awsKmsArn
// GCP
gcpApplicationProjectId String? @map("gcpApplicationProjectId") /// global config, treat as "default", store in WalletDetails.gcpKmsResourcePath
gcpKmsLocationId String? @map("gcpKmsLocationId") /// global config, treat as "default", store in WalletDetails.gcpKmsResourcePath
gcpKmsKeyRingId String? @map("gcpKmsKeyRingId") /// global config, treat as "default", store in WalletDetails.gcpKmsResourcePath
gcpApplicationCredentialEmail String? @map("gcpApplicationCredentialEmail") /// global config, precedence goes to WalletDetails
gcpApplicationCredentialPrivateKey String? @map("gcpApplicationCredentialPrivateKey") /// global config, precedence goes to WalletDetails
// Auth
authDomain String @default("") @map("authDomain") // TODO: Remove defaults on major
authWalletEncryptedJson String @default("") @map("authWalletEncryptedJson") // TODO: Remove defaults on major
// Webhook
webhookUrl String? @map("webhookUrl")
webhookAuthBearerToken String? @map("webhookAuthBearerToken")
// Wallet balance
minWalletBalance String @default("20000000000000000") @map("minWalletBalance")
accessControlAllowOrigin String @default("https://thirdweb.com,https://embed.ipfscdn.io") @map("accessControlAllowOrigin")
ipAllowlist String[] @default([]) @map("ipAllowlist")
clearCacheCronSchedule String @default("*/30 * * * * *") @map("clearCacheCronSchedule")
@@map("configuration")
}
model Permissions {
walletAddress String @id @map("walletAddress")
permissions String @map("permissions")
label String? @map("label")
@@map("permissions")
}
model Tokens {
id String @id @map("id")
tokenMask String @map("tokenMask")
walletAddress String @map("walletAddress")
createdAt DateTime @default(now()) @map("createdAt")
expiresAt DateTime @map("expiresAt")
revokedAt DateTime? @map("revokedAt")
isAccessToken Boolean @map("isAccessToken")
label String? @map("label")
@@map("tokens")
}
model WalletDetails {
address String @id @map("address")
type String @map("type")
label String? @map("label")
// Local
encryptedJson String? @map("encryptedJson")
// KMS
awsKmsKeyId String? @map("awsKmsKeyId") /// deprecated and unused, todo: remove with next breaking change. Use awsKmsArn
awsKmsArn String? @map("awsKmsArn")
awsKmsSecretAccessKey String? @map("awsKmsSecretAccessKey") /// if not available, default to: Configuration.awsSecretAccessKey
awsKmsAccessKeyId String? @map("awsKmsAccessKeyId") /// if not available, default to: Configuration.awsAccessKeyId
// GCP
gcpKmsKeyRingId String? @map("gcpKmsKeyRingId") @db.VarChar(50) /// deprecated and unused. Use gcpKmsResourcePath instead, todo: remove with next breaking change
gcpKmsKeyId String? @map("gcpKmsKeyId") @db.VarChar(50) /// deprecated and unused. Use gcpKmsResourcePath instead, todo: remove with next breaking change
gcpKmsKeyVersionId String? @map("gcpKmsKeyVersionId") @db.VarChar(20) /// deprecated and unused. Use gcpKmsResourcePath instead, todo: remove with next breaking change
gcpKmsLocationId String? @map("gcpKmsLocationId") @db.VarChar(20) /// deprecated and unused. Use gcpKmsResourcePath instead, todo: remove with next breaking change
gcpKmsResourcePath String? @map("gcpKmsResourcePath") @db.Text
gcpApplicationCredentialEmail String? @map("gcpApplicationCredentialEmail") /// if not available, default to: Configuration.gcpApplicationCredentialEmail
gcpApplicationCredentialPrivateKey String? @map("gcpApplicationCredentialPrivateKey") /// if not available, default to: Configuration.gcpApplicationCredentialPrivateKey
// Smart Backend Wallet
accountSignerAddress String? @map("accountSignerAddress") /// this, and either local, aws or gcp encryptedJson, are required for smart wallet
accountFactoryAddress String? @map("accountFactoryAddress") /// optional even for smart wallet, if not available default factory will be used
entrypointAddress String? @map("entrypointAddress") /// optional even for smart wallet, if not available SDK will use default entrypoint
@@map("wallet_details")
}
model WalletNonce {
address String @map("address")
chainId String @map("chainId")
nonce Int @default(0) @map("nonce")
@@id([address, chainId])
@@map("wallet_nonce")
}
model Transactions {
id String @id @default(uuid()) @map("id")
// Backward compatibility: default to db-generated UUID.
idempotencyKey String @unique @default(dbgenerated("gen_random_uuid()")) @map("idempotencyKey")
groupId String? @map("groupId")
chainId String @map("chainId")
// Shared
data String? @map("data")
value String? @map("value")
gasLimit String? @map("gasLimit")
nonce Int? @map("nonce")
maxFeePerGas String? @map("maxFeePerGas")
maxPriorityFeePerGas String? @map("maxPriorityFeePerGas")
// Transaction Details
fromAddress String? @map("fromAddress")
toAddress String? @map("toAddress")
gasPrice String? @map("gasPrice")
transactionType Int? @map("transactionType")
transactionHash String? @map("transactionHash")
onChainTxStatus Int? @map("onChainTxStatus")
// User Operation
signerAddress String? @map("signerAddress")
accountAddress String? @map("accountAddress")
target String? @map("target")
sender String? @map("sender")
initCode String? @map("initCode")
callData String? @map("callData")
callGasLimit String? @map("callGasLimit")
verificationGasLimit String? @map("verificationGasLimit")
preVerificationGas String? @map("preVerificationGas")
paymasterAndData String? @map("paymasterAndData")
userOpHash String? @map("userOpHash")
// Enriched Data
functionName String? @map("functionName")
functionArgs String? @map("functionArgs")
extension String? @map("extension")
// TODO: These shouldn't be in here...
deployedContractAddress String? @map("deployedContractAddress")
deployedContractType String? @map("deployedContractType")
// Timestamps
queuedAt DateTime @default(now()) @map("queuedAt")
// @deprecated
processedAt DateTime? @map("processedAt")
sentAt DateTime? @map("sentAt")
minedAt DateTime? @map("minedAt")
cancelledAt DateTime? @map("cancelledAt")
// Retries
retryCount Int @default(0) @map("retryCount")
retryGasValues Boolean? @default(false) @map("retryGasValues")
retryMaxPriorityFeePerGas String? @map("retryMaxPriorityFeePerGas")
retryMaxFeePerGas String? @map("retryMaxFeePerGas")
// Error
errorMessage String? @map("errorMessage")
// Block Numbers
sentAtBlockNumber Int? @map("sentAtBlockNumber")
blockNumber Int? @map("blockNumber")
@@index([sentAt, minedAt, cancelledAt, errorMessage, queuedAt])
@@index([sentAt, accountAddress, userOpHash, minedAt, errorMessage, retryCount])
@@index([sentAt, transactionHash, accountAddress, minedAt, errorMessage, nonce])
@@index([queuedAt])
@@map("transactions")
}
model Webhooks {
id Int @id @default(autoincrement()) @map("id")
name String? @map("name")
url String @map("url")
secret String @map("secret")
eventType String @map("evenType")
config Json? @map("config")
createdAt DateTime @default(now()) @map("createdAt")
updatedAt DateTime @updatedAt @map("updatedAt")
revokedAt DateTime? @map("revokedAt")
ContractSubscriptions ContractSubscriptions[]
@@map("webhooks")
}
model Relayers {
id String @id @default(uuid()) @map("id")
name String? @map("name")
chainId String @map("chainId")
backendWalletAddress String @map("backendWalletAddress")
allowedContracts String? @map("allowedContracts")
allowedForwarders String? @map("allowedForwarders")
@@map("relayers")
}
model ContractSubscriptions {
id String @id @default(uuid()) @map("id")
chainId String
contractAddress String
webhookId Int?
processEventLogs Boolean @default(true)
filterEvents String[] @default([]) // empty array = no filter
processTransactionReceipts Boolean @default(true)
filterFunctions String[] @default([]) // empty array = no filter
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
webhook Webhooks? @relation(fields: [webhookId], references: [id], onDelete: SetNull)
// optimize distinct lookups
@@index([chainId])
@@map("contract_subscriptions")
}
model ContractEventLogs {
chainId String
blockNumber Int
contractAddress String
transactionHash String
topic0 String?
topic1 String?
topic2 String?
topic3 String?
data String
eventName String?
decodedLog Json?
timestamp DateTime
transactionIndex Int
logIndex Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@id([transactionHash, logIndex])
@@index([timestamp])
@@index([blockNumber])
@@index([contractAddress])
@@index([topic0])
@@index([topic1])
@@index([topic2])
@@index([topic3])
@@map("contract_event_logs")
}
model ContractTransactionReceipts {
chainId String
blockNumber Int
contractAddress String
contractId String // ${chainId}:${contractAddress}
transactionHash String
blockHash String
timestamp DateTime
data String
functionName String?
to String
from String
value String
transactionIndex Int
gasUsed String
effectiveGasPrice String
status Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@unique([chainId, transactionHash])
@@index([contractId, timestamp])
@@index([contractId, blockNumber])
@@map("contract_transaction_receipts")
}
model ChainIndexers {
chainId String @id
lastIndexedBlock Int
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
@@map("chain_indexers")
}
model Keypairs {
hash String @id
publicKey String
algorithm String
label String?
createdAt DateTime @default(now())
updatedAt DateTime @default(now())
@@map("keypairs")
}