Add methods for creating auctions and add auction tests #28

Merged
nabarun merged 32 commits from deep-stack/registry-sdk:iv-create-auction-test into main 2024-09-25 13:21:05 +00:00
7 changed files with 28 additions and 22 deletions
Showing only changes of commit 93c78b4464 - Show all commits

View File

@ -53,7 +53,7 @@ message Auction {
string id = 1;
// Auction's kind (vickrey | service_provider)
// Auction's kind (vickrey | provider)
string kind = 2 [
(gogoproto.moretags) = "json:\"kind\" yaml:\"kind\""
];
@ -101,7 +101,7 @@ message Auction {
(gogoproto.moretags) = "json:\"minimum_bid\" yaml:\"minimum_bid\""
];
// Addresses of the winners (one for vickrey and can be multiple for service_provider)
// Addresses of the winners (one for vickrey auctions and can be multiple for provider auctions)
repeated string winner_addresses = 11;
// Winning bids, i.e., the best bids

View File

@ -77,7 +77,7 @@ message MsgCreateAuction {
string signer = 6
[ (gogoproto.moretags) = "json:\"signer\" yaml:\"signer\"" ];
// Auction's kind (vickrey | service_provider)
// Auction's kind (vickrey | provider)
string kind = 7 [
(gogoproto.moretags) = "json:\"kind\" yaml:\"kind\""
];

View File

@ -71,7 +71,6 @@ const createAuctionTests = () => {
commitFee,
revealFee,
minimumBid,
kind: 'vickrey',
signer: auctionCreatorAccount.address
},
auctionCreatorAccount.privateKey, fee);
@ -174,13 +173,12 @@ const createSPAuctionTests = () => {
amount: '100000000'
};
const auction = await registry.createServiceProviderAuction({
const auction = await registry.createProviderAuction({
commitsDuration,
revealsDuration,
commitFee,
revealFee,
signer: auctionCreatorAccount.address,
kind: 'service_provider',
maxPrice,
numProviders: 3
},

View File

@ -23,6 +23,7 @@ import {
import {
MessageMsgCommitBid,
MessageMsgRevealBid,
MsgCreateProviderAuction,
MsgCreateVickreyAuction
} from './types/cerc/auction/message';
import { MessageMsgSendCoins } from './types/cosmos/bank/message';
@ -508,8 +509,7 @@ export class Registry {
commitFee,
revealFee,
minimumBid,
signer,
kind
signer
}: MsgCreateVickreyAuction,
privateKey: string,
fee: StdFee | number = DEFAULT_GAS_ESTIMATION_MULTIPLIER): Promise<MsgCreateAuctionResponse> {
@ -524,7 +524,7 @@ export class Registry {
revealFee,
minimumBid,
signer,
kind,
'vickrey',
undefined,
0,
fee,
@ -532,16 +532,15 @@ export class Registry {
);
}
async createServiceProviderAuction ({
async createProviderAuction ({
commitsDuration,
revealsDuration,
commitFee,
revealFee,
signer,
kind,
maxPrice,
numProviders
}: MsgCreateAuction,
}: MsgCreateProviderAuction,
privateKey: string,
fee: StdFee | number = DEFAULT_GAS_ESTIMATION_MULTIPLIER): Promise<MsgCreateAuctionResponse> {
const account = new Account(Buffer.from(privateKey, 'hex'));
@ -555,7 +554,7 @@ export class Registry {
revealFee,
undefined,
signer,
kind,
'provider',
maxPrice,
numProviders,
fee,

View File

@ -24,7 +24,7 @@ export interface Params {
/** Auction represents a sealed-bid on-chain auction */
export interface Auction {
id: string;
/** Auction's kind (vickrey | service_provider) */
/** Auction's kind (vickrey | provider) */
kind: string;
status: string;
/** Address of the creator of the auction */
@ -43,7 +43,7 @@ export interface Auction {
revealFee?: Coin;
/** Minimum acceptable bid amount for a valid commit */
minimumBid?: Coin;
/** Addresses of the winners (one for vickrey and can be multiple for service_provider) */
/** Addresses of the winners (one for vickrey auctions and can be multiple for provider auctions) */
winnerAddresses: string[];
/** Winning bids, i.e., the best bids */
winningBids: Coin[];

View File

@ -21,7 +21,7 @@ export interface MsgCreateAuction {
minimumBid?: Coin;
/** Address of the signer */
signer: string;
/** Auction's kind (vickrey | service_provider) */
/** Auction's kind (vickrey | provider) */
kind: string;
/** Maximum acceptable bid amount (for service provider auctions) */
maxPrice?: Coin;

View File

@ -46,11 +46,20 @@ export interface MessageMsgRevealBid {
}
export interface MsgCreateVickreyAuction {
commitsDuration?: Duration;
revealsDuration?: Duration;
commitFee?: Coin;
revealFee?: Coin;
minimumBid?: Coin;
commitsDuration: Duration;
revealsDuration: Duration;
commitFee: Coin;
revealFee: Coin;
minimumBid: Coin;
signer: string;
}
export interface MsgCreateProviderAuction {
commitsDuration: Duration;
revealsDuration: Duration;
commitFee: Coin;
revealFee: Coin;
maxPrice: Coin;
numProviders: number;
signer: string;
kind: string;
}