@rubysdk/secret-client
Version:
RubySDK Secret Network client utilities for data, token and escrow operations
85 lines • 3.52 kB
JavaScript
"use strict";
/**
* This file was automatically generated by @cosmwasm/ts-codegen@1.12.0.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run the @cosmwasm/ts-codegen generate command to regenerate this file.
*/
Object.defineProperty(exports, "__esModule", { value: true });
exports.SecretEscrowClient = exports.SecretEscrowQueryClient = void 0;
class SecretEscrowQueryClient {
constructor(client, contractAddress) {
this.listEscrows = async ({ creator, limit, payoutTo, requiredDepositFrom, startAfter, status, tokenId }) => {
return this.client.queryContractSmart(this.contractAddress, {
list_escrows: {
creator,
limit,
payout_to: payoutTo,
required_deposit_from: requiredDepositFrom,
start_after: startAfter,
status,
token_id: tokenId
}
});
};
this.getEscrow = async ({ escrowId }) => {
return this.client.queryContractSmart(this.contractAddress, {
get_escrow: {
escrow_id: escrowId
}
});
};
this.client = client;
this.contractAddress = contractAddress;
this.listEscrows = this.listEscrows.bind(this);
this.getEscrow = this.getEscrow.bind(this);
}
}
exports.SecretEscrowQueryClient = SecretEscrowQueryClient;
class SecretEscrowClient extends SecretEscrowQueryClient {
constructor(client, sender, contractAddress) {
super(client, contractAddress);
this.createEscrow = async ({ expiration, memo, payouts, requiredDeposits }, fee_ = "auto", memo_, funds_) => {
return await this.client.execute(this.sender, this.contractAddress, {
create_escrow: {
expiration,
memo,
payouts,
required_deposits: requiredDeposits
}
}, fee_, memo_, funds_);
};
this.receive = async ({ amount, from, msg, tokenId }, fee_ = "auto", memo_, funds_) => {
return await this.client.execute(this.sender, this.contractAddress, {
receive: {
amount,
from,
msg,
token_id: tokenId
}
}, fee_, memo_, funds_);
};
this.cancelEscrow = async ({ escrowId }, fee_ = "auto", memo_, funds_) => {
return await this.client.execute(this.sender, this.contractAddress, {
cancel_escrow: {
escrow_id: escrowId
}
}, fee_, memo_, funds_);
};
this.executeEscrow = async ({ escrowId }, fee_ = "auto", memo_, funds_) => {
return await this.client.execute(this.sender, this.contractAddress, {
execute_escrow: {
escrow_id: escrowId
}
}, fee_, memo_, funds_);
};
this.client = client;
this.sender = sender;
this.contractAddress = contractAddress;
this.createEscrow = this.createEscrow.bind(this);
this.receive = this.receive.bind(this);
this.cancelEscrow = this.cancelEscrow.bind(this);
this.executeEscrow = this.executeEscrow.bind(this);
}
}
exports.SecretEscrowClient = SecretEscrowClient;
//# sourceMappingURL=SecretEscrow.client.js.map