forked from humanprotocol/human-protocol
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Changes logic of calling exchange oracle: url is obtained based on th…
…e address provided in the enpoint. Adds CORS
- Loading branch information
1 parent
030ef6d
commit 413a3e5
Showing
27 changed files
with
514 additions
and
123 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
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
19 changes: 19 additions & 0 deletions
19
packages/apps/human-app/server/src/integrations/kv-store/kv-store-gateway.service.ts
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,19 @@ | ||
import { Injectable, OnModuleInit } from '@nestjs/common'; | ||
import { EnvironmentConfigService } from '../../common/config/environment-config.service'; | ||
import { ethers } from 'ethers'; | ||
import { KVStoreClient } from '@human-protocol/sdk'; | ||
|
||
@Injectable() | ||
export class KvStoreGateway { | ||
private URL_KEY = 'url'; | ||
private kvStoreClient: KVStoreClient; | ||
constructor(private environmentConfig: EnvironmentConfigService) {} | ||
async onModuleInit(): Promise<void> { | ||
this.kvStoreClient = await KVStoreClient.build( | ||
new ethers.JsonRpcProvider(this.environmentConfig.rpcUrl), | ||
); | ||
} | ||
async getExchangeOracleUrlByAddress(address: string): Promise<string> { | ||
return this.kvStoreClient.get(address, this.URL_KEY); | ||
} | ||
} |
8 changes: 8 additions & 0 deletions
8
packages/apps/human-app/server/src/integrations/kv-store/kv-store.module.ts
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 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { KvStoreGateway } from './kv-store-gateway.service'; | ||
|
||
@Module({ | ||
providers: [KvStoreGateway], | ||
exports: [KvStoreGateway], | ||
}) | ||
export class KvStoreModule {} |
Oops, something went wrong.