-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #362 from oraidex/feat/add-refund-btc-on-contracts…
…-sdk Add refund btc client on contracts sdk
- Loading branch information
Showing
4 changed files
with
133 additions
and
1 deletion.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,92 @@ | ||
/** | ||
* This file was automatically generated by @oraichain/[email protected]. | ||
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file, | ||
* and run the @oraichain/ts-codegen generate command to regenerate this file. | ||
*/ | ||
|
||
import { CosmWasmClient, SigningCosmWasmClient, ExecuteResult } from "@cosmjs/cosmwasm-stargate"; | ||
import { Coin, StdFee } from "@cosmjs/amino"; | ||
import {InstantiateMsg, ExecuteMsg, Addr, Uint128, AssetInfo, Asset, QueryMsg, MigrateMsg, Config, RewardTokensResponse} from "./RefundBtc.types"; | ||
export interface RefundBtcReadOnlyInterface { | ||
contractAddress: string; | ||
rewardTokens: ({ | ||
addr | ||
}: { | ||
addr: Addr; | ||
}) => Promise<RewardTokensResponse>; | ||
config: () => Promise<Config>; | ||
} | ||
export class RefundBtcQueryClient implements RefundBtcReadOnlyInterface { | ||
client: CosmWasmClient; | ||
contractAddress: string; | ||
|
||
constructor(client: CosmWasmClient, contractAddress: string) { | ||
this.client = client; | ||
this.contractAddress = contractAddress; | ||
this.rewardTokens = this.rewardTokens.bind(this); | ||
this.config = this.config.bind(this); | ||
} | ||
|
||
rewardTokens = async ({ | ||
addr | ||
}: { | ||
addr: Addr; | ||
}): Promise<RewardTokensResponse> => { | ||
return this.client.queryContractSmart(this.contractAddress, { | ||
reward_tokens: { | ||
addr | ||
} | ||
}); | ||
}; | ||
config = async (): Promise<Config> => { | ||
return this.client.queryContractSmart(this.contractAddress, { | ||
config: {} | ||
}); | ||
}; | ||
} | ||
export interface RefundBtcInterface extends RefundBtcReadOnlyInterface { | ||
contractAddress: string; | ||
sender: string; | ||
claim: (_fee?: number | StdFee | "auto", _memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; | ||
addRewarder: ({ | ||
rewarder, | ||
rewards | ||
}: { | ||
rewarder: Addr; | ||
rewards: Asset[]; | ||
}, _fee?: number | StdFee | "auto", _memo?: string, _funds?: Coin[]) => Promise<ExecuteResult>; | ||
} | ||
export class RefundBtcClient extends RefundBtcQueryClient implements RefundBtcInterface { | ||
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.claim = this.claim.bind(this); | ||
this.addRewarder = this.addRewarder.bind(this); | ||
} | ||
|
||
claim = async (_fee: number | StdFee | "auto" = "auto", _memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { | ||
return await this.client.execute(this.sender, this.contractAddress, { | ||
claim: {} | ||
}, _fee, _memo, _funds); | ||
}; | ||
addRewarder = async ({ | ||
rewarder, | ||
rewards | ||
}: { | ||
rewarder: Addr; | ||
rewards: Asset[]; | ||
}, _fee: number | StdFee | "auto" = "auto", _memo?: string, _funds?: Coin[]): Promise<ExecuteResult> => { | ||
return await this.client.execute(this.sender, this.contractAddress, { | ||
add_rewarder: { | ||
rewarder, | ||
rewards | ||
} | ||
}, _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,38 @@ | ||
export interface InstantiateMsg {} | ||
export type ExecuteMsg = { | ||
claim: {}; | ||
} | { | ||
add_rewarder: { | ||
rewarder: Addr; | ||
rewards: Asset[]; | ||
}; | ||
}; | ||
export type Addr = string; | ||
export type Uint128 = string; | ||
export type AssetInfo = { | ||
token: { | ||
contract_addr: Addr; | ||
}; | ||
} | { | ||
native_token: { | ||
denom: string; | ||
}; | ||
}; | ||
export interface Asset { | ||
amount: Uint128; | ||
info: AssetInfo; | ||
} | ||
export type QueryMsg = { | ||
reward_tokens: { | ||
addr: Addr; | ||
}; | ||
} | { | ||
config: {}; | ||
}; | ||
export interface MigrateMsg {} | ||
export interface Config { | ||
owner: Addr; | ||
} | ||
export interface RewardTokensResponse { | ||
reward_tokens: Asset[]; | ||
} |
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