Skip to content

Commit

Permalink
Merge branch 'develop' of github.com:near-daos/astro-api-gateway into…
Browse files Browse the repository at this point in the history
… develop
  • Loading branch information
volodymyr-iliashchenko committed Jun 27, 2022
2 parents 474914f + 2e886a6 commit a04af1a
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 9 deletions.
2 changes: 2 additions & 0 deletions .env
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@ NEAR_TOKEN_FACTORY_CONTRACT_NAME=tokenfactory.testnet
NEAR_BRIDGE_TOKEN_FACTORY_CONTRACT_NAME=f.ropsten.testnet
NEAR_TOKEN_API_URL=https://api.stats.ref.finance/api

PAGODA_RPC_API_KEY=

NOTIFI_ENV=Development
NOTIFI_SID=NOTIFI_SID
NOTIFI_SECRET=NOTIFI_SECRET
Expand Down
1 change: 0 additions & 1 deletion apps/draft/src/draft.module.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ import configuration, {
} from '@sputnik-v2/config/draft-config';
import { DraftValidationSchema } from '@sputnik-v2/config/validation';
import { DRAFT_DB_CONNECTION } from '@sputnik-v2/common';
import { ProposalModule } from '@sputnik-v2/proposal';

import { DraftProposalModule } from './draft-proposal/draft-proposal.module';
import { DraftCommentModule } from './draft-comment/draft-comment.module';
Expand Down
7 changes: 5 additions & 2 deletions libs/config/src/near-api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,13 @@ export const nearApiProvider = {
inject: [ConfigService, NEAR_PROVIDER],
useFactory: async (configService: ConfigService, near: Near) => {
const config = configService.get('near');
const { contractName, providerUrl } = config;
const { contractName, providerUrl, providerHeaders } = config;

const account = await near.account(contractName);
const provider = new providers.JsonRpcProvider({ url: providerUrl });
const provider = new providers.JsonRpcProvider({
url: providerUrl,
headers: providerHeaders,
});

return {
near,
Expand Down
7 changes: 6 additions & 1 deletion libs/config/src/near-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ export type NEAR_CONFIG = {
bridgeTokenFactoryContractName: string;
nftWhitelistContracts: string[];
tokenApiUrl: string;
pagodaRpcApiKey: string;
};

export type NearConfig = {
Expand All @@ -35,6 +36,7 @@ export type NearConfig = {
helperUrl?: string;
explorerUrl?: string;
providerUrl?: string;
providerHeaders?: Record<string, string>;
keyPath?: string;
};

Expand All @@ -46,6 +48,7 @@ export const getNearConfig = (nearConfig: NEAR_CONFIG): NearConfig => {
bridgeTokenFactoryContractName,
nftWhitelistContracts,
tokenApiUrl,
pagodaRpcApiKey,
} = nearConfig;

switch (env) {
Expand Down Expand Up @@ -81,7 +84,8 @@ export const getNearConfig = (nearConfig: NEAR_CONFIG): NearConfig => {
walletUrl: 'https://wallet.testnet.near.org',
helperUrl: 'https://helper.testnet.near.org',
explorerUrl: 'https://explorer.testnet.near.org',
providerUrl: 'https://archival-rpc.testnet.near.org',
providerUrl: 'https://rpc.testnet.pagoda.co',
providerHeaders: { 'x-api-key': pagodaRpcApiKey },
};
case 'betanet':
return {
Expand Down Expand Up @@ -156,5 +160,6 @@ export default registerAs('near', () =>
nftWhitelistContracts:
process.env.NEAR_NFT_WHITELIST_CONTRACTS?.split(',') || [],
tokenApiUrl: process.env.NEAR_TOKEN_API_URL,
pagodaRpcApiKey: process.env.PAGODA_RPC_API_KEY,
} as NEAR_CONFIG),
);
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,10 @@ export class SharedProposalTemplateService extends TypeOrmCrudService<SharedProp
`Cloning Shared Proposal Template ${proposalTemplateId} to DAO ${daoId}`,
);

const sharedProposalTemplateDao =
await this.sharedProposalTemplateDaoRepository.save({
proposalTemplateId,
daoId,
});
await this.sharedProposalTemplateDaoRepository.save({
proposalTemplateId,
daoId,
});

const daoCount = await this.sharedProposalTemplateDaoRepository.count({
where: { proposalTemplateId },
Expand Down

0 comments on commit a04af1a

Please sign in to comment.