-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* fix: hotfix * fix: hotfix * feat: crawl ibc tao * feat: crawl genesis ibc tao * fix: code * fix: code
- Loading branch information
1 parent
5fe2bcd
commit e7fc664
Showing
13 changed files
with
1,029 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
import { Knex } from 'knex'; | ||
|
||
export async function up(knex: Knex): Promise<void> { | ||
await knex.schema.createTable('ibc_client', (table) => { | ||
table.increments(); | ||
table.string('client_id').notNullable().unique(); | ||
table.string('counterparty_chain_id').notNullable(); | ||
table.jsonb('client_state').notNullable(); | ||
table.jsonb('consensus_state').notNullable(); | ||
table.string('client_type').notNullable(); | ||
}); | ||
await knex.schema.createTable('ibc_connection', (table) => { | ||
table.increments(); | ||
table.integer('ibc_client_id').index(); | ||
table.string('connection_id').notNullable().unique(); | ||
table.string('counterparty_client_id').notNullable(); | ||
table.string('counterparty_connection_id').notNullable(); | ||
table.foreign('ibc_client_id').references('ibc_client.id'); | ||
}); | ||
await knex.schema.createTable('ibc_channel', (table) => { | ||
table.increments(); | ||
table.integer('ibc_connection_id').index(); | ||
table.string('channel_id').notNullable().unique(); | ||
table.string('port_id').notNullable().index(); | ||
table.string('counterparty_port_id').notNullable(); | ||
table.string('counterparty_channel_id').notNullable(); | ||
table.string('state').notNullable(); | ||
table.foreign('ibc_connection_id').references('ibc_connection.id'); | ||
}); | ||
} | ||
|
||
export async function down(knex: Knex): Promise<void> { | ||
await knex.schema.dropTableIfExists('ibc_client'); | ||
await knex.schema.dropTableIfExists('ibc_connection'); | ||
await knex.schema.dropTableIfExists('ibc_channel'); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
/* eslint-disable import/no-cycle */ | ||
import { Model } from 'objection'; | ||
import BaseModel from './base'; | ||
import { IbcConnection } from './ibc_connection'; | ||
|
||
export class IbcChannel extends BaseModel { | ||
id!: number; | ||
|
||
ibc_connection_id!: number; | ||
|
||
channel_id!: string; | ||
|
||
port_id!: string; | ||
|
||
counterparty_port_id!: string; | ||
|
||
counterparty_channel_id!: string; | ||
|
||
state!: string; | ||
|
||
static get tableName() { | ||
return 'ibc_channel'; | ||
} | ||
|
||
static get jsonSchema() { | ||
return { | ||
type: 'object', | ||
required: [ | ||
'ibc_connection_id', | ||
'channel_id', | ||
'port_id', | ||
'counterparty_port_id', | ||
'counterparty_channel_id', | ||
'state', | ||
], | ||
properties: { | ||
ibc_connection_id: { type: 'number' }, | ||
channel_id: { type: 'string' }, | ||
port_id: { type: 'string' }, | ||
counterparty_port_id: { type: 'string' }, | ||
counterparty_channel_id: { type: 'string' }, | ||
state: { type: 'string' }, | ||
}, | ||
}; | ||
} | ||
|
||
static get relationMappings() { | ||
return { | ||
ibc_connection: { | ||
relation: Model.BelongsToOneRelation, | ||
modelClass: IbcConnection, | ||
join: { | ||
from: 'ibc_channel.ibc_connection_id', | ||
to: 'ibc_connection.id', | ||
}, | ||
}, | ||
}; | ||
} | ||
|
||
static STATUS = { | ||
OPEN: 'OPEN', | ||
CLOSE: 'CLOSE', | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* eslint-disable import/no-cycle */ | ||
import BaseModel from './base'; | ||
|
||
export class IbcClient extends BaseModel { | ||
id!: number; | ||
|
||
client_id!: string; | ||
|
||
counterparty_chain_id!: string; | ||
|
||
client_state!: any; | ||
|
||
consensus_state!: any; | ||
|
||
client_type!: string; | ||
|
||
static get tableName() { | ||
return 'ibc_client'; | ||
} | ||
|
||
static get jsonSchema() { | ||
return { | ||
type: 'object', | ||
required: [ | ||
'client_id', | ||
'counterparty_chain_id', | ||
'client_state', | ||
'consensus_state', | ||
'client_type', | ||
], | ||
properties: { | ||
client_id: { type: 'string' }, | ||
counterparty_chain_id: { type: 'string' }, | ||
client_state: { type: 'object' }, | ||
consensus_state: { type: 'object' }, | ||
client_type: { type: 'string' }, | ||
}, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
/* eslint-disable import/no-cycle */ | ||
import { Model } from 'objection'; | ||
import BaseModel from './base'; | ||
import { IbcClient } from './ibc_client'; | ||
|
||
export class IbcConnection extends BaseModel { | ||
id!: number; | ||
|
||
ibc_client_id!: number; | ||
|
||
connection_id!: string; | ||
|
||
counterparty_client_id!: string; | ||
|
||
counterparty_connection_id!: string; | ||
|
||
static get tableName() { | ||
return 'ibc_connection'; | ||
} | ||
|
||
static get jsonSchema() { | ||
return { | ||
type: 'object', | ||
required: [ | ||
'ibc_client_id', | ||
'connection_id', | ||
'counterparty_client_id', | ||
'counterparty_connection_id', | ||
], | ||
properties: { | ||
ibc_client_id: { type: 'number' }, | ||
connection_id: { type: 'string' }, | ||
counterparty_client_id: { type: 'string' }, | ||
counterparty_connection_id: { type: 'string' }, | ||
}, | ||
}; | ||
} | ||
|
||
static get relationMappings() { | ||
return { | ||
ibc_client: { | ||
relation: Model.BelongsToOneRelation, | ||
modelClass: IbcClient, | ||
join: { | ||
from: 'ibc_connection.ibc_client_id', | ||
to: 'ibc_client.id', | ||
}, | ||
}, | ||
}; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.