Skip to content

Commit

Permalink
Merge pull request #362 from oraidex/feat/add-refund-btc-on-contracts…
Browse files Browse the repository at this point in the history
…-sdk

Add refund btc client on contracts sdk
  • Loading branch information
perfogic authored Nov 13, 2024
2 parents 5f3fadb + 4d78f2c commit 55c63a6
Show file tree
Hide file tree
Showing 4 changed files with 133 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/contracts-sdk/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@oraichain/oraidex-contracts-sdk",
"version": "1.0.55",
"version": "1.0.56",
"main": "build/index.js",
"files": [
"build/",
Expand Down
92 changes: 92 additions & 0 deletions packages/contracts-sdk/src/RefundBtc.client.ts
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);
};
}
38 changes: 38 additions & 0 deletions packages/contracts-sdk/src/RefundBtc.types.ts
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[];
}
2 changes: 2 additions & 0 deletions packages/contracts-sdk/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,4 +34,6 @@ export * as ZapperTypes from "./Zapper.types";
export * from "./Zapper.client";
export * as IncentivesFundManagerTypes from "./IncentivesFundManager.types";
export * from "./IncentivesFundManager.client";
export * as RefundBtcTypes from "./RefundBtc.types";
export * from "./RefundBtc.client";
export * from "./types";

0 comments on commit 55c63a6

Please sign in to comment.