Skip to content

Commit

Permalink
Add Filled Order Uid to Market Order Response
Browse files Browse the repository at this point in the history
  • Loading branch information
Charles Dusek committed Jun 9, 2024
1 parent aa6ed45 commit 5d288ca
Show file tree
Hide file tree
Showing 8 changed files with 80 additions and 102 deletions.
2 changes: 2 additions & 0 deletions docs/static/openapi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50171,6 +50171,8 @@ definitions:
pendulumlabs.market.market.MsgMarketOrderResponse:
type: object
properties:
uid:
type: string
amountBid:
type: string
amountAsk:
Expand Down
7 changes: 4 additions & 3 deletions proto/market/tx.proto
Original file line number Diff line number Diff line change
Expand Up @@ -76,9 +76,10 @@ message MsgMarketOrder {
}

message MsgMarketOrderResponse {
string amountBid = 1;
string amountAsk = 2;
string slippage = 3;
string uid = 1;
string amountBid = 2;
string amountAsk = 3;
string slippage = 4;
}

// this line is used by starport scaffolding # proto/tx/message
Original file line number Diff line number Diff line change
Expand Up @@ -915,78 +915,78 @@ export default {
},


async sendMsgCreatePool({ rootGetters }, { value, fee = [], memo = '' }) {
async sendMsgMarketOrder({ rootGetters }, { value, fee = [], memo = '' }) {
try {
const txClient=await initTxClient(rootGetters)
const msg = await txClient.msgCreatePool(value)
const msg = await txClient.msgMarketOrder(value)
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
gas: "200000" }, memo})
return result
} catch (e) {
if (e == MissingWalletError) {
throw new Error('TxClient:MsgCreatePool:Init Could not initialize signing client. Wallet is required.')
throw new Error('TxClient:MsgMarketOrder:Init Could not initialize signing client. Wallet is required.')
}else{
throw new Error('TxClient:MsgCreatePool:Send Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:MsgMarketOrder:Send Could not broadcast Tx: '+ e.message)
}
}
},
async sendMsgCancelOrder({ rootGetters }, { value, fee = [], memo = '' }) {
async sendMsgCreatePool({ rootGetters }, { value, fee = [], memo = '' }) {
try {
const txClient=await initTxClient(rootGetters)
const msg = await txClient.msgCancelOrder(value)
const msg = await txClient.msgCreatePool(value)
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
gas: "200000" }, memo})
return result
} catch (e) {
if (e == MissingWalletError) {
throw new Error('TxClient:MsgCancelOrder:Init Could not initialize signing client. Wallet is required.')
throw new Error('TxClient:MsgCreatePool:Init Could not initialize signing client. Wallet is required.')
}else{
throw new Error('TxClient:MsgCancelOrder:Send Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:MsgCreatePool:Send Could not broadcast Tx: '+ e.message)
}
}
},
async sendMsgCreateDrop({ rootGetters }, { value, fee = [], memo = '' }) {
async sendMsgRedeemDrop({ rootGetters }, { value, fee = [], memo = '' }) {
try {
const txClient=await initTxClient(rootGetters)
const msg = await txClient.msgCreateDrop(value)
const msg = await txClient.msgRedeemDrop(value)
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
gas: "200000" }, memo})
return result
} catch (e) {
if (e == MissingWalletError) {
throw new Error('TxClient:MsgCreateDrop:Init Could not initialize signing client. Wallet is required.')
throw new Error('TxClient:MsgRedeemDrop:Init Could not initialize signing client. Wallet is required.')
}else{
throw new Error('TxClient:MsgCreateDrop:Send Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:MsgRedeemDrop:Send Could not broadcast Tx: '+ e.message)
}
}
},
async sendMsgRedeemDrop({ rootGetters }, { value, fee = [], memo = '' }) {
async sendMsgCancelOrder({ rootGetters }, { value, fee = [], memo = '' }) {
try {
const txClient=await initTxClient(rootGetters)
const msg = await txClient.msgRedeemDrop(value)
const msg = await txClient.msgCancelOrder(value)
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
gas: "200000" }, memo})
return result
} catch (e) {
if (e == MissingWalletError) {
throw new Error('TxClient:MsgRedeemDrop:Init Could not initialize signing client. Wallet is required.')
throw new Error('TxClient:MsgCancelOrder:Init Could not initialize signing client. Wallet is required.')
}else{
throw new Error('TxClient:MsgRedeemDrop:Send Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:MsgCancelOrder:Send Could not broadcast Tx: '+ e.message)
}
}
},
async sendMsgMarketOrder({ rootGetters }, { value, fee = [], memo = '' }) {
async sendMsgCreateDrop({ rootGetters }, { value, fee = [], memo = '' }) {
try {
const txClient=await initTxClient(rootGetters)
const msg = await txClient.msgMarketOrder(value)
const msg = await txClient.msgCreateDrop(value)
const result = await txClient.signAndBroadcast([msg], {fee: { amount: fee,
gas: "200000" }, memo})
return result
} catch (e) {
if (e == MissingWalletError) {
throw new Error('TxClient:MsgMarketOrder:Init Could not initialize signing client. Wallet is required.')
throw new Error('TxClient:MsgCreateDrop:Init Could not initialize signing client. Wallet is required.')
}else{
throw new Error('TxClient:MsgMarketOrder:Send Could not broadcast Tx: '+ e.message)
throw new Error('TxClient:MsgCreateDrop:Send Could not broadcast Tx: '+ e.message)
}
}
},
Expand All @@ -1006,68 +1006,68 @@ export default {
}
},

async MsgCreatePool({ rootGetters }, { value }) {
async MsgMarketOrder({ rootGetters }, { value }) {
try {
const txClient=await initTxClient(rootGetters)
const msg = await txClient.msgCreatePool(value)
const msg = await txClient.msgMarketOrder(value)
return msg
} catch (e) {
if (e == MissingWalletError) {
throw new Error('TxClient:MsgCreatePool:Init Could not initialize signing client. Wallet is required.')
throw new Error('TxClient:MsgMarketOrder:Init Could not initialize signing client. Wallet is required.')
} else{
throw new Error('TxClient:MsgCreatePool:Create Could not create message: ' + e.message)
throw new Error('TxClient:MsgMarketOrder:Create Could not create message: ' + e.message)
}
}
},
async MsgCancelOrder({ rootGetters }, { value }) {
async MsgCreatePool({ rootGetters }, { value }) {
try {
const txClient=await initTxClient(rootGetters)
const msg = await txClient.msgCancelOrder(value)
const msg = await txClient.msgCreatePool(value)
return msg
} catch (e) {
if (e == MissingWalletError) {
throw new Error('TxClient:MsgCancelOrder:Init Could not initialize signing client. Wallet is required.')
throw new Error('TxClient:MsgCreatePool:Init Could not initialize signing client. Wallet is required.')
} else{
throw new Error('TxClient:MsgCancelOrder:Create Could not create message: ' + e.message)
throw new Error('TxClient:MsgCreatePool:Create Could not create message: ' + e.message)
}
}
},
async MsgCreateDrop({ rootGetters }, { value }) {
async MsgRedeemDrop({ rootGetters }, { value }) {
try {
const txClient=await initTxClient(rootGetters)
const msg = await txClient.msgCreateDrop(value)
const msg = await txClient.msgRedeemDrop(value)
return msg
} catch (e) {
if (e == MissingWalletError) {
throw new Error('TxClient:MsgCreateDrop:Init Could not initialize signing client. Wallet is required.')
throw new Error('TxClient:MsgRedeemDrop:Init Could not initialize signing client. Wallet is required.')
} else{
throw new Error('TxClient:MsgCreateDrop:Create Could not create message: ' + e.message)
throw new Error('TxClient:MsgRedeemDrop:Create Could not create message: ' + e.message)
}
}
},
async MsgRedeemDrop({ rootGetters }, { value }) {
async MsgCancelOrder({ rootGetters }, { value }) {
try {
const txClient=await initTxClient(rootGetters)
const msg = await txClient.msgRedeemDrop(value)
const msg = await txClient.msgCancelOrder(value)
return msg
} catch (e) {
if (e == MissingWalletError) {
throw new Error('TxClient:MsgRedeemDrop:Init Could not initialize signing client. Wallet is required.')
throw new Error('TxClient:MsgCancelOrder:Init Could not initialize signing client. Wallet is required.')
} else{
throw new Error('TxClient:MsgRedeemDrop:Create Could not create message: ' + e.message)
throw new Error('TxClient:MsgCancelOrder:Create Could not create message: ' + e.message)
}
}
},
async MsgMarketOrder({ rootGetters }, { value }) {
async MsgCreateDrop({ rootGetters }, { value }) {
try {
const txClient=await initTxClient(rootGetters)
const msg = await txClient.msgMarketOrder(value)
const msg = await txClient.msgCreateDrop(value)
return msg
} catch (e) {
if (e == MissingWalletError) {
throw new Error('TxClient:MsgMarketOrder:Init Could not initialize signing client. Wallet is required.')
throw new Error('TxClient:MsgCreateDrop:Init Could not initialize signing client. Wallet is required.')
} else{
throw new Error('TxClient:MsgMarketOrder:Create Could not create message: ' + e.message)
throw new Error('TxClient:MsgCreateDrop:Create Could not create message: ' + e.message)
}
}
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,20 +4,20 @@ import { StdFee } from "@cosmjs/launchpad";
import { SigningStargateClient } from "@cosmjs/stargate";
import { Registry, OfflineSigner, EncodeObject, DirectSecp256k1HdWallet } from "@cosmjs/proto-signing";
import { Api } from "./rest";
import { MsgMarketOrder } from "./types/market/tx";
import { MsgCreatePool } from "./types/market/tx";
import { MsgRedeemDrop } from "./types/market/tx";
import { MsgCancelOrder } from "./types/market/tx";
import { MsgCreateDrop } from "./types/market/tx";
import { MsgRedeemDrop } from "./types/market/tx";
import { MsgMarketOrder } from "./types/market/tx";
import { MsgCreateOrder } from "./types/market/tx";


const types = [
["/pendulumlabs.market.market.MsgMarketOrder", MsgMarketOrder],
["/pendulumlabs.market.market.MsgCreatePool", MsgCreatePool],
["/pendulumlabs.market.market.MsgRedeemDrop", MsgRedeemDrop],
["/pendulumlabs.market.market.MsgCancelOrder", MsgCancelOrder],
["/pendulumlabs.market.market.MsgCreateDrop", MsgCreateDrop],
["/pendulumlabs.market.market.MsgRedeemDrop", MsgRedeemDrop],
["/pendulumlabs.market.market.MsgMarketOrder", MsgMarketOrder],
["/pendulumlabs.market.market.MsgCreateOrder", MsgCreateOrder],

];
Expand Down Expand Up @@ -51,11 +51,11 @@ const txClient = async (wallet: OfflineSigner, { addr: addr }: TxClientOptions =

return {
signAndBroadcast: (msgs: EncodeObject[], { fee, memo }: SignAndBroadcastOptions = {fee: defaultFee, memo: ""}) => client.signAndBroadcast(address, msgs, fee,memo),
msgMarketOrder: (data: MsgMarketOrder): EncodeObject => ({ typeUrl: "/pendulumlabs.market.market.MsgMarketOrder", value: MsgMarketOrder.fromPartial( data ) }),
msgCreatePool: (data: MsgCreatePool): EncodeObject => ({ typeUrl: "/pendulumlabs.market.market.MsgCreatePool", value: MsgCreatePool.fromPartial( data ) }),
msgRedeemDrop: (data: MsgRedeemDrop): EncodeObject => ({ typeUrl: "/pendulumlabs.market.market.MsgRedeemDrop", value: MsgRedeemDrop.fromPartial( data ) }),
msgCancelOrder: (data: MsgCancelOrder): EncodeObject => ({ typeUrl: "/pendulumlabs.market.market.MsgCancelOrder", value: MsgCancelOrder.fromPartial( data ) }),
msgCreateDrop: (data: MsgCreateDrop): EncodeObject => ({ typeUrl: "/pendulumlabs.market.market.MsgCreateDrop", value: MsgCreateDrop.fromPartial( data ) }),
msgRedeemDrop: (data: MsgRedeemDrop): EncodeObject => ({ typeUrl: "/pendulumlabs.market.market.MsgRedeemDrop", value: MsgRedeemDrop.fromPartial( data ) }),
msgMarketOrder: (data: MsgMarketOrder): EncodeObject => ({ typeUrl: "/pendulumlabs.market.market.MsgMarketOrder", value: MsgMarketOrder.fromPartial( data ) }),
msgCreateOrder: (data: MsgCreateOrder): EncodeObject => ({ typeUrl: "/pendulumlabs.market.market.MsgCreateOrder", value: MsgCreateOrder.fromPartial( data ) }),

};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ export interface MarketMsgCreateOrderResponse {
export type MarketMsgCreatePoolResponse = object;

export interface MarketMsgMarketOrderResponse {
uid?: string;
amountBid?: string;
amountAsk?: string;
slippage?: string;
Expand Down Expand Up @@ -406,13 +407,6 @@ export interface V1Beta1PageRequest {
* is set.
*/
count_total?: boolean;

/**
* reverse is set to true if results are to be returned in the descending order.
*
* Since: cosmos-sdk 0.43
*/
reverse?: boolean;
}

/**
Expand Down Expand Up @@ -645,7 +639,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
Expand Down Expand Up @@ -703,7 +696,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
Expand Down Expand Up @@ -745,7 +737,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
Expand Down Expand Up @@ -837,7 +828,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
Expand Down Expand Up @@ -881,7 +871,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
Expand All @@ -907,7 +896,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
Expand Down Expand Up @@ -949,7 +937,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
Expand All @@ -976,7 +963,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
Expand All @@ -1003,7 +989,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
Expand Down Expand Up @@ -1061,7 +1046,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
Expand Down Expand Up @@ -1119,7 +1103,6 @@ export class Api<SecurityDataType extends unknown> extends HttpClient<SecurityDa
"pagination.offset"?: string;
"pagination.limit"?: string;
"pagination.count_total"?: boolean;
"pagination.reverse"?: boolean;
},
params: RequestParams = {},
) =>
Expand Down
Loading

0 comments on commit 5d288ca

Please sign in to comment.