Skip to content

Commit

Permalink
refactor: refactor ft and nft names
Browse files Browse the repository at this point in the history
  • Loading branch information
asimm241 committed May 17, 2021
1 parent 7b0e9bd commit 2574a84
Show file tree
Hide file tree
Showing 8 changed files with 9 additions and 12 deletions.
2 changes: 1 addition & 1 deletion docs/api/tokens/fungible-token.schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "fungible-token-metadata",
"title": "FTMetadataResponse",
"title": "FungibleTokenMetadataResponse",
"type": "object",
"required": ["name","description", "image_uri", "image_canonical_uri" ],
"properties": {
Expand Down
2 changes: 1 addition & 1 deletion docs/api/tokens/non-fungible-token.schema.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"$schema": "http://json-schema.org/draft-07/schema",
"$id": "non-fungible-token-metadata",
"title": "NFTMetadataResponse",
"title": "NonFungibleTokenMetadataResponse",
"type": "object",
"required": ["name","description", "image_uri", "image_canonical_uri" ],
"properties": {
Expand Down
4 changes: 2 additions & 2 deletions docs/generated.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1021,7 +1021,7 @@ export interface RosettaNetworkStatusResponse {
peers: RosettaPeers[];
}

export interface FTMetadataResponse {
export interface FungibleTokenMetadataResponse {
/**
* Identifies the asset to which this token represents
*/
Expand All @@ -1040,7 +1040,7 @@ export interface FTMetadataResponse {
image_canonical_uri: string;
}

export interface NFTMetadataResponse {
export interface NonFungibleTokenMetadataResponse {
/**
* Identifies the asset to which this token represents
*/
Expand Down
3 changes: 0 additions & 3 deletions docs/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
<<<<<<< HEAD
export * from './generated';
export * from './socket-io';
=======
/**
This file is generated automatically. **DO NOT MODIFY THIS FILE DIRECTLY**
Updates are made by editing the JSON Schema files in the 'docs/' directory,
Expand Down Expand Up @@ -2890,4 +2888,3 @@ export interface RpcTxUpdateSubscriptionRequest {
params: RpcTxUpdateSubscriptionParams;
}

>>>>>>> f1f6d8f7 (docs: add schema for token metadata)
4 changes: 2 additions & 2 deletions src/api/routes/tokenes/tokens.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { addAsync, RouterWithAsync } from '@awaitjs/express';
import * as express from 'express';
import { DataStore } from '../../../datastore/common';
import { FTMetadataResponse, NFTMetadataResponse } from '@blockstack/stacks-blockchain-api-types';
import { FTMetadataResponse, NFTMetadataResponse } from '@stacks/stacks-blockchain-api-types';

export function createTokenRouter(db: DataStore): RouterWithAsync {
const router = addAsync(express.Router());
Expand All @@ -11,7 +11,7 @@ export function createTokenRouter(db: DataStore): RouterWithAsync {
router.getAsync('/ft/metadata', async (req, res) => {
const { contractId } = req.params;

const metadata = await db.getftMetadata(contractId);
const metadata = await db.getFtMetadata(contractId);
if (!metadata.found) {
res.status(404).json({ error: 'tokens not found' });
return;
Expand Down
2 changes: 1 addition & 1 deletion src/datastore/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -618,7 +618,7 @@ export interface DataStore extends DataStoreEventEmitter {
): Promise<FoundOrNot<AddressTokenOfferingLocked>>;
close(): Promise<void>;

getftMetadata(contractId: string): Promise<FoundOrNot<DbAssetMetadata>>;
getFtMetadata(contractId: string): Promise<FoundOrNot<DbAssetMetadata>>;
getNftMetadata(contractId: string): Promise<FoundOrNot<DbAssetMetadata>>;
}

Expand Down
2 changes: 1 addition & 1 deletion src/datastore/memory-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -611,7 +611,7 @@ export class MemoryDataStore
close() {
return Promise.resolve();
}
getftMetadata(contractId: string): Promise<FoundOrNot<DbAssetMetadata>> {
getFtMetadata(contractId: string): Promise<FoundOrNot<DbAssetMetadata>> {
throw new Error('Method not implemented.');
}
getNftMetadata(contractId: string): Promise<FoundOrNot<DbAssetMetadata>> {
Expand Down
2 changes: 1 addition & 1 deletion src/datastore/postgres-store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4033,7 +4033,7 @@ export class PgDataStore
});
}

getftMetadata(contractId: string): Promise<FoundOrNot<DbAssetMetadata>> {
getFtMetadata(contractId: string): Promise<FoundOrNot<DbAssetMetadata>> {
/**
* extract nft information from db here..
*/
Expand Down

0 comments on commit 2574a84

Please sign in to comment.