Skip to content

Commit

Permalink
feat: index sub id (FuelLabs#583)
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigobranas authored and raghukapur9 committed Sep 25, 2024
1 parent b6f8fb9 commit 7faf587
Show file tree
Hide file tree
Showing 8 changed files with 11 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/graphql/database/1.sql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ create table indexer.assets_contracts (
asset_id text not null,
contract_id text not null,
transaction_id text not null,
sub_id text,
name text,
symbol text,
decimals integer,
Expand Down
4 changes: 3 additions & 1 deletion packages/graphql/src/application/uc/IndexAsset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export default class IndexAsset {
assetId,
contractId: receipt.id,
transactionId: transaction.id,
subId: receipt.subId,
name: null,
symbol: null,
decimals: null,
Expand Down Expand Up @@ -50,11 +51,12 @@ export default class IndexAsset {
}
try {
connection.query(
'insert into indexer.assets_contracts (asset_id, contract_id, transaction_id, name, symbol, decimals, error) values ($1, $2, $3, $4, $5, $6, $7) on conflict do nothing',
'insert into indexer.assets_contracts (asset_id, contract_id, transaction_id, sub_id, name, symbol, decimals, error) values ($1, $2, $3, $4, $5, $6, $7, $8) on conflict do nothing',
[
asset.assetId,
asset.contractId,
asset.transactionId,
asset.subId,
asset.name,
asset.symbol,
asset.decimals,
Expand Down
1 change: 1 addition & 0 deletions packages/graphql/src/graphql/generated/mocks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ export const anAsset = (overrides?: Partial<GQLAsset>): { __typename: 'Asset' }
icon: overrides && overrides.hasOwnProperty('icon') ? overrides.icon! : 'explicabo',
name: overrides && overrides.hasOwnProperty('name') ? overrides.name! : 'dolorem',
networks: overrides && overrides.hasOwnProperty('networks') ? overrides.networks! : [anAssetNetworkEthereum()],
subId: overrides && overrides.hasOwnProperty('subId') ? overrides.subId! : 'omnis',
symbol: overrides && overrides.hasOwnProperty('symbol') ? overrides.symbol! : 'quaerat',
verified: overrides && overrides.hasOwnProperty('verified') ? overrides.verified! : false,
};
Expand Down
1 change: 1 addition & 0 deletions packages/graphql/src/graphql/generated/sdk-provider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export type GQLAsset = {
icon?: Maybe<Scalars['String']['output']>;
name?: Maybe<Scalars['String']['output']>;
networks?: Maybe<Array<Maybe<GQLAssetNetwork>>>;
subId?: Maybe<Scalars['String']['output']>;
symbol?: Maybe<Scalars['String']['output']>;
verified?: Maybe<Scalars['Boolean']['output']>;
};
Expand Down
2 changes: 2 additions & 0 deletions packages/graphql/src/graphql/generated/sdk.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export type GQLAsset = {
icon?: Maybe<Scalars['String']['output']>;
name?: Maybe<Scalars['String']['output']>;
networks?: Maybe<Array<Maybe<GQLAssetNetwork>>>;
subId?: Maybe<Scalars['String']['output']>;
symbol?: Maybe<Scalars['String']['output']>;
verified?: Maybe<Scalars['Boolean']['output']>;
};
Expand Down Expand Up @@ -5128,6 +5129,7 @@ export const AssetDocument = gql`
asset(assetId: $assetId) {
assetId
contractId
subId
name
symbol
decimals
Expand Down
1 change: 1 addition & 0 deletions packages/graphql/src/graphql/queries/sdk/asset.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ query asset($assetId: String!){
asset (assetId: $assetId) {
assetId
contractId
subId
name
symbol
decimals
Expand Down
1 change: 1 addition & 0 deletions packages/graphql/src/graphql/schemas/explorer.graphql
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,7 @@ type BlocksDashboardConnection {
type Asset {
assetId: String
contractId: String
subId: String
name: String
symbol: String
decimals: U64
Expand Down
1 change: 1 addition & 0 deletions packages/graphql/src/infra/dao/AssetDAO.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export default class BlockDAO {
return {
assetId: assetData.asset_id,
contractId: assetData.contract_id,
subId: assetData.sub_id,
name: assetData.name,
symbol: assetData.symbol,
decimals: assetData.decimals,
Expand Down

0 comments on commit 7faf587

Please sign in to comment.