Use proper types for duration and coin
This commit is contained in:
parent
f100f3fb2d
commit
2299898a7b
@ -2,11 +2,12 @@ import { Arguments } from 'yargs';
|
||||
import assert from 'assert';
|
||||
import Long from 'long';
|
||||
|
||||
import { Registry } from '@cerc-io/registry-sdk';
|
||||
import { AUCTION_KIND_PROVIDER, AUCTION_KIND_VICKREY, Registry } from '@cerc-io/registry-sdk';
|
||||
import { MsgCreateAuctionResponse } from '@cerc-io/registry-sdk/dist/proto/cerc/auction/v1/tx';
|
||||
import { Duration } from '@cerc-io/registry-sdk/dist/proto/google/protobuf/duration';
|
||||
import { coin } from '@cosmjs/amino';
|
||||
|
||||
import { getConfig, getConnectionInfo, getGasAndFees, getGasPrice, txOutput } from '../../../util';
|
||||
import { AUCTION_KIND_VICKREY, AUCTION_KIND_PROVIDER } from '../../../../test/helpers';
|
||||
|
||||
export const command = 'create';
|
||||
|
||||
@ -31,7 +32,7 @@ export const builder = {
|
||||
},
|
||||
'commit-fee': {
|
||||
type: 'number',
|
||||
describe: 'Fee for committing to the auction'
|
||||
describe: 'Fee for committing a bid to the auction'
|
||||
},
|
||||
'reveal-fee': {
|
||||
type: 'number',
|
||||
@ -55,31 +56,19 @@ export const handler = async (argv: Arguments) => {
|
||||
const { config } = argv;
|
||||
|
||||
const kind = argv.kind as string;
|
||||
const commitsDuration = {
|
||||
const commitsDuration = Duration.fromPartial({
|
||||
seconds: Long.fromNumber(argv.commitsDuration as number),
|
||||
nanos: 0
|
||||
};
|
||||
const revealsDuration = {
|
||||
});
|
||||
const revealsDuration = Duration.fromPartial({
|
||||
seconds: Long.fromNumber(argv.revealsDuration as number),
|
||||
nanos: 0
|
||||
};
|
||||
});
|
||||
const denom = argv.denom as string;
|
||||
const commitFee = {
|
||||
denom: denom,
|
||||
amount: argv.commitFee as string
|
||||
};
|
||||
const revealFee = {
|
||||
denom: denom,
|
||||
amount: argv.revealFee as string
|
||||
};
|
||||
const minimumBid = {
|
||||
denom: denom,
|
||||
amount: argv.minimumBid as string
|
||||
};
|
||||
const maxPrice = {
|
||||
denom: denom,
|
||||
amount: argv.maxPrice as string
|
||||
};
|
||||
const commitFee = coin(argv.commitFee as string, denom);
|
||||
const revealFee = coin(argv.revealFee as string, denom);
|
||||
const minimumBid = coin(argv.minimumBid as string, denom);
|
||||
const maxPrice = coin(argv.maxPrice as string, denom);
|
||||
const numProviders = argv.numProviders as number;
|
||||
|
||||
const validKinds = [AUCTION_KIND_VICKREY, AUCTION_KIND_PROVIDER];
|
||||
|
@ -16,9 +16,6 @@ export const AUCTION_FEES = {
|
||||
export const AUCTION_COMMIT_DURATION = 60; // 60s
|
||||
export const AUCTION_REVEAL_DURATION = 60; // 60s
|
||||
|
||||
export const AUCTION_KIND_VICKREY = 'vickrey';
|
||||
export const AUCTION_KIND_PROVIDER = 'provider';
|
||||
|
||||
export function checkResultAndRetrieveOutput (result: SpawnSyncReturns<Buffer>): any {
|
||||
expect(result.status).toBe(0);
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user