Skip to content

Commit

Permalink
intent aggregrator fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
d4mr committed Dec 7, 2024
1 parent 56dda77 commit 194f761
Show file tree
Hide file tree
Showing 10 changed files with 548 additions and 92 deletions.
8 changes: 4 additions & 4 deletions packages/intent-aggregator/drizzle.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,9 @@ const getCredentials = () => {
const prod = {
driver: "d1-http",
dbCredentials: {
databaseId: process.env.CLOUDFLARE_D1_ID,
databaseId: process.env.CLOUDFLARE_DATABASE_ID,
accountId: process.env.CLOUDFLARE_ACCOUNT_ID,
token: process.env.CLOUDFLARE_API_TOKEN,
token: process.env.CLOUDFLARE_D1_TOKEN,
},
};

Expand All @@ -43,8 +43,8 @@ const getCredentials = () => {

export default defineConfig({
dialect: "sqlite",
schema: "./db/schema/index.ts",
out: "./db/migrations",
schema: "./src/db/schema/index.ts",
out: "./migrations",
tablesFilter: ["/^(?!.*_cf_KV).*$/"],
...getCredentials(),
}) satisfies Config;
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
ALTER TABLE `solutions` ADD `settlement_tx_hash` text;--> statement-breakpoint
ALTER TABLE `solutions` ADD `resolution_tx_hash` text;
246 changes: 246 additions & 0 deletions packages/intent-aggregator/migrations/meta/0001_snapshot.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,246 @@
{
"version": "6",
"dialect": "sqlite",
"id": "f3fbab36-02e8-413c-8991-deca90e9a2c0",
"prevId": "39865177-9e6c-482b-935b-9e4fd1bdc31f",
"tables": {
"intents": {
"name": "intents",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"payment_token": {
"name": "payment_token",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"payment_token_amount": {
"name": "payment_token_amount",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"rail_type": {
"name": "rail_type",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"recipient_address": {
"name": "recipient_address",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"rail_amount": {
"name": "rail_amount",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"creator_address": {
"name": "creator_address",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"chain_id": {
"name": "chain_id",
"type": "integer",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "CURRENT_TIMESTAMP"
},
"state": {
"name": "state",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "'CREATED'"
},
"winning_solution_id": {
"name": "winning_solution_id",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"resolution_tx_hash": {
"name": "resolution_tx_hash",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
}
},
"indexes": {
"creator_idx": {
"name": "creator_idx",
"columns": [
"creator_address"
],
"isUnique": false
},
"state_idx": {
"name": "state_idx",
"columns": [
"state"
],
"isUnique": false
},
"rail_idx": {
"name": "rail_idx",
"columns": [
"rail_type"
],
"isUnique": false
}
},
"foreignKeys": {},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
},
"solutions": {
"name": "solutions",
"columns": {
"id": {
"name": "id",
"type": "text",
"primaryKey": true,
"notNull": true,
"autoincrement": false
},
"intent_id": {
"name": "intent_id",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"solver_address": {
"name": "solver_address",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"amount_wei": {
"name": "amount_wei",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"signature": {
"name": "signature",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false
},
"created_at": {
"name": "created_at",
"type": "text",
"primaryKey": false,
"notNull": true,
"autoincrement": false,
"default": "CURRENT_TIMESTAMP"
},
"commitment_tx_hash": {
"name": "commitment_tx_hash",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"settlement_tx_hash": {
"name": "settlement_tx_hash",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"resolution_tx_hash": {
"name": "resolution_tx_hash",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
},
"payment_metadata": {
"name": "payment_metadata",
"type": "text",
"primaryKey": false,
"notNull": false,
"autoincrement": false
}
},
"indexes": {
"intent_solutions_idx": {
"name": "intent_solutions_idx",
"columns": [
"intent_id"
],
"isUnique": false
},
"solver_idx": {
"name": "solver_idx",
"columns": [
"solver_address"
],
"isUnique": false
}
},
"foreignKeys": {
"solutions_intent_id_intents_id_fk": {
"name": "solutions_intent_id_intents_id_fk",
"tableFrom": "solutions",
"tableTo": "intents",
"columnsFrom": [
"intent_id"
],
"columnsTo": [
"id"
],
"onDelete": "no action",
"onUpdate": "no action"
}
},
"compositePrimaryKeys": {},
"uniqueConstraints": {},
"checkConstraints": {}
}
},
"views": {},
"enums": {},
"_meta": {
"schemas": {},
"tables": {},
"columns": {}
},
"internal": {
"indexes": {}
}
}
7 changes: 7 additions & 0 deletions packages/intent-aggregator/migrations/meta/_journal.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
"when": 1733522405248,
"tag": "0000_small_paibok",
"breakpoints": true
},
{
"idx": 1,
"version": "6",
"when": 1733551783982,
"tag": "0001_dazzling_deathstrike",
"breakpoints": true
}
]
}
5 changes: 3 additions & 2 deletions packages/intent-aggregator/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,12 @@
"scripts": {
"dev": "wrangler dev",
"deploy": "wrangler deploy --minify",
"db:generate": "drizzle-kit generate",
"db:generate": "NODE_ENV=production drizzle-kit generate",
"db:up": "drizzle-kit up",
"db:up:prod": "NODE_ENV=production drizzle-kit up",
"db:push": "drizzle-kit push",
"db:push:prod": "NODE_ENV=production drizzle-kit push"
"db:push:prod": "NODE_ENV=production drizzle-kit push",
"db:studio:prod": "NODE_ENV=production drizzle-kit studio"
},
"dependencies": {
"@hono/zod-openapi": "^0.18.3",
Expand Down
Loading

0 comments on commit 194f761

Please sign in to comment.