Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
import * as t from "io-ts";
import { strictInterfaceWithOptionals } from "../../utils/types";
// required attributes
const ExtendedProfileR = t.interface({});
// optional attributes
const ExtendedProfileO = t.partial({
email: EmailAddress,
preferred_languages: PreferredLanguages,
is_inbox_enabled: IsInboxEnabled,
version: t.number
});
export const ExtendedProfile = strictInterfaceWithOptionals(
ExtendedProfileR.props,
ExtendedProfileO.props,
"ExtendedProfile"
);
export type ExtendedProfile = t.TypeOf;
import { decorators as d, IPluginOptions, logger } from "knub";
import { trimPluginDescription, ZeppelinPlugin } from "./ZeppelinPlugin";
import { Member, Channel, GuildChannel, PermissionOverwrite, Permission, Message, TextChannel } from "eris";
import * as t from "io-ts";
import { tNullable } from "../utils";
// Permissions using these numbers: https://abal.moe/Eris/docs/reference (add all allowed/denied ones up)
const CompanionChannelOpts = t.type({
voice_channel_ids: t.array(t.string),
text_channel_ids: t.array(t.string),
permissions: t.number,
enabled: tNullable(t.boolean),
});
type TCompanionChannelOpts = t.TypeOf;
const ConfigSchema = t.type({
entries: t.record(t.string, CompanionChannelOpts),
});
type TConfigSchema = t.TypeOf;
interface ICompanionChannelMap {
[channelId: string]: TCompanionChannelOpts;
}
const defaultCompanionChannelOpts: Partial = {
enabled: true,
};
it('name', () => {
const T = nonEmptyArray(t.number, 'T')
assert.strictEqual(T.name, 'T')
})
it('encode', () => {
const T1 = optionFromJSON(t.number)
assert.deepStrictEqual(T1.encode(none), toJSON(none))
assert.deepStrictEqual(T1.encode(some(1)), toJSON(some(1)))
const T2 = optionFromJSON(NumberFromString)
assert.deepStrictEqual(T2.encode(none), toJSON(none))
assert.deepStrictEqual(T2.encode(some(1)), toJSON(some('1')))
const T3 = optionFromJSON(optionFromJSON(t.number))
assert.deepStrictEqual(T3.encode(none), { _tag: 'None' })
assert.deepStrictEqual(T3.encode(some(some(1))), { _tag: 'Some', value: { _tag: 'Some', value: 1 } })
assert.deepStrictEqual(T3.encode(some(none)), { _tag: 'Some', value: { _tag: 'None' } })
})
})
modified?: Units_.Time;
} & {
identityId: Defined;
phone: Defined;
favoriteLocations: Defined;
balance: Defined;
paymentMethod: Defined;
subscriptionInstance: Defined;
balances: Defined;
},
ProfileBrand
>;
export const Profile = t.brand(
t.intersection([
t.partial({
id: t.number,
identityId: Units_.IdentityId,
phone: Common_.Phone,
email: Common_.Email,
firstName: Common_.PersonalName,
lastName: Common_.PersonalName,
city: Address_.City,
country: Address_.Country,
zipCode: Address_.ZipCode,
regionId: t.string,
region: Region_.Region,
profileImageUrl: t.string,
favoriteLocations: t.array(Place_.Place),
paymentMethod: t.intersection([
t.partial({
type: t.intersection([
t.string,
import { CommitsState } from '../reducers';
import { RootAction } from '../RootAction';
import { GlobalsState } from '../globals';
import { foldResponse } from '../api';
type AuthorServices = {
ajax$: typeof ajax$;
};
type AuthorDeltaState = {
commits: CommitsState;
globals: GlobalsState;
};
const apiAuthor = t.type({
id: t.number,
name: t.string,
url: t.string,
description: t.string,
link: t.string,
slug: t.string,
avatar_urls: t.dictionary(t.string, t.string),
});
export interface ApiAuthor extends t.TypeOf {}
export const authorDelta = ({ ajax$ }: AuthorServices) => (
actions$: Stream,
state$: Property,
): Observable =>
state$
.sampledBy(actions$.thru(ofType(commitsFetchSucceeded)))
amountStaked: BigNumberType;
}
export interface PlatformActivityResult {
activeUsers: BigNumber;
numberOfTrades: BigNumber;
openInterest: BigNumber;
marketsCreated: BigNumber;
volume: BigNumber;
amountStaked: BigNumber;
disputedMarkets: BigNumber;
}
export const PlatformActivityStatsParams = t.type({
universe: t.string,
endTime: t.union([t.number, t.null]),
startTime: t.union([t.number, t.null]),
});
export type PlatformActivityStatsParamsType = t.TypeOf;
async function getVolume(db: Knex, startBlock: number, endBlock: number, params: PlatformActivityStatsParamsType): Promise {
return db
.select("volume")
.from("markets")
.where("universe", params.universe)
.whereBetween("creationBlockNumber", [startBlock, endBlock]);
}
async function getAmountStaked(db: Knex, startBlock: number, endBlock: number, params: PlatformActivityStatsParamsType): Promise {
return db
.select(["disputes.amountStaked"])
.from("disputes")
asks: t.array(Order),
});
export const OrderBook = t.dictionary(
t.string,
OutcomeOrderBook,
);
export const GetMarketLiquidityRankingParams = t.type({
orderBook: OrderBook,
numTicks: t.string,
marketType: t.number,
reportingFeeDivisor: t.string,
feePerCashInAttoCash: t.string,
numOutcomes: t.number,
spread: t.number,
});
export interface MarketLiquidityRanking {
marketRank: number;
totalMarkets: number;
hasLiquidity: boolean;
}
export class Liquidity {
static getMarketLiquidityRankingParams = GetMarketLiquidityRankingParams;
@Getter('getMarketLiquidityRankingParams')
static async getMarketLiquidityRanking(augur: Augur, db: DB, params: t.TypeOf): Promise {
const liquidityScore = await augur.liquidity.getLiquidityForSpread({
orderBook: params.orderBook,
>;
export const Request = t.brand(
t.union([
t.intersection([
t.partial({
location: UnitsGeo_.ShortLocationString,
radius: UnitsGeo_.Distance,
}),
t.type({
location: Defined,
}),
]),
t.intersection([
t.partial({
name: t.string,
count: t.number,
type: t.union([
t.literal('origin'),
t.literal('destination'),
t.literal('viaAvoid'),
]),
}),
t.type({
name: Defined,
type: Defined,
}),
]),
]),
(
x,
): x is t.Branded<
| ({
export const logEntriesSummaryHighlightsBucketRT = rt.intersection([
logEntriesSummaryBucketRT,
rt.type({
representativeKey: logEntriesCursorRT,
}),
]);
export type LogEntriesSummaryHighlightsBucket = rt.TypeOf<
typeof logEntriesSummaryHighlightsBucketRT
>;
export const logEntriesSummaryHighlightsResponseRT = rt.type({
data: rt.array(
rt.type({
start: rt.number,
end: rt.number,
buckets: rt.array(logEntriesSummaryHighlightsBucketRT),
})
),
});
export type LogEntriesSummaryHighlightsResponse = rt.TypeOf<
typeof logEntriesSummaryHighlightsResponseRT
>;