-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: the cosmoswasm contract compiles the ts execution library (#34)
* feat: the cosmoswasm contract compiles the ts execution library * feat: codegen dir * build: rm cosmoswasm-codegen * cleanup --------- Co-authored-by: Amit Yadav <amy29981@gmail.com>
- Loading branch information
1 parent
41ddd20
commit 014013a
Showing
17 changed files
with
2,683 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,310 @@ | ||
/** | ||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. | ||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, | ||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. | ||
*/ | ||
|
||
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; | ||
import { StdFee } from "@cosmjs/amino"; | ||
import { Timestamp, Uint64, Uint128, Status, DetailsResponse, MakeSwapMsg, Coin, Height, TakeSwapMsg, ExecuteMsg, CancelSwapMsg, HeightOutput, InstantiateMsg, ListResponse, AtomicSwapOrder, QueryMsg } from "./Ics100.types"; | ||
export interface Ics100ReadOnlyInterface { | ||
contractAddress: string; | ||
list: ({ | ||
limit, | ||
startAfter | ||
}: { | ||
limit?: number; | ||
startAfter?: string; | ||
}) => Promise<ListResponse>; | ||
listByDesiredTaker: ({ | ||
desiredTaker, | ||
limit, | ||
startAfter | ||
}: { | ||
desiredTaker: string; | ||
limit?: number; | ||
startAfter?: string; | ||
}) => Promise<ListByDesiredTakerResponse>; | ||
listByMaker: ({ | ||
limit, | ||
maker, | ||
startAfter | ||
}: { | ||
limit?: number; | ||
maker: string; | ||
startAfter?: string; | ||
}) => Promise<ListByMakerResponse>; | ||
listByTaker: ({ | ||
limit, | ||
startAfter, | ||
taker | ||
}: { | ||
limit?: number; | ||
startAfter?: string; | ||
taker: string; | ||
}) => Promise<ListByTakerResponse>; | ||
details: ({ | ||
id | ||
}: { | ||
id: string; | ||
}) => Promise<DetailsResponse>; | ||
} | ||
export class Ics100QueryClient implements Ics100ReadOnlyInterface { | ||
client: CosmWasmClient; | ||
contractAddress: string; | ||
|
||
constructor(client: CosmWasmClient, contractAddress: string) { | ||
this.client = client; | ||
this.contractAddress = contractAddress; | ||
this.list = this.list.bind(this); | ||
this.listByDesiredTaker = this.listByDesiredTaker.bind(this); | ||
this.listByMaker = this.listByMaker.bind(this); | ||
this.listByTaker = this.listByTaker.bind(this); | ||
this.details = this.details.bind(this); | ||
} | ||
|
||
list = async ({ | ||
limit, | ||
startAfter | ||
}: { | ||
limit?: number; | ||
startAfter?: string; | ||
}): Promise<ListResponse> => { | ||
return this.client.queryContractSmart(this.contractAddress, { | ||
list: { | ||
limit, | ||
start_after: startAfter | ||
} | ||
}); | ||
}; | ||
listByDesiredTaker = async ({ | ||
desiredTaker, | ||
limit, | ||
startAfter | ||
}: { | ||
desiredTaker: string; | ||
limit?: number; | ||
startAfter?: string; | ||
}): Promise<ListByDesiredTakerResponse> => { | ||
return this.client.queryContractSmart(this.contractAddress, { | ||
list_by_desired_taker: { | ||
desired_taker: desiredTaker, | ||
limit, | ||
start_after: startAfter | ||
} | ||
}); | ||
}; | ||
listByMaker = async ({ | ||
limit, | ||
maker, | ||
startAfter | ||
}: { | ||
limit?: number; | ||
maker: string; | ||
startAfter?: string; | ||
}): Promise<ListByMakerResponse> => { | ||
return this.client.queryContractSmart(this.contractAddress, { | ||
list_by_maker: { | ||
limit, | ||
maker, | ||
start_after: startAfter | ||
} | ||
}); | ||
}; | ||
listByTaker = async ({ | ||
limit, | ||
startAfter, | ||
taker | ||
}: { | ||
limit?: number; | ||
startAfter?: string; | ||
taker: string; | ||
}): Promise<ListByTakerResponse> => { | ||
return this.client.queryContractSmart(this.contractAddress, { | ||
list_by_taker: { | ||
limit, | ||
start_after: startAfter, | ||
taker | ||
} | ||
}); | ||
}; | ||
details = async ({ | ||
id | ||
}: { | ||
id: string; | ||
}): Promise<DetailsResponse> => { | ||
return this.client.queryContractSmart(this.contractAddress, { | ||
details: { | ||
id | ||
} | ||
}); | ||
}; | ||
} | ||
export interface Ics100Interface extends Ics100ReadOnlyInterface { | ||
contractAddress: string; | ||
sender: string; | ||
makeSwap: ({ | ||
buyToken, | ||
createTimestamp, | ||
desiredTaker, | ||
expirationTimestamp, | ||
makerAddress, | ||
makerReceivingAddress, | ||
sellToken, | ||
sourceChannel, | ||
sourcePort, | ||
timeoutHeight, | ||
timeoutTimestamp | ||
}: { | ||
buyToken: Coin; | ||
createTimestamp: number; | ||
desiredTaker: string; | ||
expirationTimestamp: number; | ||
makerAddress: string; | ||
makerReceivingAddress: string; | ||
sellToken: Coin; | ||
sourceChannel: string; | ||
sourcePort: string; | ||
timeoutHeight: Height; | ||
timeoutTimestamp: number; | ||
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; | ||
takeSwap: ({ | ||
createTimestamp, | ||
orderId, | ||
sellToken, | ||
takerAddress, | ||
takerReceivingAddress, | ||
timeoutHeight, | ||
timeoutTimestamp | ||
}: { | ||
createTimestamp: number; | ||
orderId: string; | ||
sellToken: Coin; | ||
takerAddress: string; | ||
takerReceivingAddress: string; | ||
timeoutHeight: Height; | ||
timeoutTimestamp: number; | ||
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; | ||
cancelSwap: ({ | ||
createTimestamp, | ||
makerAddress, | ||
orderId, | ||
timeoutHeight, | ||
timeoutTimestamp | ||
}: { | ||
createTimestamp: string; | ||
makerAddress: string; | ||
orderId: string; | ||
timeoutHeight: HeightOutput; | ||
timeoutTimestamp: string; | ||
}, fee?: number | StdFee | "auto", memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; | ||
} | ||
export class Ics100Client extends Ics100QueryClient implements Ics100Interface { | ||
client: SigningCosmWasmClient; | ||
sender: string; | ||
contractAddress: string; | ||
|
||
constructor(client: SigningCosmWasmClient, sender: string, contractAddress: string) { | ||
super(client, contractAddress); | ||
this.client = client; | ||
this.sender = sender; | ||
this.contractAddress = contractAddress; | ||
this.makeSwap = this.makeSwap.bind(this); | ||
this.takeSwap = this.takeSwap.bind(this); | ||
this.cancelSwap = this.cancelSwap.bind(this); | ||
} | ||
|
||
makeSwap = async ({ | ||
buyToken, | ||
createTimestamp, | ||
desiredTaker, | ||
expirationTimestamp, | ||
makerAddress, | ||
makerReceivingAddress, | ||
sellToken, | ||
sourceChannel, | ||
sourcePort, | ||
timeoutHeight, | ||
timeoutTimestamp | ||
}: { | ||
buyToken: Coin; | ||
createTimestamp: number; | ||
desiredTaker: string; | ||
expirationTimestamp: number; | ||
makerAddress: string; | ||
makerReceivingAddress: string; | ||
sellToken: Coin; | ||
sourceChannel: string; | ||
sourcePort: string; | ||
timeoutHeight: Height; | ||
timeoutTimestamp: number; | ||
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { | ||
return await this.client.execute(this.sender, this.contractAddress, { | ||
MakeSwap: { | ||
buy_token: buyToken, | ||
create_timestamp: createTimestamp, | ||
desired_taker: desiredTaker, | ||
expiration_timestamp: expirationTimestamp, | ||
maker_address: makerAddress, | ||
maker_receiving_address: makerReceivingAddress, | ||
sell_token: sellToken, | ||
source_channel: sourceChannel, | ||
source_port: sourcePort, | ||
timeout_height: timeoutHeight, | ||
timeout_timestamp: timeoutTimestamp | ||
} | ||
}, fee, memo, _funds); | ||
}; | ||
takeSwap = async ({ | ||
createTimestamp, | ||
orderId, | ||
sellToken, | ||
takerAddress, | ||
takerReceivingAddress, | ||
timeoutHeight, | ||
timeoutTimestamp | ||
}: { | ||
createTimestamp: number; | ||
orderId: string; | ||
sellToken: Coin; | ||
takerAddress: string; | ||
takerReceivingAddress: string; | ||
timeoutHeight: Height; | ||
timeoutTimestamp: number; | ||
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { | ||
return await this.client.execute(this.sender, this.contractAddress, { | ||
TakeSwap: { | ||
create_timestamp: createTimestamp, | ||
order_id: orderId, | ||
sell_token: sellToken, | ||
taker_address: takerAddress, | ||
taker_receiving_address: takerReceivingAddress, | ||
timeout_height: timeoutHeight, | ||
timeout_timestamp: timeoutTimestamp | ||
} | ||
}, fee, memo, _funds); | ||
}; | ||
cancelSwap = async ({ | ||
createTimestamp, | ||
makerAddress, | ||
orderId, | ||
timeoutHeight, | ||
timeoutTimestamp | ||
}: { | ||
createTimestamp: string; | ||
makerAddress: string; | ||
orderId: string; | ||
timeoutHeight: HeightOutput; | ||
timeoutTimestamp: string; | ||
}, fee: number | StdFee | "auto" = "auto", memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { | ||
return await this.client.execute(this.sender, this.contractAddress, { | ||
CancelSwap: { | ||
create_timestamp: createTimestamp, | ||
maker_address: makerAddress, | ||
order_id: orderId, | ||
timeout_height: timeoutHeight, | ||
timeout_timestamp: timeoutTimestamp | ||
} | ||
}, fee, memo, _funds); | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
/** | ||
* This file was automatically generated by @cosmwasm/ts-codegen@0.35.3. | ||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, | ||
* and run the @cosmwasm/ts-codegen generate command to regenerate this file. | ||
*/ | ||
|
||
import { ContractBase, IContractConstructor, IEmptyClient } from "./contractContextBase"; | ||
import { Ics100Client, Ics100QueryClient } from "./Ics100.client"; | ||
export class Ics100 extends ContractBase<Ics100Client, Ics100QueryClient, IEmptyClient> { | ||
constructor({ | ||
address, | ||
cosmWasmClient, | ||
signingCosmWasmClient | ||
}: IContractConstructor) { | ||
super(address, cosmWasmClient, signingCosmWasmClient, Ics100Client, Ics100QueryClient, undefined); | ||
} | ||
|
||
} |
Oops, something went wrong.