-
Notifications
You must be signed in to change notification settings - Fork 111
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: remove old token metadata processor (#1747)
* refactor: remove old processor, start fetching data from contract * refactor: remove old tests * fix: tests and lint * fix: use lru cache * chore: delete old tables * chore: fix comments [skip ci] * fix: env comment block [skip ci] * chore: avoid duplicate RPC lookups * fix: make an incremental migration to drop tables * fix: re-add metadata processing ENV flag --------- Co-authored-by: Matthew Little <[email protected]>
- Loading branch information
Showing
42 changed files
with
444 additions
and
3,121 deletions.
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
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,132 @@ | ||
/* eslint-disable camelcase */ | ||
|
||
exports.shorthands = undefined; | ||
|
||
exports.up = pgm => { | ||
pgm.dropTable('token_metadata_queue'); | ||
pgm.dropTable('nft_metadata'); | ||
pgm.dropTable('ft_metadata'); | ||
}; | ||
|
||
exports.down = pgm => { | ||
pgm.createTable('token_metadata_queue', { | ||
queue_id: { | ||
type: 'serial', | ||
primaryKey: true, | ||
}, | ||
tx_id: { | ||
type: 'bytea', | ||
notNull: true, | ||
}, | ||
contract_id: { | ||
type: 'string', | ||
notNull: true, | ||
}, | ||
contract_abi: { | ||
type: 'string', | ||
notNull: true, | ||
}, | ||
block_height: { | ||
type: 'integer', | ||
notNull: true, | ||
}, | ||
processed: { | ||
type: 'boolean', | ||
notNull: true, | ||
}, | ||
retry_count: { | ||
type: 'integer', | ||
notNull: true, | ||
default: 0, | ||
} | ||
}); | ||
pgm.createIndex('token_metadata_queue', [{ name: 'block_height', sort: 'DESC' }]); | ||
pgm.createTable('nft_metadata', { | ||
id: { | ||
type: 'serial', | ||
primaryKey: true, | ||
}, | ||
name: { | ||
type: 'string', | ||
notNull: true, | ||
}, | ||
token_uri: { | ||
type: 'string', | ||
notNull: true, | ||
}, | ||
description: { | ||
type: 'string', | ||
notNull: true, | ||
}, | ||
image_uri: { | ||
type: 'string', | ||
notNull: true, | ||
}, | ||
image_canonical_uri: { | ||
type: 'string', | ||
notNull: true, | ||
}, | ||
contract_id: { | ||
type: 'string', | ||
notNull: true, | ||
unique: true, | ||
}, | ||
tx_id: { | ||
type: 'bytea', | ||
notNull: true, | ||
}, | ||
sender_address: { | ||
type: 'string', | ||
notNull: true, | ||
} | ||
}); | ||
pgm.createIndex('nft_metadata', 'contract_id', { method: 'hash' }); | ||
pgm.createTable('ft_metadata', { | ||
id: { | ||
type: 'serial', | ||
primaryKey: true, | ||
}, | ||
name: { | ||
type: 'string', | ||
notNull: true, | ||
}, | ||
token_uri: { | ||
type: 'string', | ||
notNull: true, | ||
}, | ||
description: { | ||
type: 'string', | ||
notNull: true, | ||
}, | ||
image_uri: { | ||
type: 'string', | ||
notNull: true, | ||
}, | ||
image_canonical_uri: { | ||
type: 'string', | ||
notNull: true, | ||
}, | ||
contract_id: { | ||
type: 'string', | ||
notNull: true, | ||
unique: true, | ||
}, | ||
symbol: { | ||
type: 'string', | ||
notNull: true, | ||
}, | ||
decimals: { | ||
type: 'integer', | ||
notNull: true, | ||
}, | ||
tx_id: { | ||
type: 'bytea', | ||
notNull: true, | ||
}, | ||
sender_address: { | ||
type: 'string', | ||
notNull: true, | ||
} | ||
}); | ||
pgm.createIndex('ft_metadata', 'contract_id', { method: 'hash' }); | ||
} |
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
Oops, something went wrong.