-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #140 from UniqueNetwork/release/v1.0.0
Release/v1.0.0
- Loading branch information
Showing
89 changed files
with
4,245 additions
and
651 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
name: Deploy to Demo VM | ||
|
||
on: | ||
push: | ||
branches: | ||
- demo | ||
workflow_dispatch: | ||
|
||
jobs: | ||
run-gitlab-pipeline: | ||
name: Run gitlab pipeline | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Trigger gitlab | ||
uses: wei/curl@v1 | ||
with: | ||
args: -X POST -F token=${{ secrets.UNIQUE_GITLAB_TOKEN_DEMO }} -F ref=master -F variables[REMOTE_COMMIT]=${GITHUB_SHA} -F variables[DEPLOY_TO]=stage https://gitlab.uniquenetwork.dev/api/v4/projects/57/trigger/pipeline |
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,8 @@ | ||
FROM node:16.14-alpine3.14 | ||
RUN mkdir /app | ||
WORKDIR /app | ||
COPY . /app/ | ||
RUN npm install | ||
RUN npm run build:crawler | ||
|
||
CMD ["node", "-r", "source-map-support/register", "dist/apps/crawler/main.js"] |
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 |
---|---|---|
@@ -1,25 +1,30 @@ | ||
import { Logger } from '@nestjs/common'; | ||
import { ConfigService } from '@nestjs/config'; | ||
import { NestFactory } from '@nestjs/core'; | ||
import { CrawlerModule } from './crawler.module'; | ||
import { CrawlerService } from './crawler.service'; | ||
|
||
async function bootstrap() { | ||
const app = await NestFactory.create(CrawlerModule, { | ||
logger: [ | ||
'log', | ||
'error', | ||
'warn', | ||
'verbose', | ||
// | ||
], | ||
}); | ||
const app = await NestFactory.create(CrawlerModule); | ||
|
||
const configService = app.get(ConfigService); | ||
|
||
const logLevels = configService.get('LOG_LEVELS') | ||
? configService.get('LOG_LEVELS').split(',') | ||
: ['log', 'error', 'warn']; | ||
|
||
Logger.overrideLogger(logLevels); | ||
|
||
try { | ||
const crawlerService = app.get(CrawlerService); | ||
|
||
await crawlerService.subscribe(process.env.SCAN_FORCE_RESCAN === 'true'); | ||
await crawlerService.run(process.env.SCAN_FORCE_RESCAN === 'true'); | ||
} catch (err) { | ||
// eslint-disable-next-line no-console | ||
console.error(err); | ||
} | ||
} | ||
bootstrap(); | ||
|
||
(async function () { | ||
await bootstrap(); | ||
})(); |
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 was deleted.
Oops, something went wrong.
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,11 @@ | ||
import { Sdk } from '@unique-nft/substrate-client'; | ||
|
||
export async function sdkFactory(chainWsUrl: string): Promise<Sdk> { | ||
const sdk = new Sdk({ | ||
chainWsUrl, | ||
}); | ||
|
||
await sdk.connect(); | ||
|
||
return sdk; | ||
} |
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,24 @@ | ||
import { Global, Module } from '@nestjs/common'; | ||
import { ConfigModule, ConfigService } from '@nestjs/config'; | ||
import { sdkFactory } from './factory'; | ||
import { SdkService } from './sdk.service'; | ||
import { Sdk } from '@unique-nft/substrate-client'; | ||
import '@unique-nft/substrate-client/extrinsics'; | ||
import '@unique-nft/substrate-client/tokens'; | ||
import '@unique-nft/substrate-client/balance'; | ||
|
||
@Global() | ||
@Module({ | ||
imports: [ConfigModule], | ||
providers: [ | ||
{ | ||
provide: Sdk, | ||
useFactory: async (configService: ConfigService) => | ||
sdkFactory(configService.get('CHAIN_WS_URL')), | ||
inject: [ConfigService], | ||
}, | ||
SdkService, | ||
], | ||
exports: [SdkService], | ||
}) | ||
export class SdkModule {} |
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,41 @@ | ||
import { Injectable } from '@nestjs/common'; | ||
import { Sdk } from '@unique-nft/substrate-client'; | ||
import { | ||
CollectionInfoWithSchema, | ||
TokenByIdResult, | ||
TokenPropertiesResult, | ||
} from '@unique-nft/substrate-client/tokens'; | ||
|
||
@Injectable() | ||
export class SdkService { | ||
constructor(private sdk: Sdk) {} | ||
|
||
getCollection( | ||
collectionId: number, | ||
): Promise<CollectionInfoWithSchema | null> { | ||
return this.sdk.collections.get_new({ collectionId }); | ||
} | ||
|
||
async getCollectionLimits(collectionId: number) { | ||
const result = await this.sdk.collections.getLimits({ collectionId }); | ||
return result?.limits; | ||
} | ||
|
||
getToken( | ||
collectionId: number, | ||
tokenId: number, | ||
): Promise<TokenByIdResult | null> { | ||
return this.sdk.tokens.get_new({ collectionId, tokenId }); | ||
} | ||
|
||
getTokenProperties( | ||
collectionId: number, | ||
tokenId: number, | ||
): Promise<TokenPropertiesResult | null> { | ||
return this.sdk.tokens.properties({ collectionId, tokenId }); | ||
} | ||
|
||
getBalances(rawAddress: string) { | ||
return this.sdk.balance.get({ address: rawAddress }); | ||
} | ||
} |
Oops, something went wrong.